Fix C# code generation errors