A new guard page for the stack cannot be created

 

You get a nice error that says, “A new guard page for the stack cannot be created”, well easy fix. I could be long winded, but the issue is simply this, you caused a stack overflow.

How you say? Well, check to see if you are using a Server.Transfer that transfers you to a page that then Transfers you back and forth, or even to yourself.

Have login code that checks to see if you are logged in? If not, then it bounces you to a login page. Maybe you put it in a master page. Well, if the login page uses the master page, it will just keep transferring itself to itself and you blow the stack.

Response.Redirect will give you a different error as the browser only jumps a low number of redirects before giving up. Server.Transfer uses the internal stack, so it blows up on the server itself.

Happy coding!

Updated my WCF Data Contract but client doesn’t receive the property values….

I spent about ten minutes wondering why I wasn’t getting the data I expected from my WCF service. I had just changed my data contract to have one more property/field and the data wasn’t being received by my client application. The client is in javascript, so it’s happy with whatever it receives. So no errors there, just an undefined property.

I looked at fiddler and noticed it didn’t come through there either. Now I chalked it up to a stale build and rebuilt again. Hmm…. Still undefined…wtf?

Well, simple issue with a simple fix. It turns out I , DUH, forget to tag the property as a DataMember. So the serializer ignored it thinking it was just an internal variable. No need to serialize or expose. Geez.

My fault but it was pretty funny when I started going back through my entities and contracts and started comparing them.

So, in short, if your client for your WCF service is not receiving the property you expect on the data contract, make sure you marked them properly. Easy to overlook when you are updating the DAL DTO’s, Business Entities, and then your Contract Entity.

Example:

/// <summary>
/// Gets or sets the reference.
/// </summary>
/// <value>
/// The reference.
/// </value>
[DataMember(Name= “Reference”)]
public string Reference { get; set; }

Happy coding!

HRESULT: 0x80131515 when running installutil to install a .NET Service

So you write your nice and fancy service and are all excited to distribute it to your client. You don’t feel like creating an installer for it, that seems like overkill. You just send a zip file with a batch file that calls installutil to register the service. Easy right?

Well, your client calls and complains that get the following error when running installutil aka your batch file:

Exception occurred while initializing the installation:

System.IO.FileLoadException: Could not load file or assembly ‘file:///D:servicesmyservicehost.exe’ or one of its dependencies. Operation is not support. (Exception from HRESULT: 0x80131515).

I am sure you will start scratching your head and immediately blame them missing a dll or maybe the client ran it wrong. Maybe they have it in the wrong directory? Seems feasible, right? Wrong.

It turns out that Windows was protecting them. Windows doesn’t like files from other computers very much, especially not executables. They get a special stay away from me flag.

So, how do I fix this? Easy. Just open the properties dialog on the exe/service you extracted and hit the UNBLOCK button. Now installutil will work great!

Happy Coding!