I used to believe that if we got a Debug
build it didn't really matter whether:
everything would be the same.
However recently I ran into 2 different problems, where its clear that something is different when the code is just run, or when it is debugged, even if version of code is supposedly the same. (namely Fluent NHibernate cannot load MySql.Data from GAC in debug mode of a test and Npgsql - Specified method is not supported)
I am wondering what is that difference between those two in .NET 4.0? Understanding whats different could probably help me solve the issues I am having because I'll at least know where to look for possible causes of bugs in those different cases. I don't understand it when I run unit tests its all green, but when I try to debug them I get various exceptions thrown..
The weapon of choice for assembly resolution problems is fuslogvw.exe, it shows you where it looked for an assembly and what configuration is being used to tell the CLR where to find the assembly.
There is a secondary failure mode with the kind of assemblies you are having trouble with. These dbase providers are often managed wrappers that rely on unmanaged DLLs to get the job done. Windows must be able to find those DLLs. That tends to fail if they are not copied to a directory that's on the PATH or copied into the same folder as the main EXE. Carefully read the deployment instructions for these wrappers.
When debugging the timing of the code will be slightly different, more so if you sit inside functions too long. So if the code is time sensitive, you could run into weird errors. That's about all I can think of.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With