Using the Composite Application Block, we have a module that is loaded dynamically that references CSLA and our Business Object Library.
Calling CancelEdit against a business object, we receive a serialization exception in the UndoableBase.UndoChanges method.
The following line of code is the culprit -
Dim
formatter As New BinaryFormatter()state = _
CType(formatter.Deserialize(buffer), HybridDictionary)The exception thrown is "unable to locate assembly XXXXX" which is our Business Object Library using CSLA.
Everything appears to work fine outside of the CAB....
using CSLA 2.1, VS2005, .NET 2.0
I'm guessing here (having not looked at how CAB works) that they are using dynamic assembly loading.
There's a "feature" (Microsoft won't call it a bug no matter how hard I try) of .NET where dynamically loaded assemblies don't always find loaded assemblies during deserialization.
This "feature" is a problem in many scenarios, including Enterprise Services, IE and various other dynamic containers for code.
If you look at the EnterpriseServicesPortal in CSLA .NET (discussed in Chapter 4), you'll find code for a "Serialization bug workaround", including a SerializationWorkaround() method. If this method is called once, at the start of your AppDomain, it will resolve the issue.
Again, I don't know that this is your issue - but it is a good bet that it is - and this workaround solves that particular issue.
RockfordLhotka:I'm guessing here (having not looked at how CAB works) that they are using dynamic assembly loading.
There's a "feature" (Microsoft won't call it a bug no matter how hard I try) of .NET where dynamically loaded assemblies don't always find loaded assemblies during deserialization.
This "feature" is a problem in many scenarios, including Enterprise Services, IE and various other dynamic containers for code.
If you look at the EnterpriseServicesPortal in CSLA .NET (discussed in Chapter 4), you'll find code for a "Serialization bug workaround", including a SerializationWorkaround() method. If this method is called once, at the start of your AppDomain, it will resolve the issue.
Again, I don't know that this is your issue - but it is a good bet that it is - and this workaround solves that particular issue.
Copyright (c) Marimer LLC