Fix missing filename in error messages when writing out C# files

Closes #882
1 file changed