Dump files not being produced

I am trying to get automatic dumps from windows after setting the
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Windows Error
Reporting\LocalDumps registry key. Setting this key make windows
generate a dump file every time something crashes and store it in a
specified folder.

I created a simple crashing exe in visual studio to test this, the code

static void Main(string[] args){
int j = crash();

static unsafe int crash(){
((int)0) = 0;
return 0;

This works fine and a dump file is created when i run it on its own and
it crashes.

The trouble I’m having is that when I run this program through ruby
using system(‘crashingfile.exe’) the program crashes and the error is
reported by ruby but no dump file is created. The error that ruby
reports is;

Unhandled Exception: System.NullReferenceException: Object reference not
set to an instance of an object.
at crashingfile.Program.crash()
at crashingfile.Program.Main(String[] args)

It seems like ruby is swallowing the error. Can anyone provide an
explanation and a workaround to this (so that the program DOES crash and
windows handles it and creates the dump file)?