Blog Archives

An Error of Judgement

I recently came to work and found that I had unwittingly coded a bizarre occurrence.  Unsure as to how I came across it, but thankfully it was spotted while I am still developing the solution.

image

The above error came as a result of this, this isn’t the error I saw in my application before spotting it, thankfully I spotted it before I built and test run the code.  But using a demo, this is the error I got, just to show you the result of this.  Below is the code that causes this;

class Program
{
	static void Main(string[] args)
	{
		TestClass tempClass = new TestClass();
	}
}

public class TestClass
{
	public int Id { get; set; }
	public string Name { get; set; }

	public TestClass()
	{
		LoadData();
	}

	public void LoadData()
	{
		for (int i = 0; i < 10; i++)
		{
			TestClass tempItem = new TestClass();
			tempItem.Id = i;
			tempitem.Name = string.Format("My Name - {0}", i);
		}
	}
}

It might not be completely obvious but there is an infinite loop there.  Not in the traditional sense which is why it might not seem too obvious.  In the Constructor of TestClass I call the method LoadData.  In which I create a new instance of TestClass, which them again calls LoadData and so on.

Like I said not your typical infinite loop;

while (true)
{
	i++;
}

Like above we can see that is will not exit this loop, but this one, will just cause the application to hang there.  The other ran into an error but the error, though correct might have you going down the wrong path.  Suffice to say I have fixed this, called the LoadData from the code path that creates the instance of the data, and the constructor is now empty.

Sometimes as programmers you have dumb moments, thankfully it got caught before it gets put into a production environment.

Javascript Error in AjaxControlToolkit

thC1BL12ENDocumentation for this is sketchy at best, but I am unsure if this is the solution for all instances of the error.  The AjaxControlToolkit, is a nice addition to the ASP.NET stable, managed on Codeplex this enables you to include extenders that provide useful and sometimes just nice features to the existing toolkit of server side controls in ASP.NET.

Following their examples, I wanted to include a simple Password Strength extender to a password box.  Sounds simple, since as users type in their password it gives and indication of how good their password is.  This is merely a visual indicator and not anything to do with validation or what is acceptable.

I follow their coding example, which is below.

&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head runat=&quot;server&quot;&gt;
&lt;title&gt;Control Toolkit&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;
&lt;asp:ScriptManager ID=&quot;asm&quot; runat=&quot;server&quot; /&gt;
&lt;div&gt;
&lt;asp:TextBox ID=&quot;Password&quot; runat=&quot;server&quot; /&gt;
&lt;ajaxToolkit:PasswordStrength ID=&quot;ps1&quot; runat=&quot;server&quot; 
	TargetControlID=&quot;Password&quot; RequiresUpperAndLowerCaseCharacters=&quot;true&quot; 
	MinimumNumericCharacters=&quot;1&quot; MinimumSymbolCharacters=&quot;1&quot; 
	PreferredPasswordLength=&quot;8&quot; DisplayPosition=&quot;RightSide&quot; 
	StrengthIndicatorType=&quot;Text&quot; /&gt;
&lt;/div&gt;
&lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

Straight from the horses mouth so to speak.  But you run this and you get a nice little error jumping out at you.  This isn’t an ASP.NET one but a JavaScript error so it only appears when you visit the page with the control on it.

image

What?  What does this mean? 

0x800a138f – JavaScript runtime error: Unable to get property ‘UI’; of undefined or null reference.

Hitting break shows me this line of JavaScript; (I added comments to prevent any browser issues.

//$create(Sys.Extended.UI.PasswordStrengthExtenderBehavior, 
    {&quot;CalculationWeightings&quot;:&quot;40;15;15;30&quot;,
    &quot;MinimumNumericCharacters&quot;:1,
    &quot;MinimumSymbolCharacters&quot;:1,
    &quot;PreferredPasswordLength&quot;:8,
    &quot;RequiresUpperAndLowerCaseCharacters&quot;:true,
    &quot;StrengthStyles&quot;:&quot;Bad;Poor;Weak;Normal;Good;Excellent;Strong&quot;,
    &quot;TextStrengthDescriptionStyles&quot;:&quot;Bad;Poor;Weak;Normal;Good;Excellent;Strong&quot;,
    &quot;TextStrengthDescriptions&quot;:&quot;Bad;Poor;Weak;Normal;Good;Excellent;Strong&quot;,
    &quot;id&quot;:&quot;PasswordStrength1&quot;}, 
    null, 
    null, 
    $get(&quot;txtPassword&quot;));

Strangely looking into the data finds that Sys is fine but it is the Extended that is undefined.  So why is this happening?  Don’t know, following the exact sample there causes an error.  My opinion, the example doesn’t work, period OR, it is not meant for the version of .NET I am using (which is 3.5 SP1).

BUT I fixed it.  HOW?  Simple, maybe.

Change;

&lt;asp:ScriptManager ID=&quot;asm&quot; runat=&quot;server&quot;/&gt;

to;

&lt;asp:ToolkitScriptManager ID=&quot;asm&quot; runat=&quot;server&quot;/&gt;

I am unable to properly determine why but it seems the standard one that ships with asp, this is the plain ScriptManager doesn’t have all the elements required for the one that ships with the Toolkit.  Therefore the ToolkitScriptManager is required.  There is also a reference to the ToolkitScriptManager on their site but examples use the ASP.NET one. 

SO, to put it as simple as possible ANY of the Toolkit objects you may want to use, USE the ToolkitScriptManager, place this just under the form and it should work.  Other Ajax controls that ship with ASP.NET the normal ScriptManager will work fine.

So even if you see this error on other controls you have used check the ScriptManage component in your code.  It might be the wrong one.  Might I say, since I am unsure if one might work in specific examples, all I know is the PasswordStrength one, this fixed it.

Windows 8 and Error Code: 0x80073d0a

image

This was an interesting situation I received.  I had played with the developer preview, then the customer preview of Windows 8.  All of this however was on my laptop, which is configured slightly different to my desktop at home.  I have recently installed Windows 8 on my desktop.  I did the usual things that I would on my Windows 7 configuration.  That said, I didn’t know that it would be the cause of one of my issues.

I logged into the Windows Store to see what free Metro style application I could play with.  They are now called Windows 8 ‘Modern’ application.  These are applications designed only to run in Windows 8.  Though some might work on Windows Phone 8, I am unsure as I haven’t put a lot of research into this yet.

I found a wonderful little application called Music Maker Jam.  I will not get into this, but I had some fun with this imageand have some creations that I will share in another post.  But, since this was free I thought I would give it a go.  I clicked the install button in the Windows Store, it went away and everything seemed OK. 

But the icon on the Start Screen had an x against it and when I clicked it, it told me I couldn’t start the application.  I investigated and it stating the application couldn’t installed as it returned the following Error Code: 0x80073d0a.

Great, of course this lead me to search the internet and I saw a LOT of strange listing about doing strange things, changing the account from Live to local, stating it was a UAC problem, refresh the start screen.  There was however a very simple solution, one I didn’t know think about at the time.

The application failed to install as it wanted to do something with the Windows Firewall, which in my standard desktop configuration was off. 

Why do I have Windows Firewall off?  Because I have a personally configured hardware one, which I feel is a little more secure than the software one in Windows not to mention is also faster.  Since latency is a key for me, if you haven’t noticed with my previous post on the issue.

So, if you are trying to install Windows 8 ‘Modern’ applications, and find they aren’t installing but return the above error code, check the state of your firewall. image

Press ÿ + X

Click Control Panel

 Click Security and Security

Click Windows Firewall

If the firewall is off in this it will display some information regarding its current state.  But the strange issue with it, if you have turned the firewall off, but the service is still running, it will still work.  Why?  My thought is it uses the service to add the application to the allow list, so when the service isn’t running that is when you get the above failures.

If the firewall is off there will be message indicating it so, Click Use Recommended Settings.  Which turns it on.  Remove the application and install them again.

So if you are like me, have a hardware firewall but doesn’t like the idea of having the Windows Firewall using up resources and monitoring network packets, but still want to use Windows RT applications that want to be added to be allowed through the firewall, I am afraid that you will need to either manually enable the firewall when you come across the problem or to have it on. 

It is a bit of a pain, but for the majority of people this will not be an issue.

image