How to Debug an exception: Type is not marked as serializable... when the type is marked as serializ
- by rism
I'm trying to:
((Request.Params["crmid"] != null))
in a web page. But it keeps throwing a serialzation exception:
Type 'QC.Security.SL.SiteUser' in
assembly 'QC.Security,
Version=1.0.0.1, Culture=neutral,
PublicKeyToken=null' is not marked as
serializable.
The type is however marked as serializable as follows:
[Serializable()]
public class SiteUser : IIdentity
{
private long _userId;
public long UserId { get { return _userId; } set { _userId = value; } }
private string _name;
public string Name { get { return _name; } }
private bool _isAuthenticated;
public bool IsAuthenticated { get { return _isAuthenticated; } }
private string _authenticationType;
public string AuthenticationType { get { return _authenticationType; } }
I've no idea how to debug this as I cant step into the serializer code to find out why its falling over. The call stack is only one frame deep before it hits [External Code]. And the error message is next to useless given that type is clearly marked as serializable.
It was working fine. But now "all of a sudden" it doesn't which typically means some dumb bug in Visual Studio but rebooting doesn't help "this" time. So now I dont know if it's a stupid VS bug or a completely unrelated error for which Im getting a serialization exception or something I'm doing wrong.
The truth is I just dont trust VS anymore given the number of wild goose chases Ive been on over the last several months which were "fixed" by rebooting VS 2008 or some other rediculous workaround.