viernes, 18 de noviembre de 2011

Run iis7 under 32 bits to load com objetcs

Link below has full details
http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/0aafb9a0-1b1c-4a39-ac9a-994adc902485.mspx?mfr=true

Getting "Error Unit Test Adapter threw exception: Unable to find assembly 'The assembly'" when running your tests

Here is another issue that I faced and want to share with you so you don’t waste hours on this, please share this to anyone who will be using w7 64 bits.
I was getting exception below running tests that were already running:
“Error Unit Test Adapter threw exception: Unable to find assembly 'The assembly’”
And I had to do below steps to fix this, I don’t think this is the best way to do it but so far is the only way I’ve found to fix it, link at the bottom contains more info.
Assuming VS2008 is installed on your development computer in "C:\Program Files\Microsoft Visual Studio 9.0", create the folder "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\UnitTestAssemblies". Copy YourTested.dll to that new folder.
Next, you need to edit the file "C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\VSTestHost.exe.config". There should be a line that looks like:

Change it to:

Restart VS2008 and run your unit tests again.
Always keep the assemblies in UnitTestAssemblies up-to-date. If you build a new Csla.dll, then copy it to UnitTestAssemblies before trying to execute your unit tests.
http://forums.lhotka.net/forums/t/5297.aspx

sábado, 12 de noviembre de 2011

.NET Interop pitfalls

I faced a few issues on the Migration Utility when loading COM objects (VB) from .NET and I want to share fixes so you could avoid wasting hours of your life.


Don’t trust on VB class Terminate event: it does not get fired! I load lots of SUI_WEB.SUI_Container objects and I was having a memory leak since memory is released internally on this event, even if you call Marshal.ReleaseComObject() and then set it to null.


Call Marshal.ReleaseComObject() method when you no longer need it: yes, we are coding on a managed code environment but if COM object is expensive, it’s recommended.


Don’t use two dots on a single line: .net wrappers seems to be not releasing objects for us, more details in links below.

http://stackoverflow.com/questions/158706/how-to-properly-clean-up-excel-interop-objects-in-c-sharp

http://www.velocityreviews.com/forums/showpost.php?s=f87f0674feda4442dcbd40019cbca65b&p=528575&postcount=2