VerificationException from Windows Azure IntelliTrace

Kyle has posted about a problem you may see if you use IntelliTrace in the Cloud to debug your RIA Services on Windows Azure.

In a nutshell, if you see these exceptions:

and the client, this will appear as the standard “Not Found” CommunicationException when looking through an IntelliTrace log downloaded from the Cloud then you are running into the issue.

Kyle goes over 3 options, the least impactful is to simply add the following line to the modules to exclude: *System.ServiceModel.DomainServices.*

Let’s talk about the underlying issue and when you might see this in your own code.

The issue is that IntelliTrace itself has a bug where methods that have a boolean out parameter in an assembly that is marked as SecurityTransparent will fail when IntelliTrace collection is set to “high” which is the default in the Cloud IntelliTrace scenario.

You will see this in your own code if you have a method whose signature includes a boolean out parameter and you have set your assembly security to SecurityTransparent.

For example:

 protected void Button1_Click(object sender, EventArgs e)
    bool val = true;
    DummyBoolOut(out val);

    Label1.Text = "Clicked the button";

private void DummyBoolOut(out bool retBool)
    retBool = false;

and in the assembly level attributes:

 [assembly: System.Security.SecurityTransparent()]

When I run this on Windows Azure, I get a VerficiationException on the call to DummyBoolOut().



You can continue to use IntelliTrace but would need to exclude your module (i.e. assembly) from being instrumented and you would do so by clicking on the IntelliTrace settings on the Windows Azure deploy dialog:


And adding your assembly to the module exclusion list.