Addressing binding issues with with Ivonna 2.0.0 using <dependentAssembly> in web.config
I have been having some binding problems when trying to use Ivonna 2.0.0 against a version of Typemock Isolator other than the 5.3.0 build it was built to run against. This is a know issue, if your version of Ivonna and Typemock don’t match then you have to use .Net Binding redirection to get around the problem.
So to track down the exact problem I used the Fusion logger shipped with the .NET SDK (via fuslogvw.exe). This in itself has been an interesting experience. A few points are worth noting:
- You cannot alter the settings (as to what it logs) from fuslogvw.exe unless you are running as administrator (because these a really just registry edits in HKLMSOFTWAREMicrosoftFusion node). However you can use the viewer to view logs even if not an administrator as long as the registry entries are correct.
- I could only get the Fusion log to work if I was running my ASP.NET application in Visual Studio 2008 running as administrator, if I was a standard user nothing was logged.
- You have to remember to press refresh on fuslogvw.exe a lot. If you don’t you keep thinking that it is not working when it really is.
Anyway using the fusion logger I found I had two problem assemblies, not just the one I had expected. I had guessed I need to intercept the loading of the main Typemock assembly, but what the fusion logger showed me was I also needed to intercept the Typemock.Intergration assembly. Also I needed to reference the Typemock.Intergration assembly in my test project and make sure it was copied locally (something I had not needed to explicitly do when using Typemock 5.3.0 where it had found via I assume via the GAC)
Now it is important to remember that if using MSTEST and Ivonna you need to point the build directory for the Test Project to Web Application under test’s bin directory. This means that the .NET loader will check the web.config in the web application for any binding information, not just in the app.config in the test project as I had first assumed.
So all this means that I needed to add the following to my Web Application’s web.config and app.config
1<runtime\>
2 <assemblyBinding xmlns\="urn:schemas-microsoft-com:asm.v1"\>
3 <dependentAssembly\>
4 <assemblyIdentity name\="TypeMock.Integration"
5 publicKeyToken\="3dae460033b8d8e2"
6 culture\="neutral" />
7 <bindingRedirect oldVersion\="5.3.0.0"
8 newVersion\="5.3.1.0"/>
9 </dependentAssembly\>
10 <dependentAssembly\>
11 <assemblyIdentity name\="TypeMock"
12 publicKeyToken\="3dae460033b8d8e2"
13 culture\="neutral" />
14 <bindingRedirect oldVersion\="5.3.0.0"
15 newVersion\="5.3.1.0"/>
16 </dependentAssembly\>
17
18 </assemblyBinding\>
19 </runtime\>
20
Once this was done all my test loaded as expected
Updated 4th June 2009 – There is now 2.0.1 release of Ivonna that does support Isolator 5.3.1 so this binding is not required, but details are good as in the future there is bound to be another version mismatch