My app tries to deserialize data sent by client and it fails with the following error:
Exception thrown: 'System.Runtime.Serialization.SerializationException' in mscorlib.dll
Additional information: Cannot get the member '<.ctor>b__0'.
googling gives no results. Okay, I decided I would step into deserialization logic and try to figure out what exactly is causing this. Well, a day has passed and I'm nowhere close.
I used instructions from Microsoft Reference Source website to configure Visual Studio. It does download something
MicrosoftPublicSymbols\mscorlib.pdb\
DCF1E4D31F6944AC87E7A634262BEE881\mscorlib.pdb (780kb)
E47257B512BA49BC9FC367C532FC5F1E2\mscorlib.pdb (953kb)
but debugger does not step in.
I googled more and found another way to do it - installed dotTrace app and used it as source server. And that does not help either. I still see the following:
Symbol Load Information
popup for mscorlib.pdb says
C:\Users\me\AppData\Local\Temp\SymbolCache\MicrosoftPublicSymbols\mscorlib.pdb\e47257b512ba49bc9fc367c532fc5f1e2\mscorlib.pdb: Symbols loaded.
I can step in into System.Windows.Forms, System.Linq, etc - so generally speaking, it works - it just this particular call to BinaryFormatter.Deserialize()
does not work. What could be the reasons for that and how can I get it to step into?
Could it be because of SecuritySafeCritical
attribute?
[System.Security.SecuritySafeCritical]
public Object Deserialize(Stream serializationStream)
I'm using VS 2015 .Net 4.5.2 (though I tried 4.5 with the same results).
BinaryFormatter
should never be used for persistent storage or cross machine communication for exactly the reason you are running in to problems. It is very change intolerant and if the two sides are not running the exact same versions of all the assemblies involved in the object graph you run in to problems like this. – Klystron