In C# .net 3.5 64 bit platform remoting service.
This was one of those frustrating issues which takes forever to figure out what’s happening.
I have a distributed application where the web tier accesses the middle tier on a remoting service. One of the middle tier methods accepts a struct parameter. This method, when invoked from web tier on a 32 bit platform worked fine, but on 64 bit platform it threw the exception “Attempted to read or write protected memory. This is often an indication that other memory is corrupt.”
Looks like the Struct being a value type was getting messed up when passed across process boundaries through remoting. I think what was happening was the remoting service was trying to access the asp.net’s copy of struct instance. I changed the data type from struct to class and its now working fine now