如何使 C# 应用程序崩溃 [英] How to make C# application crash

查看:54
本文介绍了如何使 C# 应用程序崩溃的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想测试我的应用程序崩溃转储是否可以调试.但首先,我需要生成我的应用程序的故障转储.我正在使用 C# 来编写我的应用程序,并尝试了许多异常和不安全代码等,但没有得到它.

I want to test if my application crash dump can be debugged. But firstly, I need to generate a crash dump of my application. I'm using C# to code my app, and have tried with many exceptions and unsafe code etc. but don't get it.

谢谢!

抱歉,忘记了一些东西,我正在使用 Unity3D 制作应用程序,它会自动为我处理异常.

Sorry, Just forgot something, I'm making the application with Unity3D, which handles exceptions for me automatically.

编辑 2:感谢大家的回答.我已经在标准 C# 应用程序中测试了您的建议,一切正常,但在我的 Unity3D 应用程序(用 C# 编写)中却没有.似乎 Unity3D 需要更多的努力才能导致崩溃,我可能会通过电子邮件向 Unity3D 寻求答案.如果我得到它,我会在这里发布.干杯!

Edit 2: Thanks all for your answers. I've tested your suggestions in a standard C# application and it all works fine, but not in my Unity3D application (written with C#). It seems like Unity3D requires more effort to cause a crash, I might email Unity3D to get a answer. I will post here if I get it. Cheers!

推荐答案

以下将提供一个未处理的异常并要求您选择调试器:

The following will provide an unhandled exception and will ask for you to choose a debugger:

System.Diagnostics.Debugger.Launch()

这篇关于如何使 C# 应用程序崩溃的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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