|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Serialization WoesI have a type that is serializable that is located in an assembly that is
loaded dynamically from a special directory. When deserializing this object the framework fails to find the type. Now, I am aware of the SerializationBinder class and how it can be used to get around this problem however that only works when you are dealing with the formatters yourself and have the ability to set the binder class. In my case, I have an object that needs to go on the Clipboard. The problem is that it isn't being handled correctly. How do I deal with this case? Thanks. I could be completely off-base here, because I've never had to do this for
serialization, but you might want to look into creating an AppDomain.TypeResolve event handler to resolve the type. I've never used TypeResolve, but I have used ResourceResolve and AssemblyResolve and it sounds like it might fit the bill for you. Pete Show quote "Oldman" <Old***@discussions.microsoft.com> wrote in message news:9602458A-376C-4A06-BB3B-58661D863A38@microsoft.com... >I have a type that is serializable that is located in an assembly that is > loaded dynamically from a special directory. When deserializing this > object > the framework fails to find the type. > > Now, I am aware of the SerializationBinder class and how it can be used to > get around this problem however that only works when you are dealing with > the > formatters yourself and have the ability to set the binder class. In my > case, I have an object that needs to go on the Clipboard. > The problem is that it isn't being handled correctly. How do I deal with > this case? > > Thanks. Thanks! I will look into that.
Show quote "Pete" wrote: > I could be completely off-base here, because I've never had to do this for > serialization, but you might want to look into creating an > AppDomain.TypeResolve event handler to resolve the type. > > I've never used TypeResolve, but I have used ResourceResolve and > AssemblyResolve and it sounds like it might fit the bill for you. > > Pete > > "Oldman" <Old***@discussions.microsoft.com> wrote in message > news:9602458A-376C-4A06-BB3B-58661D863A38@microsoft.com... > >I have a type that is serializable that is located in an assembly that is > > loaded dynamically from a special directory. When deserializing this > > object > > the framework fails to find the type. > > > > Now, I am aware of the SerializationBinder class and how it can be used to > > get around this problem however that only works when you are dealing with > > the > > formatters yourself and have the ability to set the binder class. In my > > case, I have an object that needs to go on the Clipboard. > > The problem is that it isn't being handled correctly. How do I deal with > > this case? > > > > Thanks. > > > This didn't work. In fact it never fired. However, I know the problem has
something to do with it being in the dynamically loaded assembly because when I move the definition out into the main executable it works appropriately. Any other suggestions? Show quote "Pete" wrote: > I could be completely off-base here, because I've never had to do this for > serialization, but you might want to look into creating an > AppDomain.TypeResolve event handler to resolve the type. > > I've never used TypeResolve, but I have used ResourceResolve and > AssemblyResolve and it sounds like it might fit the bill for you. > > Pete > > "Oldman" <Old***@discussions.microsoft.com> wrote in message > news:9602458A-376C-4A06-BB3B-58661D863A38@microsoft.com... > >I have a type that is serializable that is located in an assembly that is > > loaded dynamically from a special directory. When deserializing this > > object > > the framework fails to find the type. > > > > Now, I am aware of the SerializationBinder class and how it can be used to > > get around this problem however that only works when you are dealing with > > the > > formatters yourself and have the ability to set the binder class. In my > > case, I have an object that needs to go on the Clipboard. > > The problem is that it isn't being handled correctly. How do I deal with > > this case? > > > > Thanks. > > > |
|||||||||||||||||||||||