属性的代码生成失败...错误是:在程序集中'输入xxx'...未标记为可序列化 [英] Code generation for property failed ... Error was: 'type xxx' in assembly ...not marked as serializable

查看:115
本文介绍了属性的代码生成失败...错误是:在程序集中'输入xxx'...未标记为可序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


请升级VB.Net项目(使用VS 2017 Community Edition)。它是一个类/控件库。多年来一直运作良好。每当我向任何UI容器(客户控制或winform)添加按钮时,IDE都会突然出现错误:



===== ========



物业'PVSchedule'的代码生成失败。错误是:在程序集'PlinyECtrls2014中输入'PlinyECtrls2014.Types.PVSchedule',版本= 1.0.0.0,Culture = nuetral,PublicKeyToken = null'未标记为可序列化。'



==============



我不明白序列化的含义。我只修改了一些控件以扩展应用程序。但是一旦我对任何UI Winform或用户控件进行任何更改 - 并尝试保存UI,弹出上面的错误并且不会保存更改。





类PVSchedule有一个属性Say P1 AS List(C1)



然后另一个类,比如C2有一个属性P2 AS List (PVSchedule)



请帮助我指明如何解决这个错误,以便我可以继续修改UI元素。



非常感谢



Victor I.



什么我试过了:



我标记了它引用的所有条款< serializable>例如




Please I am upgrading a VB.Net project (with VS 2017 Community Edition). It is a class/control library. It is also been working fine for years. All of a sudden whenever I add a button to any of the UI containers (custome control or winform) the IDE will break with the error:

=============

Code Generation for property 'PVSchedule' failed. Error was: 'Type 'PlinyECtrls2014.Types.PVSchedule' in Assembly 'PlinyECtrls2014, version=1.0.0.0, Culture=nuetral, PublicKeyToken=null'is not marked as Serializable.'

==============

I do not understand what Serialization is about. Am only modifying some of my controls to extend the application. But once I make any change to any UI Winform or user control - and try to save the UI, the error above pops up and the changes will not be saved.


The class PVSchedule has a property Say P1 AS List(of C1)

Then another class, say C2 has a property P2 AS List (of PVSchedule)

Please assist me with direction on how to get by this error so that I can continue with modifying the UI elements.

Many thanks

Victor I.

What I have tried:

I marked all the claases it refers to <serializable> e.g


<Serializable>
    Public Class PVschedule...





我还将课程标记为:







I also marked the classes as in:


<Browsable(False)>
    <EditorBrowsable(EditorBrowsableState.Never)>
    Public Class PVSchedule

推荐答案

您很可能已向控件添加了公共属性。如果是这种情况,设计师将在保存窗口时尝试序列化所有公共属性。



如果您不希望序列化属性的值,添加 DesignerSerializationVisibilityAttribute类(System.ComponentModel) [ ^ ]到属性并指定它被隐藏。
Most likely you have added public properties to your control. If that is the case, the designer will try to serialize all public properties upon saving the window.

If you don't want the value of the property to be serialized, add DesignerSerializationVisibilityAttribute Class (System.ComponentModel)[^] to the property and specify that it is hidden.


这篇关于属性的代码生成失败...错误是:在程序集中'输入xxx'...未标记为可序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆