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

查看:472
本文介绍了如何使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.

谢谢您的回答.我已经在标准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天全站免登陆