本文介绍了奇怪的VS错误-窗口自动打开的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有2个窗口的WPF应用程序.我开始遇到这个奇怪的错误...在我打开VS之后的第一次,双击Window.XML会在加载设计器后立即运行该窗口. VS打开后只会发生一次,并且 仅在此窗口中.

I have a WPF application with 2 windows. I started having this weird bug...the first time after I open VS, double clicking on the Window.XML will actually run the window right after loading the designer. This would happen only once after VS is opened and only with this window.

另外,当我在没有调试的情况下运行(Ctrl + F5)时,我的起始窗口和第二个窗口都将打开(也是第一次).如果我调试,这不会发生.我试图从我的代码中删除打开此窗口的行,但它仍然会发生.我删除了 窗口,它仍然会发生!

Also, when I run without debug (Ctrl+F5), both my starting window and the second open (also, only for the first time). If i debug, this would not happen. I tried removing from my code the line that opens this window, and it still happens. I DELETED the window and it still happens!

这就像XML中的某些内容告诉它打开...

It's like something in the XML tells it to open...

有什么想法吗?

推荐答案

要么您破坏了项目/Visual Studio,要么其中有一些正在打开并显示该窗口的代码.

Either you've broken your project / visual studio or you have some code in there which is opening and showing that window.

如果您启动一个新的解决方案并打开mainwindow.xaml,它是否可以按预期工作?

If you start a new solution and open mainwindow.xaml then does it work as expected?

如果可以的话,如果没有太多代码,则将代码移植到新的解决方案中.

If it is fine then port your code to a new solution if there isn't much code.

如果它启动了主窗口,那么该是卸载并重新安装Visual Studio的时候了.

If it starts up mainwindow then it's time to uninstall and re-install visual studio.


这篇关于奇怪的VS错误-窗口自动打开的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-18 17:49