用户控件总是使 Visual Studio 崩溃 [英] User control always crashes Visual Studio

查看:21
本文介绍了用户控件总是使 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.)

编辑

用户控件是第 3 方 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:

调试 Visual Studio Designer 错误的好方法

我已经能够通过运行 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".

似乎 UserControls 的 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 ....

--update:现在回想起来,当我过度考虑/重构应用程序设计时,所有的事情都解决了.

--update: looking back now, all most things solved when I overthought / refactored the application design.

这篇关于用户控件总是使 Visual Studio 崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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