C
Craig Dunstan
I have set up a Managed Automation Add-in for Excel and it works fine until I
try to reference some code which uses reflection to deserialize an object
from disk.
In this scenario, I have a class library "SBW" which contains all the class
definitions and is referenced by another class library "XLPricingFunctions"
which presents a couple of functions to Excel using COM interop.
Within SBW I call the following code:
public static Products Open()
{
Products result = null;
if (File.Exists(LocalFile))
{
using (FileStream fs = new FileStream(LocalFile,
FileMode.Open))
{
BinaryFormatter formatter = new BinaryFormatter();
result = (Products)formatter.Deserialize(fs);
}
}
else
result = new Products();
}
An exception is raised upon "Deserializing" saying that it cannot find the
assembly and provides the name of the assembly in which the class resides
(Pricebook). It all works fine when called from a Console Application or
Windows Forms Application.
I have been able to debug into the code and see where the error is raised.
Any help would be great.
try to reference some code which uses reflection to deserialize an object
from disk.
In this scenario, I have a class library "SBW" which contains all the class
definitions and is referenced by another class library "XLPricingFunctions"
which presents a couple of functions to Excel using COM interop.
Within SBW I call the following code:
public static Products Open()
{
Products result = null;
if (File.Exists(LocalFile))
{
using (FileStream fs = new FileStream(LocalFile,
FileMode.Open))
{
BinaryFormatter formatter = new BinaryFormatter();
result = (Products)formatter.Deserialize(fs);
}
}
else
result = new Products();
}
An exception is raised upon "Deserializing" saying that it cannot find the
assembly and provides the name of the assembly in which the class resides
(Pricebook). It all works fine when called from a Console Application or
Windows Forms Application.
I have been able to debug into the code and see where the error is raised.
Any help would be great.