Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make C# application crash

Tags:

c#

crash

unity3d

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.

Thanks!

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

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!

like image 234
fieldChao Avatar asked Aug 01 '13 14:08

fieldChao


2 Answers

Another option is to call

System.Environment.FailFast("Error happened")
like image 68
max630 Avatar answered Sep 27 '22 15:09

max630


StackOverflowException is a badass:

void PerformOverflow()
{
  PerformOverflow();
}

Usage:

PerformOverflow();
like image 40
Ondrej Svejdar Avatar answered Sep 27 '22 17:09

Ondrej Svejdar