At first, I agreed with you, but after further examination I am feeling very certain that it is a problem with TypeMock. However, it is not easily reproduced - I am only experiencing it with certain assemblies and I have yet to find what causes it. I am thinking that you guys (knowing what typemock does) might be able to deduce it. Here goes:
The problem has to do with typeloading, and what looks to be shadowcopy - or some mechanism like it.
Problem: When TypeMock.Init has been called, creating a XmlSerializer of types in *certain* assemblies does not work. If TypeMock is not loaded (no init called), everything works fine. I am using an exe to test (in order to isolate):
using XXXX.Core.Cache.Configuration; // I put "Apa2.MyTestClass" in this ambly
public class Class1
public static void Main()
XmlSerializer serializer2 = new XmlSerializer( typeof(Apa2.MyTestClass) );
This throws the aforementioned FileNotFound exception (see previous message). Commenting MockManager.Init will make the code run through with no hitch. (In order to isolate, the class "MyTestClass" is a dummy with no content whatsoever. The important thing is the assembly it resides in.
Looking at whats going on with the binding, a temp dll is created and it seems to try to use it for the MyTestClass type, yet I have not confirmed this. Using filemon I see that the DLL is deleted and subsequently an attempt to open it fails. Fusion gives this pruned looking log:
*** Assembly Binder Log Entry (7/11/2006 @ 2:20:39 PM) ***
The operation failed.
Bind result: hr = 0x80070002. The system cannot find the file specified.
Assembly manager loaded from: C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\fusion.dll
Running under executable C:\temp\tests\TMProblem\apaexe\bin\Debug\apaexe.exe
--- A detailed error log follows.
=== Pre-bind state information ===
LOG: Where-ref bind. Location = C:\DOCUME~1\CUSW\LOCALS~1\Temp\ppoqjrwk.dll
LOG: Appbase = C:\temp\tests\TMProblem\apaexe\bin\Debug\
LOG: Initial PrivatePath = NULL
LOG: Dynamic Base = NULL
LOG: Cache Base = NULL
LOG: AppName = NULL
Calling assembly : (Unknown).
LOG: Processing DEVPATH.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/DOCUME~1/CUSW/LOCALS~1/Temp/ppoqjrwk.dll.
LOG: All probing URLs attempted and failed.
As I said though, here is the rub: This only happens for certain assemblies. I have no idea what makes them special (so far only working with one).
If I reference another type in another assembly, no temp dll is created at all. If I comment out MockManager.Init, no temp dll is created. So typemock seems to either be creating it or be indirectly responsible for that it gets created.
I really hope you guys have an idea of what this is about!
The assembly has a strong name (not in GAC though). Dunno if that matters.