Assembly.Load - Invalid address 0 and range 40 Ram Start 20000000, Ram end 20020000

When using Assembly.Load and you get this error make sure the assembly you are loading aren’t initializing any static variables like so;


private static double win = 10.0D;

Instead just declare the static variables and init them somewhere else;


private static double win;

public static void Init()
{
     win = 10.0D;
}

Not sure if this is a bug or what not. It took me quite a while to figure that one out.

Have you tried in emulator? Perhaps post this on netmf codeplex so Microsoft can comment.

It works fine in the emulator.

We will look into it but thus is related to the very core so it maybe best to get Microsoft involved.

It’s not a big deal since the workaround is simple. Just wanted to give people a heads up if they encounter the same issue.

I’ve come across this with my Cerberus now, but I didn’t have any static variables in my code. I did have, but I removed them according to this post. Alas, the Cerberus would keep hold of my previous program, flat out refusing to deploy a new version. Just would not budge. The solution was to create a new project in Visual Studio, no modules no nothing attached, and that I was able to deploy. Strange thing.