From 405f3ba92b62fa16ac4bcf39e4f8380595ca972e Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Sun, 17 Feb 2019 18:50:44 +0000 Subject: [PATCH] Only generate `unsafe` and `IDisposable` for bindings generation. --- src/Generator/Generators/CSharp/CSharpSources.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index ce7e509a..d65f3108 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -677,7 +677,10 @@ namespace CppSharp.Generators.CSharp var keywords = new List(); keywords.Add(@class.Access == AccessSpecifier.Protected ? "protected internal" : "public"); - keywords.Add("unsafe"); + + var isBindingGen = this.GetType() == typeof(CSharpSources); + if (isBindingGen) + keywords.Add("unsafe"); if (@class.IsAbstract) keywords.Add("abstract"); @@ -712,7 +715,7 @@ namespace CppSharp.Generators.CSharp } } - if (@class.IsGenerated) + if (@class.IsGenerated && isBindingGen) { if (@class.IsRefType && !@class.IsOpaque) bases.Add("IDisposable");