What is a canonical way to produce a segmentation fault in C#?
问题 I am interested in the shortest, neatest piece of C# code around that will reliably produce a segfault - ideally without directly calling any unmanaged code. 回答1: What you're after is somewhat unclear but I suppose this is as good as any answer so far, and it is about as minimal as you can get. System.Runtime.InteropServices.Marshal.ReadInt32(IntPtr.Zero); 回答2: Michael's answer wasn't working for me, perhaps that case is caught now. Marshal.ReadInt32() just gives me a "SystemError: Attempted