Hey everyone,
Has anyone else noticed that you can do XML Serialization from FSI (in Visual Studio) on the second time, but not the first?
Here's what I'm doing:
1) Using F# to create a MyCustomObject (which is written in C# and marked as Serializable)
2) Calling myCustomObject.Serialize("file.xml"), which in turn serializes the object's data to file.xml
3) Upon doing this, FSI throws an exception:
stdin(0,0): error: Unable to find the file MyNamespace.MyCustomObject.XmlSerializers.dll in any of
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\
C:\WINDOWS\system32\..\assembly\GAC\Microsoft.Office.Interop.Owc11\11.0.0.0__71e9bce111e9429c
<other paths here>
C:\Program Files\FSharp-1.9.3.7\bin.
It was looking for a non-existent DLL (MyNamespace.MyCustomObject.XmlSerializers.dll) and failed.
4) So out of curiosity, I just ran my script again (Ctrl-A, Alt-Enter) and it worked as expected. I think that to do XML Serialization, the .NET Framework needs to create a temporary class at runtime that know how to serialize my custom object. For some reason, FSI can't find the assembly the first time, but can the second time.
Most odd :) Hope that helps someone.
-Matt
http://thevalerios.net/matt/