• .NET程序报错:is not marked as serializable
  • 发布于 2个月前
  • 118 热度
    2 评论
  • 羊肉串
  • 2 粉丝 2 篇博客
  •   

我的一个.NET程序报错了,哪位大哥帮我看一下是什么问题,该如何解决,报错信息如下:


Type 'LGInternalApplication.Model.WF00031_SAPData' in Assembly 'LGInternalApplication.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.Serialization.SerializationException: Type 'LGInternalApplication.Model.WF00031_SAPData' in Assembly 'LGInternalApplication.Model, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


用户评论
  • 钟子龙
  • 出现这个问题应该是你有用ViewState存储WF00031_SAPData这个对象信息,你去你的Linq to sql的.dmbl文件里找到WF00031_SAPData这个表对象,在前面加上[Serializable]关键字应该就可以了,类似这样子:

    [Serializable]
    	[global::System.Data.Linq.Mapping.TableAttribute(Name="dbo.WF00031_SAPData")]
    	public partial class WF00031_SAPData : INotifyPropertyChanging, INotifyPropertyChanged
    	{
              //这边应该是系统自动生成的你的表的字段信息...
            }

  • 2018/6/20 14:25:00 [ 0 ] [ 0 ] 回复