R
roynevo
Hi,
I'm trying to deserialize an object on the context of a remoting call
(RPC).
The deserialization seem to work fine, however when I'm casting the
result to the relevant class I get an InvalidCastException.
Note:
* the remoting server has TypeFilterLevel to Full to remove security
restrictions.
* the casting has no problem when done in the immediate window, or in
another application without remoting involved.
* The serializing and deserializing DLL's are the same and from the
same build.
void func() // called by Remoting
{
Stream myStream = File.OpenRead(shortFileName +
"_env_stream.bin");
object obj = bf.Deserialize(myStream); // bf is of
type BinaryFormatter
myClass = (MyNameSpace.MyClass)obj; // ERROR - InvalidCastException
Assembly a =
System.Reflection.Assembly.GetAssembly(myClass.GetType());
Assembly b =
System.Reflection.Assembly.GetAssembly(obj.GetType());
bool isSameAssembly = a.Equals(b); // this is False
when func is called in Remoting
}
I'm trying to deserialize an object on the context of a remoting call
(RPC).
The deserialization seem to work fine, however when I'm casting the
result to the relevant class I get an InvalidCastException.
Note:
* the remoting server has TypeFilterLevel to Full to remove security
restrictions.
* the casting has no problem when done in the immediate window, or in
another application without remoting involved.
* The serializing and deserializing DLL's are the same and from the
same build.
void func() // called by Remoting
{
Stream myStream = File.OpenRead(shortFileName +
"_env_stream.bin");
object obj = bf.Deserialize(myStream); // bf is of
type BinaryFormatter
myClass = (MyNameSpace.MyClass)obj; // ERROR - InvalidCastException
Assembly a =
System.Reflection.Assembly.GetAssembly(myClass.GetType());
Assembly b =
System.Reflection.Assembly.GetAssembly(obj.GetType());
bool isSameAssembly = a.Equals(b); // this is False
when func is called in Remoting
}