From e11314143a264af8a01617836679a147ff339a05 Mon Sep 17 00:00:00 2001 From: Joao Matos Date: Mon, 6 Feb 2017 12:28:12 +0000 Subject: [PATCH] Global qualify ConcurrentDictionary references in generated code. Fixes issue #747. --- src/Generator/Generators/CSharp/CSharpSources.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Generator/Generators/CSharp/CSharpSources.cs b/src/Generator/Generators/CSharp/CSharpSources.cs index 070c73ec..0225ecd7 100644 --- a/src/Generator/Generators/CSharp/CSharpSources.cs +++ b/src/Generator/Generators/CSharp/CSharpSources.cs @@ -501,9 +501,9 @@ namespace CppSharp.Generators.CSharp // use interfaces if any - derived types with a secondary base this class must be compatible with the map var @interface = @class.Namespace.Classes.Find(c => c.OriginalClass == @class); - WriteLine( - "internal static readonly System.Collections.Concurrent.ConcurrentDictionary NativeToManagedMap = new System.Collections.Concurrent.ConcurrentDictionary();", + var dict = string.Format("global::System.Collections.Concurrent.ConcurrentDictionary", @interface != null ? @interface.Name : @class.Name); + WriteLine("internal static readonly {0} NativeToManagedMap = new {0}();", dict); WriteLine("protected void*[] __OriginalVTables;"); } PopBlock(NewLineKind.BeforeNextBlock);