After deploying our huge distributed system to one of our clients we experience an unexpected error. During the investigation we replace the assembly causing the error with
First of all sorry about my English. I know this post is old but I have just the same problem, and I realize that in debug mode the build is made for 32 bit OS, and the release mode is for 64 bit by default. This make the DLL's made for 32 bit doesn't work in release. If you go to Project properties -> build you can choose the architecture you want. This works for me.
For causes... well, some hint of the symptom would help. One possibility is that you have code to a method like Debug.WriteLine
that has side effects (i.e. makes it work). Calls to methods marked with [Conditional(...)]
are not compiled unless you have the right symbols defined - so anything marked [Conditional("DEBUG")]
will be silently dropped.
It could also be a compiler bug, but that is a bit unlikely (but not impossible).
What is the symptom? How does it break?
As an example of the above:
static string Bar { get; set; }
static void Main()
{
Bar = "I'm broken";
Debug.WriteLine(Foo());
Console.WriteLine(Bar);
}
// note Foo only called in DEBUG builds
static string Foo()
{
Bar = "I'm working";
return "mwahahah";
}
Compiled in DEBUG mode it prints "I'm working"; compiled in RELEASE mode it prints "I'm broken". Does this sound similar? Check you aren't calling any debug methods directly with things that have side-effects. In most cases, you can fix by indirection:
string foo = Foo();
Debug.WriteLine(foo);
Now it gets called in either mode.
Have you tried including the debug files? (the pdbs)
If you co go your project settings and then the compile 'tab' select your release build in the dropdown near the top, then choose advanced compile options near the bottom, make sure to set it to create FULL debug information, then redeploy, you should now get more detailed information about the reason for the crash.