WindowsForm设计器错误 [英] WindowsForm designer errors

查看:76
本文介绍了WindowsForm设计器错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有一个部门广泛的Windows补丁更新。今天,我一直在设计师错误,设计师无法显示此文件,因为其中的任何类都无法设计。设计人员检查了文件中的以下类。无法加载Base。确保程序集已被引用并且已经构建了所有项目。



这种情况​​发生在几个WindowsForms类中,之前它编译得很好而没有这些错误/警告。 Windows补丁更新是否会干扰Windows应用程序项目?我已经清理,重建,删除和重新读取,检查我的dll引用是否正常。我使用VS2012,c#windows窗体。关于是什么原因的任何建议?

We had a dept wide Windows patch update. Today, I have been getting designer errors, "The designer could not be show for this file because none of the classes within it can be designed. The designer inspected the following classes in the file. The Base could not be loaded. Ensure the assembly has been referenced and that all projects have been built."

This is occurring in several WindowsForms classes where before, it compiled fine without these errors/warnings. Would a windows patch update interfere with a windows app project? I have cleaned, rebuilt, deleted and readded, check my dll references are ok. I use VS2012, c# windows form. Any suggestion as to what causes it?

推荐答案

很难。我猜猜发生了什么。 1)项目仍然编译,只是尝试一下。 2)在Windows补丁之前,设计器视图已经没有显示;你只是没注意那个。 3)你没有注意到这一点,因为在此视图未打开之前。是的,您没有更改代码,但您更改了.suo文件,IDE的当前状态。



因此,首先,关闭设计器视图,忽略这个问题。尝试编译它。机会是,它将编译甚至可能工作。如果它没有编译,我们没有足够的信息来解决你的问题。



现在,如何解决这个问题?



首先,停止做你正在做的事情并开始进行软件开发。你会说,你怎么样,我们在做什么呢?软件开发!我不太确定。我怀疑你只是浪费你的时间,或者更准确地说,冒着你所有的开发时间。要开始软件开发,您需要1)开始使用一些版本控制系统,2)实现所有软件的单击批量构建。如果我的假设是错误的并且这一切都已实施,请原谅我并转到下一个项目。如果我是写的,立即行动。否则,您的宝贵代码断言不属于您,但它们属于第一手牌或硬件崩溃。你需要能够在所有情况下回溯你的步骤。



现在,修复表格。在你进行Windows补丁更新之前,我建议假设它在开发期间被破坏(通常是间接发生)(现在你可以观察到通常巧合的结果,就像之前的许多人一样)。这是可能发生的事情。表单的许多方面(WPF窗口或使用设计器和/或XAML开发的其他单元)在应用程序运行时期间工作正常但在设计器运行时期间失败。这只是一个简单的事实,即您实现的不同方法在不同的顺序和不同的环境中被调用。您的表单方法可能会调用其他文件中的某些方法,或者您修改了这些方法而没有显示设计视图一段时间。



请尝试以下操作:附上尽可能多的代码您可以在检查中使用表单方法:
Hardly. I can guess what happened. 1) The project still compiles, just try it. 2) Before Windows patch, the designer view already wasn't displayed; you just did not pay attention for that. 3) You did not pay attention for that because before this view was not opened. Yes, you did not change the code, but you changed the .suo file, current state of the IDE.

So, to start with, close the designer view and ignore the problem. Try to compile it. Chances are, it will compile and may even work. If it does not compile, we have not enough information to solve you problem.

Now, how to solve the problem?

First, stop doing what you are doing and start doing software development. You will say, "How, what else do you thing we are doing? Software development!" I would not be so sure. I suspect that you are just wasting your time, or, more exactly, risking all your development time. To start software development, you need 1) start using some Revision Control System, 2) implement single-click batch build of all the software. If was was wrong in my assumption and this is all implemented, please forgive me and go to the next item. If I was write, do it immediately. Otherwise, your valuable code asserts are not yours, but they belong to the first slip of a hand or a hardware crash. You need to be able to retrace your steps in all situations.

Now, fix the form. I suggest to assume it was broken (it usually happens indirectly) during development well before you had the Windows patch update (and now you observe the result of usual coincidence, as many people before). Here is what could have happened. There are many aspects of the form (WPF window or other unit developed with the use of designer and/or XAML) which work fine during your application runtime but fail during designer's runtime. This is just the simple fact that different methods you implemented are called in different order and different environment. Your form methods may call some methods from other files, or you modified those methods without showing the design view for a while.

Try the following: enclose as much code of the form methods as you can in the check:
if (!DesignMode) { /* ... */ }

换句话说,保留现有功能,但只在不在设计师。您可以在此技巧之后加载设计视图。如果它无法帮助,请以通常的方式继续调试。在进一步开发中,尽量保留所有可疑的代码,这些代码可能会从表单和设计模式中失败。尝试将UI与编程的所有其他方面隔离开来。这是MVC,MVA,MVP或MVVM的主要动机之一。



是的,我明白我的假设太多了。但是您没有提供信息来查找更具体的行动原因。根据我的经验,像你这样的大多数问题围绕我试图描述的活动进行。



-SA

In other words, keep existing functionality, but only execute most code when you are not in the designer. It's very likely that you can load your design view after this "trick". If it cannot help, continue debugging in a usual way. In further development, try to keep all questionable code which may potentially fail away from the form and design mode. Try to isolate UI from all other aspects of programming. This was one of the primary motivation items for MVC, MVA, MVP or MVVM.

Yes, I understand that I assume too much. But you did not provide information to find more specific cause of action. In my experience, most problems like yours circulated around the activities I tried to describe.

—SA


我可以尊重讲道,错误和所有,但我继承了承包商创建的一些未完成的代码。那家伙离开了,我接手了。故事结局。我希望这能满足你的冒昧方式。我使用TFS源代码控制,我可以搁置我的挂起更改,但检索3个损坏文件的更改集。我可能无意中造成了,但现在错误消失了。我只假设补丁更新是由于它在我们的部门广泛更新中创建的其他问题而导致的。我的不好。



修复错误和调试对我来说并不浪费时间。尽管我很感激你的讲道,但这不是我来到这个网站的原因。我已经得到了其他代码的帮助,我尊重那些提供解决方案的人,而不是像他们责骂孩子一样!谢谢。
I can respect the preaching, errors and all, but I have inherited some unfinished code created by a contractor. The guy left, I took over. End of story. I hope that fulfills your presumptuous manner. I use TFS source control where I was able to shelve my pending changes, yet retrieve a changeset for the 3 corrupt files. In which I may have unintentionally caused, but the errors are gone now. I only assumed that a patch update would be a cause due to other issues it created in our dept wide updates. My bad.

Fixing errors and debugging is not a waste of time to me. As much as I appreciate your preaching, this is not what I come to this site for. I have had help with other code which I respect those who provide solutions and not blather on like they are scolding a child!!! Thank you.


这篇关于WindowsForm设计器错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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