加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp.net – 调试:当类型IS标记为可序列化时,如何调试“类型未标

发布时间:2020-12-16 06:53:12 所属栏目:asp.Net 来源:网络整理
导读:我试着: ((Request.Params["crmid"] != null)) 在网页中.但它不断抛出序列化异常: Type ‘QC.Security.SL.SiteUser’ in assembly ‘QC.Security, Version=1.0.0.1,Culture=neutral, PublicKeyToken=null’ is not marked as serializable. 然而,类型(自定
我试着:

((Request.Params["crmid"] != null))

在网页中.但它不断抛出序列化异常:

Type ‘QC.Security.SL.SiteUser’ in
assembly ‘QC.Security,
Version=1.0.0.1,Culture=neutral,
PublicKeyToken=null’ is not marked as
serializable.

然而,类型(自定义IIdentity)标记为可序列化如下:

[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; } }

我不知道如何调试这个,因为我无法进入序列化器代码,以找出它为什么会摔倒.调用堆栈在到达[外部代码]之前只有一帧深度.并且错误消息是无用的,因为类型明确标记为可序列化.试验和错误调整也产生了一个类型未解决的成员异常.

它工作正常.但现在“突然间”它并不通常意味着Visual Studio中的一些愚蠢的错误,但重启并没有帮助“这个”时间.所以现在我不知道这是一个愚蠢的VS错误还是一个完全不相关的错误,我得到了序列化异常或者我做错了什么.

事实上,我不再相信VS了,因为过去几个月我一直在进行的疯狂追逐数量,这是通过重新启动VS 2008或其他一些荒谬的解决办法来“修复”的.

解决方法

哦,所以我已经解决了这个问题.这是另一个VS /卡西尼问题.根据 this url和 this url,解决方法是使SiteUser继承MarshalByRefObject.

这是必要的,因为:

The issue is that cassini will break
into separate AppDomains at will,
which doesn’t happen in IIS (even
though they say it CAN).
Because of
this,when Atlas is trying to convert
to the JSON to something on the
server,it does something and switches
and the .User custom principal doesn’t
deserialize because the assembly is
not in the GAC and not registered with
the other AppDomain.

“开发人员开发人员咳嗽”

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读