用户控件始终会崩溃Visual Studio [英] User control always crashes Visual Studio
问题描述
我试图在我们的一个项目中打开一个用户控件。它是在VS 2003创建的,我相信,项目已经转换为VS2008。我可以查看代码很好,但是当我尝试加载设计器视图时,VS停止响应,我不得不关闭它与任务管理器。我试过让它运行几分钟,但它不做任何事情。我跑了devenv / log,但没有看到日志中有什么不寻常的。我在任何地方找不到特定的错误消息。任何想法可能是什么问题?是否有一个轻量级的编辑模式我可能能够使用或什么?
I'm trying to open a user control in one of our projects. It was created, I believe, in VS 2003, and the project has been converted to VS2008. I can view the code fine, but when I try to load the designer view, VS stops responding and I have to close it with the task manager. I have tried leaving it running for several minutes, but it does not do anything. I ran "devenv /log" but didn't see anything unusual in the log. I can't find a specific error message anywhere. Any idea what the problem might be? Is there a lightweight editing mode I might be able to use or something?
我需要看看这个控件的可视化表示的原因是决定在哪里插入一些新的组件。
The reason I need to have a look at the visual representation of this control is to decide where to insert some new components.
我已经尝试搜索它,搜索SO,但是我不知道要搜索什么或没有关于这一点。任何帮助是赞赏。
I've tried googling it and searching SO, but either I don't know what to search or there is nothing out there about this. Any help is appreciated.
(最奇怪的是,用户控件似乎加载精细在另一个项目中引用,但VS崩溃, )
(The strangest thing is that the user control seems to load fine in another project which references, but VS crashes as soon as I even so much as click on it in that project.)
EDIT
用户控件是一个第三方HTML编辑器的包装器...所以不是访问数据库的东西。
The user control is a wrapper of a 3rd party HTML editor...so not exactly something which accesses a database.
我只是试图把控件放在一个新的项目,它崩溃了
I just tried putting the control on a new project and it crashed as soon as I dragged it onto the form.
推荐答案
我使用这里描述的技术解决了我的崩溃设计器:
I solved my crashing designer using techniques described here:
我已经能够通过运行VS的第二个实例来调试一些控制设计器问题,然后从你的第一个VS实例执行调试 - >附加到进程并选择devenv。
I've been able to debug some control designer issues by running a second instance of VS, then from your first VS instance do a "Debug -> Attach to Process" and pick "devenv".
AND
似乎UserControl的Load()方法不知何故被设计器解析。将初始化和其他可疑代码放置在if循环中 - 检查 IsDesignMode 会阻止设计人员读取会导致崩溃的代码....
It seems that the Load() method of UserControls somehow gets parsed by the designer. Putting initialisations and other suspicious code in a if - loop - checking for IsDesignMode keeps the designer from reading code that will crash it ....
- 更新:回顾现在,所有大多数事情解决了当我overthought /重构应用程序设计。
--update: looking back now, all most things solved when I overthought / refactored the application design.
这篇关于用户控件始终会崩溃Visual Studio的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!