[Mono-list] Security exception on MS.NET with remoting example from Mono Handbook

Kamil Skalski nazgul@nemerle.org
Tue, 19 Apr 2005 18:20:05 +0200


Hi!

I'm getting an ugly exception when trying out code from
http://monohandbook.monoforge.com/monkeyguide/remoting/introduction.html

on MS.NET 1.1

$ ./client.exe
Getting instance ...
Creating two remote items...

Creating two client items...
ServerObject Created at client 1: setting 333
ServerObject Created at client 2: setting 444

Adding items...

Wyjtek nieobsuony: System.Runtime.Serialization.SerializationException: Z=20
powodu ogranicze=EF=BF=BDzabezpieczajcych nie mona uzyska dostpu do typu=20
System.Runtime.Remoting.ObjRef. ---> System.Security.SecurityException: dan=
ie=20
nie powiodo si.
   at=20
System.Security.SecurityRuntime.FrameDescSetHelper(FrameSecurityDescriptor=
=20
secDesc, PermissionSet demandSet, PermissionSet& alteredDemandSet)
   at=20
System.Runtime.Serialization.FormatterServices.nativeGetSafeUninitializedOb=
ject(RuntimeType=20
type)
   at=20
System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(T=
ype=20
type)
   --- Koniec ladu stosu wyjtkw wewntrznych ---

Server stack trace:
   at=20
System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(T=
ype=20
type)
   at=20
System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(Par=
seRecord=20
pr)
   at=20
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseReco=
rd=20
pr)
   at=20
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWit=
hMapTyped(BinaryObjectWithMapTyped=20
record)
   at=20
System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWit=
hMapTyped(BinaryHeaderEnum=20
binaryHeaderEnum)
   at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
   at=20
System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(Hea=
derHandler=20
handler, __BinaryParser serParser, Boolean fCheck, IMethodCallMessage=20
methodCallMessage)
   at=20
System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(=
Stream=20
serializationStream, HeaderHandler handler, Boolean fCheck,=20
IMethodCallMessage methodCallMessage)
   at=20
System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessag=
e(String=20
objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel=20
securityLevel)
   at=20
System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(I=
ServerChannelSinkStack=20
sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream=20
requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders,=20
Stream& responseStream)

Exception rethrown at [0]:
   at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessag=
e=20
reqMsg, IMessage retMsg)
   at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&=
=20
msgData, Int32 type)
   at RemotingTest.ServerList.Add(ServerObject v)
   at RemotingTest.RemotingClient.Main()
Unknown signal 79


On mono it works and that is no problem at all. But as it fails on MS.NET, =
the=20
code probably should be corrected, so people won't learn incompatible usage=
=20
of remoting.

Also I would like to know what is wrong with that code.

=2D--
Kamil Skalski
http://nazgul.omega.pl