[mapguide-commits] r9762 - in sandbox/jng/vanilla_swig/Bindings/src: Bindings Bindings/Common/DotNet Bindings/DotNet Bindings/DotNet/Foundation Managed/DotNet Managed/DotNet/Common Managed/DotNet/MapGuideDotNetApi/custom Managed/DotNet/OSGeo.MapGuide.Foundation Managed/DotNet/OSGeo.MapGuide.Foundation/custom Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64 Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native Managed/Java/org/osgeo/mapguide

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Tue Nov 10 02:20:15 PST 2020


Author: jng
Date: 2020-11-10 02:20:15 -0800 (Tue, 10 Nov 2020)
New Revision: 9762

Added:
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApi.rc
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApi.vcxproj
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApiGen.xml
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationConstants.xml
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/InitializeLibrary.i
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/dotnetcore_split.i
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/MgClassMap.cs
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/OSGeo.MapGuide.Foundation.csproj
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/ManagedException.cs
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/MgStringCollection.cs
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/Streams.cs
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native/
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native/README.txt
Removed:
   sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/custom/MgObjectFactory.cs
Modified:
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/Bindings.sln
   sandbox/jng/vanilla_swig/Bindings/src/Bindings/Common/DotNet/coreclr_compat.i
   sandbox/jng/vanilla_swig/Bindings/src/Managed/Java/org/osgeo/mapguide/
Log:
First step in attempting to split up the .net binding. Add MgFoundation glue and .net wrapper.

Also remove the MgObjectFactory as it is now auto-generated as part of the main PINVOKE module.

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/Bindings.sln
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/Bindings.sln	2020-11-10 10:05:25 UTC (rev 9761)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/Bindings.sln	2020-11-10 10:20:15 UTC (rev 9762)
@@ -35,6 +35,12 @@
 		{FDC09E9D-72BB-4C74-B88B-727D9D1D6C4E} = {FDC09E9D-72BB-4C74-B88B-727D9D1D6C4E}
 	EndProjectSection
 EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "monolith", "monolith", "{59509894-F4A9-4C44-8B39-8B5115384DD0}"
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "FoundationApi", "DotNet\Foundation\FoundationApi.vcxproj", "{73C62FF2-C188-4A61-929E-2F112D7E17AA}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "OSGeo.MapGuide.Foundation", "..\Managed\DotNet\OSGeo.MapGuide.Foundation\OSGeo.MapGuide.Foundation.csproj", "{120AC2A9-5EBE-4512-9FF7-54EA04192196}"
+EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Any CPU = Debug|Any CPU
@@ -77,16 +83,33 @@
 		{4A3F2DA2-F53F-48EE-9505-8285F3E089D4}.Release|Any CPU.Build.0 = Release|Any CPU
 		{4A3F2DA2-F53F-48EE-9505-8285F3E089D4}.Release|x64.ActiveCfg = Release|Any CPU
 		{4A3F2DA2-F53F-48EE-9505-8285F3E089D4}.Release|x64.Build.0 = Release|Any CPU
+		{73C62FF2-C188-4A61-929E-2F112D7E17AA}.Debug|Any CPU.ActiveCfg = Debug|x64
+		{73C62FF2-C188-4A61-929E-2F112D7E17AA}.Debug|x64.ActiveCfg = Debug|x64
+		{73C62FF2-C188-4A61-929E-2F112D7E17AA}.Debug|x64.Build.0 = Debug|x64
+		{73C62FF2-C188-4A61-929E-2F112D7E17AA}.Release|Any CPU.ActiveCfg = Release|x64
+		{73C62FF2-C188-4A61-929E-2F112D7E17AA}.Release|x64.ActiveCfg = Release|x64
+		{73C62FF2-C188-4A61-929E-2F112D7E17AA}.Release|x64.Build.0 = Release|x64
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196}.Debug|x64.ActiveCfg = Debug|Any CPU
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196}.Debug|x64.Build.0 = Debug|Any CPU
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196}.Release|Any CPU.Build.0 = Release|Any CPU
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196}.Release|x64.ActiveCfg = Release|Any CPU
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196}.Release|x64.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
-		{FDC09E9D-72BB-4C74-B88B-727D9D1D6C4E} = {A9257857-9844-4CEA-AF02-A7D8AB8F46AB}
+		{FDC09E9D-72BB-4C74-B88B-727D9D1D6C4E} = {59509894-F4A9-4C44-8B39-8B5115384DD0}
 		{B601F04C-0D42-4AFC-A092-B31185E2EA8C} = {99132700-5CAD-4540-9939-7502C1A448EA}
 		{696D2664-D17F-4357-8A19-2B5DC4B29962} = {323AEA7C-774B-49D8-8D34-7A766288C549}
 		{C02F44CB-D916-428D-A1A5-04E225A2A4EC} = {664329B8-67BD-4D38-AE4B-A2920B038C09}
-		{4A3F2DA2-F53F-48EE-9505-8285F3E089D4} = {A9257857-9844-4CEA-AF02-A7D8AB8F46AB}
+		{4A3F2DA2-F53F-48EE-9505-8285F3E089D4} = {59509894-F4A9-4C44-8B39-8B5115384DD0}
+		{59509894-F4A9-4C44-8B39-8B5115384DD0} = {A9257857-9844-4CEA-AF02-A7D8AB8F46AB}
+		{73C62FF2-C188-4A61-929E-2F112D7E17AA} = {A9257857-9844-4CEA-AF02-A7D8AB8F46AB}
+		{120AC2A9-5EBE-4512-9FF7-54EA04192196} = {A9257857-9844-4CEA-AF02-A7D8AB8F46AB}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {733BCCC2-0431-4AB7-ABB6-AAE81AB54C48}

Modified: sandbox/jng/vanilla_swig/Bindings/src/Bindings/Common/DotNet/coreclr_compat.i
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/Common/DotNet/coreclr_compat.i	2020-11-10 10:05:25 UTC (rev 9761)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/Common/DotNet/coreclr_compat.i	2020-11-10 10:20:15 UTC (rev 9762)
@@ -13,6 +13,9 @@
  * due to our APIs returning STL strings and lifetime issues that make it incompatible.
  *
  * We know the impl from our modified version works so this is that implementation
+ * 
+ * TODO: SWIG 4.0 apparently improves the cross-platform wstring marshaling significantly that we may not
+ * need this
  */
 %insert(runtime) %{
 /* Callback for returning strings to C# without leaking memory */
@@ -20,6 +23,9 @@
 static SWIG_CSharpMgStringHelperCallback mg_string_callback = NULL;
 %}
 
+/**
+ * .net helper for wstring marshaling
+ */
 %pragma(csharp) imclasscode=%{
     class MgStringHelper 
     {
@@ -83,6 +89,17 @@
 }
 %}
 
+/**
+ * .net namespaces imports needed for the inserted/generated IM code
+ */
+%pragma(csharp) imclassimports=%{
+using System.Reflection;
+using System.Linq;
+%}
+
+/**
+ * .net helper for exception propagation
+ */
 %pragma(csharp) imclasscode=%{
     protected class MgExceptionHelper {
         public delegate void MgExceptionDelegate(global::System.IntPtr exPtr, string className);
@@ -101,7 +118,7 @@
             //
             //SWIG by default will use SWIGPendingException to "stash" exceptions to be rethrown later on
             //we will use the same mechanism
-            global::System.Exception ex = OSGeo.MapGuide.MgObjectFactory.CreateObject<global::System.Exception>(exPtr);
+            global::System.Exception ex = $imclassname.MgObjectFactory.CreateObject<global::System.Exception>(exPtr);
             if (ex != null)
                 SWIGPendingException.Set(ex);
             else //Shouldn't get here
@@ -163,6 +180,65 @@
             return e;
         }
     }
+
+    internal static class MgObjectFactory 
+    {
+        static string GetClassName(global::System.IntPtr objPtr)
+        {
+            var cPtr = $imclassname.GetClassName(objPtr);
+            var str = global::System.Runtime.InteropServices.Marshal.PtrToStringUni(cPtr);
+            global::System.Runtime.InteropServices.Marshal.FreeCoTaskMem(cPtr);
+            return str;
+        }
+    
+        internal static T CreateObject<T>(global::System.IntPtr objPtr) where T : class
+        {
+            T obj = null;
+            var clsId = $imclassname.GetClassId(objPtr);
+            var typeName = MgClassMap.GetTypeName(clsId);
+            if (typeName == null) //Shouldn't happen. But if it did, this would mean we missed a spot when compiling class ids
+            {
+                throw new global::System.Exception("Could not resolve .net type for this unmanaged pointer. The unmanaged pointer reported a class ID of: " + clsId);
+            }
+            
+            var type = global::System.Type.GetType(typeName);
+            if (type == null) //Shouldn't happen. But if it did, this would mean we didn't expose this class to SWIG
+            {
+                throw new global::System.Exception("The type " + typeName + " does not exist. The unmanaged pointer reported a class ID of: " + clsId);
+            }
+            else
+            {
+                var args = new object[] 
+                {
+                    objPtr,
+                    true /* ownMemory */
+                };
+                
+                //The constructor we require has been assigned internal visibility by SWIG. We could change it to public, but the internal
+                //visibility is the ideal one for purposes of encapulsation (this is internal use only). So instead of Activator.CreateInstance()
+                //which does not work with internal constructors, we'll find the ctor ourselves and invoke it.
+                var flags = global::System.Reflection.BindingFlags.NonPublic | global::System.Reflection.BindingFlags.Public | global::System.Reflection.BindingFlags.Instance;
+                var ctors = type.GetTypeInfo().GetConstructors(flags);
+                var ctor = ctors.FirstOrDefault(ci =>
+                {
+                    var parms = ci.GetParameters();
+                    if (parms.Length == 2)
+                    {
+                        return parms[0].ParameterType == typeof(global::System.IntPtr)
+                            && parms[1].ParameterType == typeof(bool);
+                    }
+                    return false;
+                });
+                if (ctor == null)
+                    throw new global::System.Exception("Could not find required constructor among " + ctors.Length + " constructors with signature (IntPtr, bool) on type: " + type.Name);
+                    
+                obj = ctor.Invoke(args) as T;
+                if (obj == null)
+                    throw new global::System.Exception("Could not create an instance of type " + typeof(T).Name + " (concrete type: " + type.Name + "). The unmanaged pointer reported a class ID of: " + clsId);
+            }
+            return obj;
+        }
+    }
 %}
 
 // Exception support
@@ -229,7 +305,7 @@
     }
     else
     {
-        var result = MgObjectFactory.CreateObject<$csclassname>(objPtr);
+        var result = $imclassname.MgObjectFactory.CreateObject<$csclassname>(objPtr);
         return result;
     }
 }

Index: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation	2020-11-10 10:05:25 UTC (rev 9761)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation	2020-11-10 10:20:15 UTC (rev 9762)

Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,8 ##
+FoundationApi.vcxproj.user
+FoundationUnmanagedApi_wrap.cpp
+language.i
+obj
+FoundationApi.i
+FoundationApi_Doc.i
+FoundationApi_Properties.i
+lib
Added: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApi.rc
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApi.rc	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApi.rc	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,96 @@
+// Microsoft Visual C++ generated resource script.
+//
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "winresrc.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+    "#include ""winresrc.h""\r\n"
+    "\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+    "\r\n"
+    "\0"
+END
+
+#endif    // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 3,0,0,0
+ PRODUCTVERSION 3,0,0,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+    BLOCK "StringFileInfo"
+    BEGIN
+        BLOCK "040904b0"
+        BEGIN
+            VALUE "CompanyName", "Open Source Geospatial Foundation"
+            VALUE "FileDescription", "FoundationUnmanagedApi Dynamic Link Library"
+            VALUE "FileVersion", "4, 0, 0, 0"
+            VALUE "InternalName", "FoundationUnmanagedApi"
+            VALUE "LegalCopyright", "Copyright (C) 2006-2020 by Autodesk, Inc."
+            VALUE "OriginalFilename", "FoundationUnmanagedApi.dll"
+            VALUE "ProductName", "MapGuide Open Source"
+            VALUE "ProductVersion", "4, 0, 0, 0"
+        END
+    END
+    BLOCK "VarFileInfo"
+    BEGIN
+        VALUE "Translation", 0x409, 1200
+    END
+END
+
+#endif    // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif    // not APSTUDIO_INVOKED
+

Added: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApi.vcxproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApi.vcxproj	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApi.vcxproj	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,150 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <ItemGroup Label="ProjectConfigurations">
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
+  </ItemGroup>
+  <PropertyGroup Label="Globals">
+    <ProjectGuid>{73C62FF2-C188-4A61-929E-2F112D7E17AA}</ProjectGuid>
+    <RootNamespace>FoundationUnmanagedApi</RootNamespace>
+    <Keyword>Win32Proj</Keyword>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <CharacterSet>Unicode</CharacterSet>
+    <PlatformToolset>v140</PlatformToolset>
+  </PropertyGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
+  <ImportGroup Label="ExtensionSettings">
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
+  </ImportGroup>
+  <PropertyGroup Label="UserMacros" />
+  <PropertyGroup>
+    <_ProjectFileVersion>10.0.40219.1</_ProjectFileVersion>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">bin\$(Configuration)64\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">obj\$(Configuration)64\FoundationUnmanagedApi\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\runtimes\win-x64\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">obj\$(Configuration)64\FoundationUnmanagedApi\</IntDir>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">FoundationUnmanagedApid</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">FoundationUnmanagedApi</TargetName>
+  </PropertyGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <PreBuildEvent>
+      <Command>del /Q "$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\*.cs"
+if exist "$(ProjectDir)FoundationApi_Properties.i" del /Q "$(ProjectDir)FoundationApi_Properties.i"
+"..\..\..\IMake\Win32\IMake.exe" -p "$(ProjectDir)FoundationConstants.xml" -l C# -o "$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\Constants.cs" -t
+copy "$(ProjectDir)..\dotnetcore_split.i" "$(ProjectDir)language.i"
+"..\..\..\IMake\Win32\IMake.exe" -p "$(ProjectDir)FoundationApiGen.xml" -l C# -x "FoundationApi"
+"..\..\..\Tools\swig\install\swig.exe" -c++ -csharp -DDOTNETCORE -DWIN32 -DSWIG_CSHARP_NO_EXCEPTION_HELPER -DSWIG_CSHARP_NO_STRING_HELPER -DSWIG_CSHARP_NO_WSTRING_HELPER -namespace OSGeo.MapGuide -nodefaultctor -nodefaultdtor -module FoundationUnmanagedApi -o "$(ProjectDir)FoundationUnmanagedApi_wrap.cpp" -outdir "$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation" FoundationApi.i
+del /Q ..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\FoundationUnmanagedApi.cs
+</Command>
+    </PreBuildEvent>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <AdditionalIncludeDirectories>..\..\..\..\..\..\Web\src\HttpHandler;..\..\..\..\..\..\Web\src\WebApp;..\..\..\..\..\..\Web\src\WebSupport;..\..\..\..\..\Common\MdfModel;..\..\..\..\..\Common\Foundation;..\..\..\..\..\Common\Geometry;..\..\..\..\..\Common\PlatformBase;..\..\..\..\..\Common\MapGuideCommon;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;SWIG_PUBLIC_API;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ExceptionHandling>Async</ExceptionHandling>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\runtimes\win-x64\native\FoundationUnmanagedApid.dll</OutputFile>
+      <AdditionalLibraryDirectories>$(MG_SDK_LIB64);$(MG_OEM_ACE_LIB_ROOT)\lib64\$(Configuration);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\runtimes\win-x64\native\FoundationUnmanagedApid.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>lib\$(Configuration)64\FoundationUnmanagedApid.lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <PreBuildEvent>
+      <Command>del /Q "$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\*.cs"
+if exist "$(ProjectDir)FoundationApi_Properties.i" del /Q "$(ProjectDir)FoundationApi_Properties.i"
+"..\..\..\IMake\Win32\IMake.exe" -p "$(ProjectDir)FoundationConstants.xml" -l C# -o "$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\Constants.cs" -t
+copy "$(ProjectDir)..\dotnetcore_split.i" "$(ProjectDir)language.i"
+"..\..\..\IMake\Win32\IMake.exe" -p "$(ProjectDir)FoundationApiGen.xml" -l C# -x "FoundationApi"
+"..\..\..\Tools\swig\install\swig.exe" -c++ -csharp -DDOTNETCORE -DWIN32 -DSWIG_CSHARP_NO_EXCEPTION_HELPER -DSWIG_CSHARP_NO_STRING_HELPER -DSWIG_CSHARP_NO_WSTRING_HELPER -namespace OSGeo.MapGuide -nodefaultctor -nodefaultdtor -module FoundationUnmanagedApi -o "$(ProjectDir)FoundationUnmanagedApi_wrap.cpp" -outdir "$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation" FoundationApi.i
+del /Q ..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\FoundationUnmanagedApi.cs
+</Command>
+    </PreBuildEvent>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <AdditionalIncludeDirectories>..\..\..\..\..\..\Web\src\HttpHandler;..\..\..\..\..\..\Web\src\WebApp;..\..\..\..\..\..\Web\src\WebSupport;..\..\..\..\..\Common\MdfModel;..\..\..\..\..\Common\Foundation;..\..\..\..\..\Common\Geometry;..\..\..\..\..\Common\PlatformBase;..\..\..\..\..\Common\MapGuideCommon;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;_WIN64;SWIG_PUBLIC_API;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <ExceptionHandling>Async</ExceptionHandling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+      <MultiProcessorCompilation>true</MultiProcessorCompilation>
+      <AdditionalOptions>/bigobj %(AdditionalOptions)</AdditionalOptions>
+    </ClCompile>
+    <Link>
+      <AdditionalDependencies>MgFoundation.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\runtimes\win-x64\native\FoundationUnmanagedApi.dll</OutputFile>
+      <AdditionalLibraryDirectories>..\..\..\..\..\Common\lib\Release64;..\..\..\..\..\..\Web\lib\Release64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>$(ProjectDir)..\..\..\Managed\DotNet\OSGeo.MapGuide.Foundation\runtimes\win-x64\native\FoundationUnmanagedApi.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <RandomizedBaseAddress>false</RandomizedBaseAddress>
+      <DataExecutionPrevention>
+      </DataExecutionPrevention>
+      <ImportLibrary>lib\$(Configuration)64\FoundationUnmanagedApi.lib</ImportLibrary>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Link>
+  </ItemDefinitionGroup>
+  <ItemGroup>
+    <ClCompile Include="FoundationUnmanagedApi_wrap.cpp">
+      <PreprocessToFile Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</PreprocessToFile>
+      <PreprocessSuppressLineNumbers Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</PreprocessSuppressLineNumbers>
+    </ClCompile>
+  </ItemGroup>
+  <ItemGroup>
+    <ResourceCompile Include="FoundationApi.rc" />
+  </ItemGroup>
+  <ItemGroup>
+    <Xml Include="FoundationApiGen.xml" />
+    <Xml Include="FoundationConstants.xml" />
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="InitializeLibrary.i" />
+  </ItemGroup>
+  <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
+  <ImportGroup Label="ExtensionTargets">
+  </ImportGroup>
+</Project>
\ No newline at end of file

Added: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApiGen.xml
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApiGen.xml	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationApiGen.xml	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,119 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Parameters>
+<!--
+   Module section.
+-->
+<Module name="FoundationApi" />
+
+<!--
+   Custom file path.
+-->
+<CustomFile path="." />
+
+<!--
+   Target section.
+-->
+<Target path="./FoundationApi.i" />
+<DocTarget path="./FoundationApi_Doc.i" />
+
+<!--
+   C++ inline section.
+-->
+<CppInline>
+#ifdef _WIN32
+#pragma warning(disable: 4251)
+#endif
+
+#include <string>
+#include <map>
+#include <list>
+
+#include "Foundation.h"
+
+#if defined(PHP) || defined(JAVA)
+typedef std::wstring STRINGPARAM;
+#else
+typedef wchar_t* STRINGPARAM;
+#endif
+</CppInline>
+
+<!--
+   Type replacements.
+-->
+<TypeReplacements>
+    <TypeReplacement oldtype="CREFSTRING" newtype="STRINGPARAM" />
+    <TypeReplacement oldtype="INT64" newtype="long long" />
+</TypeReplacements>
+
+<!--
+   Swig inline section.
+-->
+<SwigInline>
+  %include "FoundationApi_Doc.i" //doc fragments
+  %include "FoundationApi_Properties.i" //.net property wrappers
+  %include "language.i"   //typemaps specific for each language
+  %include "InitializeLibrary.i"
+  %include "../../../../../Common/Foundation/System/FoundationClassId.h"
+
+#if defined(PHPSWIG)
+  // We force UTF-8 encoding for PHP
+  typedef char*         STRINGPARAM;
+  typedef char*         STRING;
+  typedef char*         BYTE_ARRAY_IN;
+  typedef char*         BYTE_ARRAY_OUT;
+  typedef unsigned char BYTE;
+#elseif defined(JAVA)
+  typedef std::wstring  STRINGPARAM;
+  typedef signed char   BYTE;  //mapped to byte in Java
+#else // .Net
+  typedef char*         BYTE_ARRAY_IN;
+  typedef char*         BYTE_ARRAY_OUT;
+  typedef unsigned char BYTE;    //mapped to byte in C#
+#endif
+
+  typedef int           STATUS;
+  typedef short         INT8;
+  typedef short         INT16;
+  typedef int           INT32;
+  typedef int           UINT32;
+
+</SwigInline>
+
+<!--
+   C++ Headers section.  If you add headers to this section then you
+   must also add them to Makefile.am in the JavaApi and PhpApi folders.
+-->
+<Headers>
+
+    <!-- Foundation classes -->
+
+    <Header path="../../../../../Common/Foundation/System/Object.h" />
+    <Header path="../../../../../Common/Foundation/System/Disposable.h" />
+    <Header path="../../../../../Common/Foundation/System/GuardDisposable.h" />
+    <Header path="../../../../../Common/Foundation/System/Serializable.h" />
+    <Header path="../../../../../Common/Foundation/System/NamedSerializable.h" />
+
+    <Header path="../../../../../Common/Foundation/Data/Collection.h" />
+    <Header path="../../../../../Common/Foundation/Data/Property.h" />
+
+    <!-- The MgDisposableCollection depends on the MgCollection above and so must come after it -->
+    <Header path="../../../../../Common/Foundation/System/DisposableCollection.h" />
+    
+    <Header path="../../../../../Common/Foundation/System/LibraryInit.h" />
+
+    <Header path="../../../../../Common/Foundation/Data/BatchPropertyCollection.h" />
+    <Header path="../../../../../Common/Foundation/Data/ByteReader.h" />
+    <Header path="../../../../../Common/Foundation/Data/ByteSink.h" />
+    <Header path="../../../../../Common/Foundation/Data/ByteSource.h" />
+    <Header path="../../../../../Common/Foundation/Data/DateTime.h" />
+    <Header path="../../../../../Common/Foundation/Data/NullableProperty.h" />
+    <Header path="../../../../../Common/Foundation/Data/PropertyCollection.h" />
+    <Header path="../../../../../Common/Foundation/Data/PropertyDefinition.h" />
+    <Header path="../../../../../Common/Foundation/Data/StringCollection.h" />
+    <Header path="../../../../../Common/Foundation/Data/StringProperty.h" />
+
+    <Header path="../../../../../Common/Foundation/Exception/Exception.h" />
+
+</Headers>
+
+</Parameters>

Added: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationConstants.xml
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationConstants.xml	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/FoundationConstants.xml	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,84 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Parameters>
+
+<!--
+   Type replacements.
+-->
+<PHPTypeReplacements>
+    <TypeReplacement oldtype="STRING" newtype="" />
+    <TypeReplacement oldtype="INT16" newtype="" />
+    <TypeReplacement oldtype="INT32" newtype="" />
+    <TypeReplacement oldtype="int" newtype="" />
+    <TypeReplacement oldtype="float" newtype="" />
+    <TypeReplacement oldtype="double" newtype="" />
+    <TypeReplacement oldtype="static" newtype="" />
+    <TypeReplacement oldtype="bool" newtype="" />
+</PHPTypeReplacements>
+<CSharpTypeReplacements>
+    <TypeReplacement oldtype="STRING" newtype="string" />
+    <TypeReplacement oldtype="INT16" newtype="short" />
+    <TypeReplacement oldtype="INT32" newtype="int" />
+    <TypeReplacement oldtype="int" newtype="int" />
+    <TypeReplacement oldtype="float" newtype="float" />
+    <TypeReplacement oldtype="double" newtype="double" />
+    <TypeReplacement oldtype="static" newtype="" />
+    <TypeReplacement oldtype="const" newtype="const" />
+</CSharpTypeReplacements>
+<JavaTypeReplacements>
+    <TypeReplacement oldtype="STRING" newtype="String" />
+    <TypeReplacement oldtype="INT16" newtype="short" />
+    <TypeReplacement oldtype="INT32" newtype="int" />
+    <TypeReplacement oldtype="int" newtype="int" />
+    <TypeReplacement oldtype="float" newtype="float" />
+    <TypeReplacement oldtype="double" newtype="double" />
+    <TypeReplacement oldtype="const" newtype="final" />
+    <TypeReplacement oldtype="bool" newtype="boolean" />
+</JavaTypeReplacements>
+
+<!--
+   Inline section.
+-->
+<Inline>
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+</Inline>
+
+<Namespace>OSGeo.MapGuide</Namespace>
+<Package>org.osgeo.mapguide</Package>
+
+<Classes>
+  <Class name="MgMimeType" />
+  <Class name="MgPropertyType" />
+  <Class name="MgFeaturePropertyType" />
+  <Class name="MgExceptionCodes" />
+</Classes>
+
+<!--
+   C++ Headers section.  If you add headers to this section then you
+   must also add them to Makefile.am in the JavaApi and PhpApi folders.
+-->
+<Headers>
+
+    <!-- API -->
+    <Header path="../../../../../Common/Foundation/Data/FeaturePropertyType.h" />
+    <Header path="../../../../../Common/Foundation/Data/MimeType.h" />
+    <Header path="../../../../../Common/Foundation/Data/PropertyType.h" />
+    <Header path="../../../../../Common/Foundation/Exception/ExceptionCodes.h" />
+</Headers>
+
+</Parameters>

Added: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/InitializeLibrary.i
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/InitializeLibrary.i	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/Foundation/InitializeLibrary.i	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,22 @@
+//
+//  Copyright (C) 2004-2020 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+///////////////////////////////////////////////////////////
+// Global functions
+//
+void MgInitializeLibrary(STRINGPARAM stringResourcesPath, STRINGPARAM locale);
+void MgUninitializeLibrary();
\ No newline at end of file

Added: sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/dotnetcore_split.i
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/dotnetcore_split.i	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Bindings/DotNet/dotnetcore_split.i	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,157 @@
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+%include <wchar.i>
+%include "../../Common/DotNet/string.i"
+%include "../../Common/DotNet/coreclr_compat.i"
+%include "../../Common/DotNet/sugar.i"
+%include "../../Common/DotNet/custom.i"
+
+// Add default namespaces for all generated proxies
+%typemap(csimports) SWIGTYPE %{
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+//These warnings are false positives as a result of SWIG generated code
+#pragma warning disable 0108, 0114
+%}
+
+%pragma(csharp) moduleimports=%{
+using System;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Collections.Generic;
+%}
+
+// These methods have to be invoked C-style
+%ignore MgObject::GetClassId;
+%ignore MgObject::GetClassName;
+
+%include "../../Common/refcount.i"
+
+// Have these collections implement the .net collection interfaces
+IMPLEMENT_LIST(MgClassDefinitionCollection, MgClassDefinition)
+IMPLEMENT_LIST(MgFeatureSchemaCollection, MgFeatureSchema)
+IMPLEMENT_LIST(MgPropertyDefinitionCollection, MgPropertyDefinition)
+IMPLEMENT_LIST(MgPropertyCollection, MgProperty)
+IMPLEMENT_LIST(MgStringCollection, String)
+IMPLEMENT_LIST(MgLayerCollection, MgLayerBase)
+IMPLEMENT_LIST(MgLayerGroupCollection, MgLayerGroup)
+IMPLEMENT_LIST(MgStringPropertyCollection, MgStringProperty)
+IMPLEMENT_LIST(MgFeatureCommandCollection, MgFeatureCommand)
+IMPLEMENT_LIST(MgMapCollection, MgMapBase)
+IMPLEMENT_LIST(MgMapPlotCollection, MgMapPlot)
+//IMPLEMENT_LIST(MgBatchPropertyCollection, MgPropertyCollection)
+IMPLEMENT_LIST(MgIntCollection, int)
+IMPLEMENT_LIST(MgCoordinateCollection, MgCoordinate)
+IMPLEMENT_LIST(MgPointCollection, MgPoint)
+IMPLEMENT_LIST(MgLineStringCollection, MgLineString)
+IMPLEMENT_LIST(MgLinearRingCollection, MgLinearRing)
+IMPLEMENT_LIST(MgCurveRingCollection, MgCurveRing)
+IMPLEMENT_LIST(MgCurveStringCollection, MgCurveString)
+IMPLEMENT_LIST(MgCurveSegmentCollection, MgCurveSegment)
+IMPLEMENT_LIST(MgCurvePolygonCollection, MgCurvePolygon)
+IMPLEMENT_LIST(MgPolygonCollection, MgPolygon)
+IMPLEMENT_LIST(MgGeometryCollection, MgGeometry)
+IMPLEMENT_READONLY_LIST(MgReadOnlyLayerCollection, MgLayerBase)
+
+///////////////////////////////////////////////////////////
+// STRINGPARAM "in" typemap
+// Marshal a C++ style string to a wstring
+// Allocate temporary memory only when required, otherwise
+// use a buffer on the stack
+//
+#if defined(DOTNETCORE)
+#if defined(WIN32)
+%typemap(in) STRINGPARAM
+{
+    //out typemap - WIN32 (DOTNETCORE)
+    if (NULL == $input)
+    {
+        $1 = STRINGPARAM(L"");
+    }
+    else
+    {
+        $1 = (STRINGPARAM)$input;
+    }
+}
+#else
+%typemap(in) STRINGPARAM
+{
+    //out typemap - LINUX (DOTNETCORE)
+    if (NULL == $input)
+    {
+        $1 = STRINGPARAM(L"");
+    }
+    else
+    {
+        $1 = (STRINGPARAM) X2W((XMLCh*)$input);
+    }
+}
+#endif
+#else
+%typemap(in) STRINGPARAM
+{
+    $1 = (STRINGPARAM) $input;
+}
+#endif
+
+///////////////////////////////////////////////////////////
+// STRING "out" typemap
+// Marshal a string returned by C++ to CSharp
+//
+#if defined(DOTNETCORE)
+#if defined(WIN32)
+%typemap(out) STRING
+{
+    //out typemap - WIN32 (DOTNETCORE)
+    $result = mg_string_callback((int)($1.length()+1)*sizeof(wchar_t));
+    wcscpy((wchar_t*)$result, $1.c_str());
+}
+#else
+%typemap(out) STRING
+{
+    //out typemap - LINUX (DOTNETCORE)
+    xstring u16String;
+    UnicodeString::UTF32toUTF16((const LCh*) $1.c_str(), u16String);
+    $result = mg_string_callback((int)(u16String.length()+1)*sizeof(LCh));
+    XMLString::copyString((XMLCh*)$result, u16String.c_str());
+}
+#endif
+#else
+%typemap(out) STRING
+{
+    $result = mg_string_callback((int)($1.length()+1)*sizeof(wchar_t));
+    wcscpy((wchar_t*)$result, $1.c_str());
+}
+#endif
+
+///////////////////////////////////////////////////////////
+// BYTE_ARRAY_OUT "cstype" typemap
+// Type substitution in .NET and proxy code
+//
+%typemap(cstype) BYTE_ARRAY_OUT "global::System.Byte[]"
+%typemap(imtype) BYTE_ARRAY_OUT "global::System.Byte[]"
+%typemap(ctype)  BYTE_ARRAY_OUT "unsigned char*"
+
+///////////////////////////////////////////////////////////
+// BYTE_ARRAY_IN "cstype" typemap
+// Type substitution in .NET and proxy code
+//
+%typemap(cstype) BYTE_ARRAY_IN "global::System.Byte[]"
+%typemap(imtype) BYTE_ARRAY_IN "global::System.Byte[]"
+%typemap(ctype)  BYTE_ARRAY_IN "unsigned char*"

Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/MgClassMap.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/MgClassMap.cs	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/Common/MgClassMap.cs	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,361 @@
+// This file is autogenerated by ClassMapGen. DO NOT EDIT
+
+using System;
+using System.Collections.Generic;
+
+namespace OSGeo.MapGuide
+{
+    internal static class MgClassMap
+    {
+        static Dictionary<int, string> classNameMap;
+        
+        static MgClassMap()
+        {
+            classNameMap = new Dictionary<int, string>();
+            
+            classNameMap[20004] = "OSGeo.MapGuide.MgAgfReaderWriter";
+            classNameMap[20005] = "OSGeo.MapGuide.MgAggregateGeometry";
+            classNameMap[1500] = "OSGeo.MapGuide.MgApplicationException";
+            classNameMap[20006] = "OSGeo.MapGuide.MgArcSegment";
+            classNameMap[1501] = "OSGeo.MapGuide.MgArgumentOutOfRangeException";
+            classNameMap[10500] = "OSGeo.MapGuide.MgArrayTypeMismatchException";
+            classNameMap[30000] = "OSGeo.MapGuide.MgAuthenticationFailedException";
+            classNameMap[1005] = "OSGeo.MapGuide.MgBatchPropertyCollection";
+            classNameMap[10252] = "OSGeo.MapGuide.MgBlobProperty";
+            classNameMap[10253] = "OSGeo.MapGuide.MgBooleanProperty";
+            classNameMap[10254] = "OSGeo.MapGuide.MgByteProperty";
+            classNameMap[1250] = "OSGeo.MapGuide.MgByteReader";
+            classNameMap[1257] = "OSGeo.MapGuide.MgByteSink";
+            classNameMap[1251] = "OSGeo.MapGuide.MgByteSource";
+            classNameMap[11750] = "OSGeo.MapGuide.MgClassDefinition";
+            classNameMap[11780] = "OSGeo.MapGuide.MgClassDefinitionCollection";
+            classNameMap[1502] = "OSGeo.MapGuide.MgClassNotFoundException";
+            classNameMap[10255] = "OSGeo.MapGuide.MgClobProperty";
+            classNameMap[10250] = "OSGeo.MapGuide.MgColor";
+            classNameMap[1503] = "OSGeo.MapGuide.MgConfigurationException";
+            classNameMap[1504] = "OSGeo.MapGuide.MgConfigurationLoadFailedException";
+            classNameMap[1505] = "OSGeo.MapGuide.MgConfigurationSaveFailedException";
+            classNameMap[30001] = "OSGeo.MapGuide.MgConnectionFailedException";
+            classNameMap[30002] = "OSGeo.MapGuide.MgConnectionNotOpenException";
+            classNameMap[20003] = "OSGeo.MapGuide.MgCoordinate";
+            classNameMap[20009] = "OSGeo.MapGuide.MgCoordinateIterator";
+            classNameMap[20500] = "OSGeo.MapGuide.MgCoordinateSystem";
+            classNameMap[20504] = "OSGeo.MapGuide.MgCoordinateSystemCatalog";
+            classNameMap[20506] = "OSGeo.MapGuide.MgCoordinateSystemCategory";
+            classNameMap[20510] = "OSGeo.MapGuide.MgCoordinateSystemCategoryDictionary";
+            classNameMap[21000] = "OSGeo.MapGuide.MgCoordinateSystemComputationFailedException";
+            classNameMap[21001] = "OSGeo.MapGuide.MgCoordinateSystemConversionFailedException";
+            classNameMap[20507] = "OSGeo.MapGuide.MgCoordinateSystemDatum";
+            classNameMap[20512] = "OSGeo.MapGuide.MgCoordinateSystemDatumDictionary";
+            classNameMap[20511] = "OSGeo.MapGuide.MgCoordinateSystemDictionary";
+            classNameMap[20521] = "OSGeo.MapGuide.MgCoordinateSystemDictionaryUtility";
+            classNameMap[20509] = "OSGeo.MapGuide.MgCoordinateSystemEllipsoid";
+            classNameMap[20513] = "OSGeo.MapGuide.MgCoordinateSystemEllipsoidDictionary";
+            classNameMap[20514] = "OSGeo.MapGuide.MgCoordinateSystemEnum";
+            classNameMap[20515] = "OSGeo.MapGuide.MgCoordinateSystemEnumInteger32";
+            classNameMap[20501] = "OSGeo.MapGuide.MgCoordinateSystemFactory";
+            classNameMap[20516] = "OSGeo.MapGuide.MgCoordinateSystemFilter";
+            classNameMap[20517] = "OSGeo.MapGuide.MgCoordinateSystemFilterInteger32";
+            classNameMap[20505] = "OSGeo.MapGuide.MgCoordinateSystemFormatConverter";
+            classNameMap[20542] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticAnalyticalTransformDefParams";
+            classNameMap[20543] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticInterpolationTransformDefParams";
+            classNameMap[20544] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticMultipleRegressionTransformDefParams";
+            classNameMap[20533] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPath";
+            classNameMap[20535] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPathDictionary";
+            classNameMap[20534] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticPathElement";
+            classNameMap[20508] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformation";
+            classNameMap[20536] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDef";
+            classNameMap[20540] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformDefDictionary";
+            classNameMap[20545] = "OSGeo.MapGuide.MgCoordinateSystemGeodeticTransformGridFile";
+            classNameMap[20532] = "OSGeo.MapGuide.MgCoordinateSystemGridBase";
+            classNameMap[20524] = "OSGeo.MapGuide.MgCoordinateSystemGridBoundary";
+            classNameMap[20529] = "OSGeo.MapGuide.MgCoordinateSystemGridLine";
+            classNameMap[20526] = "OSGeo.MapGuide.MgCoordinateSystemGridLineCollection";
+            classNameMap[20530] = "OSGeo.MapGuide.MgCoordinateSystemGridRegion";
+            classNameMap[20527] = "OSGeo.MapGuide.MgCoordinateSystemGridRegionCollection";
+            classNameMap[20525] = "OSGeo.MapGuide.MgCoordinateSystemGridSpecification";
+            classNameMap[20531] = "OSGeo.MapGuide.MgCoordinateSystemGridTick";
+            classNameMap[20528] = "OSGeo.MapGuide.MgCoordinateSystemGridTickCollection";
+            classNameMap[21002] = "OSGeo.MapGuide.MgCoordinateSystemInitializationFailedException";
+            classNameMap[21003] = "OSGeo.MapGuide.MgCoordinateSystemLoadFailedException";
+            classNameMap[20518] = "OSGeo.MapGuide.MgCoordinateSystemMathComparator";
+            classNameMap[20502] = "OSGeo.MapGuide.MgCoordinateSystemMeasure";
+            classNameMap[21004] = "OSGeo.MapGuide.MgCoordinateSystemMeasureFailedException";
+            classNameMap[20522] = "OSGeo.MapGuide.MgCoordinateSystemMgrs";
+            classNameMap[20520] = "OSGeo.MapGuide.MgCoordinateSystemProjectionInformation";
+            classNameMap[20503] = "OSGeo.MapGuide.MgCoordinateSystemTransform";
+            classNameMap[21005] = "OSGeo.MapGuide.MgCoordinateSystemTransformFailedException";
+            classNameMap[20519] = "OSGeo.MapGuide.MgCoordinateSystemUnitInformation";
+            classNameMap[20048] = "OSGeo.MapGuide.MgCoordinateXY";
+            classNameMap[20051] = "OSGeo.MapGuide.MgCoordinateXYM";
+            classNameMap[20049] = "OSGeo.MapGuide.MgCoordinateXYZ";
+            classNameMap[20050] = "OSGeo.MapGuide.MgCoordinateXYZM";
+            classNameMap[20010] = "OSGeo.MapGuide.MgCurve";
+            classNameMap[20011] = "OSGeo.MapGuide.MgCurvePolygon";
+            classNameMap[20047] = "OSGeo.MapGuide.MgCurvePolygonCollection";
+            classNameMap[20012] = "OSGeo.MapGuide.MgCurveRing";
+            classNameMap[20052] = "OSGeo.MapGuide.MgCurveRingCollection";
+            classNameMap[20013] = "OSGeo.MapGuide.MgCurveSegment";
+            classNameMap[20041] = "OSGeo.MapGuide.MgCurveSegmentCollection";
+            classNameMap[20014] = "OSGeo.MapGuide.MgCurveString";
+            classNameMap[20043] = "OSGeo.MapGuide.MgCurveStringCollection";
+            classNameMap[11751] = "OSGeo.MapGuide.MgDataPropertyDefinition";
+            classNameMap[11773] = "OSGeo.MapGuide.MgDataReader";
+            classNameMap[1256] = "OSGeo.MapGuide.MgDateTime";
+            classNameMap[1506] = "OSGeo.MapGuide.MgDateTimeException";
+            classNameMap[10256] = "OSGeo.MapGuide.MgDateTimeProperty";
+            classNameMap[30003] = "OSGeo.MapGuide.MgDbException";
+            classNameMap[30004] = "OSGeo.MapGuide.MgDbXmlException";
+            classNameMap[1507] = "OSGeo.MapGuide.MgDecryptionException";
+            classNameMap[11775] = "OSGeo.MapGuide.MgDeleteFeatures";
+            classNameMap[1508] = "OSGeo.MapGuide.MgDirectoryNotFoundException";
+            classNameMap[1000] = "OSGeo.MapGuide.MgDisposableCollection";
+            classNameMap[1509] = "OSGeo.MapGuide.MgDivideByZeroException";
+            classNameMap[1510] = "OSGeo.MapGuide.MgDomainException";
+            classNameMap[10257] = "OSGeo.MapGuide.MgDoubleProperty";
+            classNameMap[30700] = "OSGeo.MapGuide.MgDrawingService";
+            classNameMap[1511] = "OSGeo.MapGuide.MgDuplicateDirectoryException";
+            classNameMap[1512] = "OSGeo.MapGuide.MgDuplicateFileException";
+            classNameMap[30005] = "OSGeo.MapGuide.MgDuplicateGroupException";
+            classNameMap[30006] = "OSGeo.MapGuide.MgDuplicateNameException";
+            classNameMap[1513] = "OSGeo.MapGuide.MgDuplicateObjectException";
+            classNameMap[30007] = "OSGeo.MapGuide.MgDuplicateParameterException";
+            classNameMap[30008] = "OSGeo.MapGuide.MgDuplicateRepositoryException";
+            classNameMap[10501] = "OSGeo.MapGuide.MgDuplicateResourceDataException";
+            classNameMap[10502] = "OSGeo.MapGuide.MgDuplicateResourceException";
+            classNameMap[30009] = "OSGeo.MapGuide.MgDuplicateRoleException";
+            classNameMap[30010] = "OSGeo.MapGuide.MgDuplicateServerException";
+            classNameMap[30011] = "OSGeo.MapGuide.MgDuplicateSessionException";
+            classNameMap[30012] = "OSGeo.MapGuide.MgDuplicateUserException";
+            classNameMap[30013] = "OSGeo.MapGuide.MgDwfException";
+            classNameMap[30014] = "OSGeo.MapGuide.MgDwfSectionNotFoundException";
+            classNameMap[30015] = "OSGeo.MapGuide.MgDwfSectionResourceNotFoundException";
+            classNameMap[30901] = "OSGeo.MapGuide.MgDwfVersion";
+            classNameMap[10503] = "OSGeo.MapGuide.MgEmptyFeatureSetException";
+            classNameMap[1514] = "OSGeo.MapGuide.MgEncryptionException";
+            classNameMap[30016] = "OSGeo.MapGuide.MgEndOfStreamException";
+            classNameMap[20001] = "OSGeo.MapGuide.MgEnvelope";
+            classNameMap[1515] = "OSGeo.MapGuide.MgException";
+            classNameMap[10504] = "OSGeo.MapGuide.MgFdoException";
+            classNameMap[11772] = "OSGeo.MapGuide.MgFeatureAggregateOptions";
+            classNameMap[11774] = "OSGeo.MapGuide.MgFeatureCommandCollection";
+            classNameMap[31001] = "OSGeo.MapGuide.MgFeatureInformation";
+            classNameMap[11764] = "OSGeo.MapGuide.MgFeatureProperty";
+            classNameMap[11771] = "OSGeo.MapGuide.MgFeatureQueryOptions";
+            classNameMap[11753] = "OSGeo.MapGuide.MgFeatureReader";
+            classNameMap[11778] = "OSGeo.MapGuide.MgFeatureSchema";
+            classNameMap[11779] = "OSGeo.MapGuide.MgFeatureSchemaCollection";
+            classNameMap[11754] = "OSGeo.MapGuide.MgFeatureService";
+            classNameMap[10505] = "OSGeo.MapGuide.MgFeatureServiceException";
+            classNameMap[11786] = "OSGeo.MapGuide.MgFileFeatureSourceParams";
+            classNameMap[1516] = "OSGeo.MapGuide.MgFileIoException";
+            classNameMap[1517] = "OSGeo.MapGuide.MgFileNotFoundException";
+            classNameMap[20016] = "OSGeo.MapGuide.MgGeometricEntity";
+            classNameMap[11756] = "OSGeo.MapGuide.MgGeometricPropertyDefinition";
+            classNameMap[20019] = "OSGeo.MapGuide.MgGeometry";
+            classNameMap[20020] = "OSGeo.MapGuide.MgGeometryCollection";
+            classNameMap[20021] = "OSGeo.MapGuide.MgGeometryComponent";
+            classNameMap[21006] = "OSGeo.MapGuide.MgGeometryException";
+            classNameMap[20002] = "OSGeo.MapGuide.MgGeometryFactory";
+            classNameMap[11758] = "OSGeo.MapGuide.MgGeometryProperty";
+            classNameMap[11785] = "OSGeo.MapGuide.MgGeometryTypeInfo";
+            classNameMap[30018] = "OSGeo.MapGuide.MgGroupNotFoundException";
+            classNameMap[11782] = "OSGeo.MapGuide.MgGwsFeatureReader";
+            classNameMap[40000] = "OSGeo.MapGuide.MgHttpHeader";
+            classNameMap[40006] = "OSGeo.MapGuide.MgHttpPrimitiveValue";
+            classNameMap[40004] = "OSGeo.MapGuide.MgHttpRequest";
+            classNameMap[40002] = "OSGeo.MapGuide.MgHttpRequestMetadata";
+            classNameMap[40001] = "OSGeo.MapGuide.MgHttpRequestParam";
+            classNameMap[40005] = "OSGeo.MapGuide.MgHttpResponse";
+            classNameMap[40003] = "OSGeo.MapGuide.MgHttpResult";
+            classNameMap[1518] = "OSGeo.MapGuide.MgIndexOutOfRangeException";
+            classNameMap[11776] = "OSGeo.MapGuide.MgInsertFeatures";
+            classNameMap[10258] = "OSGeo.MapGuide.MgInt16Property";
+            classNameMap[10259] = "OSGeo.MapGuide.MgInt32Property";
+            classNameMap[10260] = "OSGeo.MapGuide.MgInt64Property";
+            classNameMap[10000] = "OSGeo.MapGuide.MgIntCollection";
+            classNameMap[1519] = "OSGeo.MapGuide.MgInvalidArgumentException";
+            classNameMap[1520] = "OSGeo.MapGuide.MgInvalidCastException";
+            classNameMap[21007] = "OSGeo.MapGuide.MgInvalidCoordinateSystemException";
+            classNameMap[21008] = "OSGeo.MapGuide.MgInvalidCoordinateSystemTypeException";
+            classNameMap[21009] = "OSGeo.MapGuide.MgInvalidCoordinateSystemUnitsException";
+            classNameMap[30019] = "OSGeo.MapGuide.MgInvalidDwfPackageException";
+            classNameMap[30020] = "OSGeo.MapGuide.MgInvalidDwfSectionException";
+            classNameMap[30021] = "OSGeo.MapGuide.MgInvalidFeatureSourceException";
+            classNameMap[30022] = "OSGeo.MapGuide.MgInvalidIpAddressException";
+            classNameMap[30023] = "OSGeo.MapGuide.MgInvalidLicenseException";
+            classNameMap[30024] = "OSGeo.MapGuide.MgInvalidLogEntryException";
+            classNameMap[10507] = "OSGeo.MapGuide.MgInvalidMapDefinitionException";
+            classNameMap[1522] = "OSGeo.MapGuide.MgInvalidOperationException";
+            classNameMap[30026] = "OSGeo.MapGuide.MgInvalidPasswordException";
+            classNameMap[30027] = "OSGeo.MapGuide.MgInvalidPrintLayoutFontSizeUnitsException";
+            classNameMap[30028] = "OSGeo.MapGuide.MgInvalidPrintLayoutPositionUnitsException";
+            classNameMap[30029] = "OSGeo.MapGuide.MgInvalidPrintLayoutSizeUnitsException";
+            classNameMap[1523] = "OSGeo.MapGuide.MgInvalidPropertyTypeException";
+            classNameMap[10508] = "OSGeo.MapGuide.MgInvalidRepositoryNameException";
+            classNameMap[10509] = "OSGeo.MapGuide.MgInvalidRepositoryTypeException";
+            classNameMap[10510] = "OSGeo.MapGuide.MgInvalidResourceDataNameException";
+            classNameMap[10511] = "OSGeo.MapGuide.MgInvalidResourceDataTypeException";
+            classNameMap[10512] = "OSGeo.MapGuide.MgInvalidResourceNameException";
+            classNameMap[10513] = "OSGeo.MapGuide.MgInvalidResourcePathException";
+            classNameMap[10514] = "OSGeo.MapGuide.MgInvalidResourcePreProcessingTypeException";
+            classNameMap[10515] = "OSGeo.MapGuide.MgInvalidResourceTypeException";
+            classNameMap[30031] = "OSGeo.MapGuide.MgInvalidServerNameException";
+            classNameMap[1524] = "OSGeo.MapGuide.MgInvalidStreamHeaderException";
+            classNameMap[1525] = "OSGeo.MapGuide.MgIoException";
+            classNameMap[31300] = "OSGeo.MapGuide.MgKmlService";
+            classNameMap[30501] = "OSGeo.MapGuide.MgLayer";
+            classNameMap[12003] = "OSGeo.MapGuide.MgLayerBase";
+            classNameMap[12002] = "OSGeo.MapGuide.MgLayerCollection";
+            classNameMap[12001] = "OSGeo.MapGuide.MgLayerGroup";
+            classNameMap[12004] = "OSGeo.MapGuide.MgLayerGroupCollection";
+            classNameMap[10517] = "OSGeo.MapGuide.MgLayerNotFoundException";
+            classNameMap[30904] = "OSGeo.MapGuide.MgLayout";
+            classNameMap[1526] = "OSGeo.MapGuide.MgLengthException";
+            classNameMap[30032] = "OSGeo.MapGuide.MgLicenseException";
+            classNameMap[30033] = "OSGeo.MapGuide.MgLicenseExpiredException";
+            classNameMap[20023] = "OSGeo.MapGuide.MgLinearRing";
+            classNameMap[20053] = "OSGeo.MapGuide.MgLinearRingCollection";
+            classNameMap[20024] = "OSGeo.MapGuide.MgLinearSegment";
+            classNameMap[20042] = "OSGeo.MapGuide.MgLineString";
+            classNameMap[20044] = "OSGeo.MapGuide.MgLineStringCollection";
+            classNameMap[1527] = "OSGeo.MapGuide.MgLogicException";
+            classNameMap[11766] = "OSGeo.MapGuide.MgLongTransactionReader";
+            classNameMap[30500] = "OSGeo.MapGuide.MgMap";
+            classNameMap[12000] = "OSGeo.MapGuide.MgMapBase";
+            classNameMap[12005] = "OSGeo.MapGuide.MgMapCollection";
+            classNameMap[30900] = "OSGeo.MapGuide.MgMappingService";
+            classNameMap[30905] = "OSGeo.MapGuide.MgMapPlot";
+            classNameMap[30906] = "OSGeo.MapGuide.MgMapPlotCollection";
+            classNameMap[20029] = "OSGeo.MapGuide.MgMultiCurvePolygon";
+            classNameMap[20030] = "OSGeo.MapGuide.MgMultiCurveString";
+            classNameMap[20031] = "OSGeo.MapGuide.MgMultiGeometry";
+            classNameMap[20032] = "OSGeo.MapGuide.MgMultiLineString";
+            classNameMap[20033] = "OSGeo.MapGuide.MgMultiPoint";
+            classNameMap[20034] = "OSGeo.MapGuide.MgMultiPolygon";
+            classNameMap[1528] = "OSGeo.MapGuide.MgNotFiniteNumberException";
+            classNameMap[1529] = "OSGeo.MapGuide.MgNotImplementedException";
+            classNameMap[1530] = "OSGeo.MapGuide.MgNullArgumentException";
+            classNameMap[1531] = "OSGeo.MapGuide.MgNullPropertyValueException";
+            classNameMap[1532] = "OSGeo.MapGuide.MgNullReferenceException";
+            classNameMap[1533] = "OSGeo.MapGuide.MgObjectNotFoundException";
+            classNameMap[11759] = "OSGeo.MapGuide.MgObjectPropertyDefinition";
+            classNameMap[30035] = "OSGeo.MapGuide.MgOperationProcessingException";
+            classNameMap[1534] = "OSGeo.MapGuide.MgOutOfMemoryException";
+            classNameMap[1535] = "OSGeo.MapGuide.MgOutOfRangeException";
+            classNameMap[1536] = "OSGeo.MapGuide.MgOverflowException";
+            classNameMap[30604] = "OSGeo.MapGuide.MgPackageStatusInformation";
+            classNameMap[11788] = "OSGeo.MapGuide.MgParameter";
+            classNameMap[10004] = "OSGeo.MapGuide.MgParameterCollection";
+            classNameMap[30036] = "OSGeo.MapGuide.MgParameterNotFoundException";
+            classNameMap[30037] = "OSGeo.MapGuide.MgPathTooLongException";
+            classNameMap[1537] = "OSGeo.MapGuide.MgPlatformNotSupportedException";
+            classNameMap[30902] = "OSGeo.MapGuide.MgPlotSpecification";
+            classNameMap[20000] = "OSGeo.MapGuide.MgPoint";
+            classNameMap[20045] = "OSGeo.MapGuide.MgPointCollection";
+            classNameMap[20035] = "OSGeo.MapGuide.MgPolygon";
+            classNameMap[20046] = "OSGeo.MapGuide.MgPolygonCollection";
+            classNameMap[30039] = "OSGeo.MapGuide.MgPortNotAvailableException";
+            classNameMap[30040] = "OSGeo.MapGuide.MgPrintToScaleModeNotSelectedException";
+            classNameMap[31400] = "OSGeo.MapGuide.MgProfilingService";
+            classNameMap[2000] = "OSGeo.MapGuide.MgProperty";
+            classNameMap[1002] = "OSGeo.MapGuide.MgPropertyCollection";
+            classNameMap[2002] = "OSGeo.MapGuide.MgPropertyDefinition";
+            classNameMap[10001] = "OSGeo.MapGuide.MgPropertyDefinitionCollection";
+            classNameMap[11769] = "OSGeo.MapGuide.MgRaster";
+            classNameMap[11770] = "OSGeo.MapGuide.MgRasterProperty";
+            classNameMap[11768] = "OSGeo.MapGuide.MgRasterPropertyDefinition";
+            classNameMap[12006] = "OSGeo.MapGuide.MgReadOnlyLayerCollection";
+            classNameMap[20037] = "OSGeo.MapGuide.MgRegion";
+            classNameMap[31002] = "OSGeo.MapGuide.MgRenderingOptions";
+            classNameMap[31000] = "OSGeo.MapGuide.MgRenderingService";
+            classNameMap[30041] = "OSGeo.MapGuide.MgRepositoryCreationFailedException";
+            classNameMap[30042] = "OSGeo.MapGuide.MgRepositoryNotFoundException";
+            classNameMap[30043] = "OSGeo.MapGuide.MgRepositoryNotOpenException";
+            classNameMap[30044] = "OSGeo.MapGuide.MgRepositoryOpenFailedException";
+            classNameMap[11526] = "OSGeo.MapGuide.MgResource";
+            classNameMap[10518] = "OSGeo.MapGuide.MgResourceBusyException";
+            classNameMap[10519] = "OSGeo.MapGuide.MgResourceDataNotFoundException";
+            classNameMap[11500] = "OSGeo.MapGuide.MgResourceIdentifier";
+            classNameMap[10520] = "OSGeo.MapGuide.MgResourceNotFoundException";
+            classNameMap[11501] = "OSGeo.MapGuide.MgResourceService";
+            classNameMap[1538] = "OSGeo.MapGuide.MgResourcesException";
+            classNameMap[1539] = "OSGeo.MapGuide.MgResourcesLoadFailedException";
+            classNameMap[1540] = "OSGeo.MapGuide.MgResourceTagNotFoundException";
+            classNameMap[20038] = "OSGeo.MapGuide.MgRing";
+            classNameMap[30045] = "OSGeo.MapGuide.MgRoleNotFoundException";
+            classNameMap[1541] = "OSGeo.MapGuide.MgRuntimeException";
+            classNameMap[30502] = "OSGeo.MapGuide.MgSelection";
+            classNameMap[12007] = "OSGeo.MapGuide.MgSelectionBase";
+            classNameMap[30607] = "OSGeo.MapGuide.MgServerAdmin";
+            classNameMap[30046] = "OSGeo.MapGuide.MgServerNotFoundException";
+            classNameMap[30047] = "OSGeo.MapGuide.MgServerNotOnlineException";
+            classNameMap[11251] = "OSGeo.MapGuide.MgService";
+            classNameMap[10521] = "OSGeo.MapGuide.MgServiceNotAvailableException";
+            classNameMap[10522] = "OSGeo.MapGuide.MgServiceNotSupportedException";
+            classNameMap[30048] = "OSGeo.MapGuide.MgSessionExpiredException";
+            classNameMap[30052] = "OSGeo.MapGuide.MgSessionNotFoundException";
+            classNameMap[10261] = "OSGeo.MapGuide.MgSingleProperty";
+            classNameMap[30605] = "OSGeo.MapGuide.MgSite";
+            classNameMap[30601] = "OSGeo.MapGuide.MgSiteConnection";
+            classNameMap[30608] = "OSGeo.MapGuide.MgSiteInfo";
+            classNameMap[11761] = "OSGeo.MapGuide.MgSpatialContextReader";
+            classNameMap[11762] = "OSGeo.MapGuide.MgSqlDataReader";
+            classNameMap[1542] = "OSGeo.MapGuide.MgStreamIoException";
+            classNameMap[1003] = "OSGeo.MapGuide.MgStringCollection";
+            classNameMap[2001] = "OSGeo.MapGuide.MgStringProperty";
+            classNameMap[10003] = "OSGeo.MapGuide.MgStringPropertyCollection";
+            classNameMap[1543] = "OSGeo.MapGuide.MgSystemException";
+            classNameMap[1544] = "OSGeo.MapGuide.MgTemporaryFileNotAvailableException";
+            classNameMap[1545] = "OSGeo.MapGuide.MgThirdPartyException";
+            classNameMap[31200] = "OSGeo.MapGuide.MgTileService";
+            classNameMap[11787] = "OSGeo.MapGuide.MgTransaction";
+            classNameMap[30049] = "OSGeo.MapGuide.MgUnauthorizedAccessException";
+            classNameMap[1547] = "OSGeo.MapGuide.MgUnclassifiedException";
+            classNameMap[1548] = "OSGeo.MapGuide.MgUnderflowException";
+            classNameMap[30056] = "OSGeo.MapGuide.MgUnknownTileProviderException";
+            classNameMap[30057] = "OSGeo.MapGuide.MgUnsupportedTileProviderException";
+            classNameMap[11777] = "OSGeo.MapGuide.MgUpdateFeatures";
+            classNameMap[30050] = "OSGeo.MapGuide.MgUriFormatException";
+            classNameMap[30606] = "OSGeo.MapGuide.MgUserInformation";
+            classNameMap[10523] = "OSGeo.MapGuide.MgUserNotFoundException";
+            classNameMap[11257] = "OSGeo.MapGuide.MgWarnings";
+            classNameMap[50005] = "OSGeo.MapGuide.MgWebBufferCommand";
+            classNameMap[50000] = "OSGeo.MapGuide.MgWebCommand";
+            classNameMap[50012] = "OSGeo.MapGuide.MgWebCommandCollection";
+            classNameMap[50015] = "OSGeo.MapGuide.MgWebCommandWidget";
+            classNameMap[50025] = "OSGeo.MapGuide.MgWebContextMenu";
+            classNameMap[50016] = "OSGeo.MapGuide.MgWebFlyoutWidget";
+            classNameMap[50009] = "OSGeo.MapGuide.MgWebGetPrintablePageCommand";
+            classNameMap[50011] = "OSGeo.MapGuide.MgWebHelpCommand";
+            classNameMap[50022] = "OSGeo.MapGuide.MgWebInformationPane";
+            classNameMap[50003] = "OSGeo.MapGuide.MgWebInvokeScriptCommand";
+            classNameMap[50004] = "OSGeo.MapGuide.MgWebInvokeUrlCommand";
+            classNameMap[50026] = "OSGeo.MapGuide.MgWebLayout";
+            classNameMap[50008] = "OSGeo.MapGuide.MgWebMeasureCommand";
+            classNameMap[50007] = "OSGeo.MapGuide.MgWebPrintCommand";
+            classNameMap[50002] = "OSGeo.MapGuide.MgWebSearchCommand";
+            classNameMap[50006] = "OSGeo.MapGuide.MgWebSelectWithinCommand";
+            classNameMap[50014] = "OSGeo.MapGuide.MgWebSeparatorWidget";
+            classNameMap[50023] = "OSGeo.MapGuide.MgWebTaskBar";
+            classNameMap[50017] = "OSGeo.MapGuide.MgWebTaskBarWidget";
+            classNameMap[50024] = "OSGeo.MapGuide.MgWebTaskPane";
+            classNameMap[50021] = "OSGeo.MapGuide.MgWebToolBar";
+            classNameMap[50019] = "OSGeo.MapGuide.MgWebUiPane";
+            classNameMap[50020] = "OSGeo.MapGuide.MgWebUiSizablePane";
+            classNameMap[50001] = "OSGeo.MapGuide.MgWebUiTargetCommand";
+            classNameMap[50010] = "OSGeo.MapGuide.MgWebViewOptionsCommand";
+            classNameMap[50013] = "OSGeo.MapGuide.MgWebWidget";
+            classNameMap[50018] = "OSGeo.MapGuide.MgWebWidgetCollection";
+            classNameMap[20040] = "OSGeo.MapGuide.MgWktReaderWriter";
+            classNameMap[1549] = "OSGeo.MapGuide.MgXmlException";
+            classNameMap[1550] = "OSGeo.MapGuide.MgXmlParserException";
+
+        }
+        
+        internal static string GetTypeName(int id)
+        {
+            return classNameMap.ContainsKey(id) ? classNameMap[id] : null;
+        }
+    }
+}
\ No newline at end of file

Deleted: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/custom/MgObjectFactory.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/custom/MgObjectFactory.cs	2020-11-10 10:05:25 UTC (rev 9761)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/MapGuideDotNetApi/custom/MgObjectFactory.cs	2020-11-10 10:20:15 UTC (rev 9762)
@@ -1,82 +0,0 @@
-//
-//  Copyright (C) 2004-2015 by Autodesk, Inc.
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of version 2.1 of the GNU Lesser
-//  General Public License as published by the Free Software Foundation.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-//
-using System;
-using System.Reflection;
-using System.Linq;
-using System.Runtime.InteropServices;
-
-namespace OSGeo.MapGuide
-{
-    internal static class MgObjectFactory 
-    {
-        static string GetClassName(IntPtr objPtr)
-        {
-            IntPtr cPtr = MapGuideDotNetUnmanagedApiPINVOKE.GetClassName(objPtr);
-            string str = Marshal.PtrToStringUni(cPtr);
-            Marshal.FreeCoTaskMem(cPtr);
-            return str;
-        }
-    
-        internal static T CreateObject<T>(IntPtr objPtr) where T : class
-        {
-            T obj = null;
-            int clsId = MapGuideDotNetUnmanagedApiPINVOKE.GetClassId(objPtr);
-            string typeName = MgClassMap.GetTypeName(clsId);
-            if (typeName == null) //Shouldn't happen. But if it did, this would mean we missed a spot when compiling class ids
-            {
-                throw new Exception("Could not resolve .net type for this unmanaged pointer. The unmanaged pointer reported a class ID of: " + clsId);
-            }
-            
-            var type = Type.GetType(typeName);
-            if (type == null) //Shouldn't happen. But if it did, this would mean we didn't expose this class to SWIG
-            {
-                throw new Exception("The type " + typeName + " does not exist. The unmanaged pointer reported a class ID of: " + clsId);
-            }
-            else
-            {
-                object[] args = new object[] 
-                {
-                    objPtr,
-                    true /* ownMemory */
-                };
-                
-                //The constructor we require has been assigned internal visibility by SWIG. We could change it to public, but the internal
-                //visibility is the ideal one for purposes of encapulsation (this is internal use only). So instead of Activator.CreateInstance()
-                //which does not work with internal constructors, we'll find the ctor ourselves and invoke it.
-                var flags = BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance;
-                var ctors = type.GetTypeInfo().GetConstructors(flags);
-                var ctor = ctors.FirstOrDefault(ci =>
-                                {
-                                    var parms = ci.GetParameters();
-                                    if (parms.Length == 2)
-                                    {
-                                        return parms[0].ParameterType == typeof(IntPtr) &&
-                                               parms[1].ParameterType == typeof(bool);
-                                    }
-                                    return false;
-                                });
-                if (ctor == null)
-                    throw new Exception("Could not find required constructor among " + ctors.Length + " constructors with signature (IntPtr, bool) on type: " + type.Name);
-                    
-                obj = ctor.Invoke(args) as T;
-                if (obj == null)
-                    throw new Exception("Could not create an instance of type " + typeof(T).Name + " (concrete type: " + type.Name + "). The unmanaged pointer reported a class ID of: " + clsId);
-            }
-            return obj;
-        }
-    } 
-}
\ No newline at end of file

Index: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation	2020-11-10 10:05:25 UTC (rev 9761)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation	2020-11-10 10:20:15 UTC (rev 9762)

Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,3 ##
+bin
+obj
+*.cs
Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/OSGeo.MapGuide.Foundation.csproj
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/OSGeo.MapGuide.Foundation.csproj	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/OSGeo.MapGuide.Foundation.csproj	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,35 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+  <PropertyGroup>
+    <PackageId>OSGeo.MapGuide.Foundation</PackageId>
+    <TargetFramework>netstandard2.0</TargetFramework>
+    <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <Version>4.0.0.0</Version>
+    <PackageProjectUrl>https://mapguide.osgeo.org/</PackageProjectUrl>
+    <RepositoryUrl>https://mapguide.osgeo.org/</RepositoryUrl>
+    <PackageIconUrl>https://mapguide.osgeo.org/</PackageIconUrl>
+    <PackageTags>MapGuide GIS Geospatial Maps</PackageTags>
+    <Authors>OSGeo</Authors>
+    <GeneratePackageOnBuild>true</GeneratePackageOnBuild>
+    <PackageLicenseExpression></PackageLicenseExpression>
+    <PackageLicenseFile>License.txt</PackageLicenseFile>
+  </PropertyGroup>
+
+  <ItemGroup>
+    <Content Include="build/**" PackagePath="%(Identity)" />
+    <Content Include="runtimes/**" PackagePath="%(Identity)" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <Compile Include="..\Common\MgClassMap.cs" Link="MgClassMap.cs" />
+  </ItemGroup>
+
+  <ItemGroup>
+    <None Include="..\..\..\..\..\License.txt">
+      <Pack>True</Pack>
+      <PackagePath></PackagePath>
+    </None>
+  </ItemGroup>
+
+</Project>

Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/ManagedException.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/ManagedException.cs	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/ManagedException.cs	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,85 @@
+//
+//  Copyright (C) 2004-2011 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+
+using System;
+
+namespace OSGeo.MapGuide
+{
+    /// <summary>
+    /// ManagedException is the exception class from which the root of unmanaged exception derive
+    /// This class, deriving from .NET Exception, allows to use the most common properties of
+    /// the Exception class on exceptions wrapping unmanaged MgException classes. The implementation
+    /// of these properties relies on the equivalent MgException methods.
+    ///
+    /// Although this class does not wrap any unmanaged class, it still holds a C++ pointer to
+    /// the MgException that derives from it.
+    /// </summary>
+    public class ManagedException : Exception
+    {
+        private bool mIsWrapper;
+        private string mMessage;
+        private string mStackTrace;
+
+        public ManagedException()
+        {
+            mIsWrapper = true;
+            mMessage = string.Empty;
+            mStackTrace = string.Empty;
+        }
+
+        public override string Message
+        {
+            get
+            {
+                return mIsWrapper ? ((MgException)this).GetExceptionMessage() : mMessage;
+            }
+        }
+
+        public override string StackTrace
+        {
+            get
+            {
+                if (mIsWrapper)
+                {
+                    //Some cosmetic cleaning of the C++ stack trace to better line up with the .net one
+                    string[] mgStackTrace = ((MgException)this).GetStackTrace().Split(new string[] { "\r\n", "\n" }, StringSplitOptions.RemoveEmptyEntries);
+                    //This currently looks like the following if we re-join:
+                    //
+                    // at- <stack frame>
+                    // at- <stack frame>
+                    // at- <stack frame>
+                    //
+                    //The "-" being a leftover, so replace "at-" with "at" as well after re-joining.
+                    //The reason we don't blindly replace "-" in the C++ stack is because we don't want to scramble any physical path
+                    //that would also contain a "-"
+                    string sanitizedStack = ("   at" + string.Join(Environment.NewLine + "   at", mgStackTrace)).Replace("at-", "at");
+                    return string.Format("{0}{1}   ==== [C++ <-> .net] ===={1}{2}", sanitizedStack, Environment.NewLine, base.StackTrace);
+                }
+                else
+                {
+                    return mStackTrace;
+                }
+            }
+        }
+
+        public override string ToString()
+        {
+            string className = this.GetType().ToString();
+            return string.Format("{0}: {1}{2}{3}", className, this.Message, Environment.NewLine, this.StackTrace);
+        }
+    }
+}

Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/MgStringCollection.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/MgStringCollection.cs	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/MgStringCollection.cs	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,35 @@
+//
+//  Copyright (C) 2004-2015 by Autodesk, Inc.
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+using System;
+using System.IO;
+using System.Reflection;
+using System.Collections.Generic;
+
+namespace OSGeo.MapGuide
+{
+    partial class MgStringCollection
+    {
+        public MgStringCollection(IEnumerable<string> strings)
+            : this()
+        {
+            foreach (var str in strings)
+            {
+                Add(str);
+            }
+        }
+    }
+}
\ No newline at end of file

Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/Streams.cs
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/Streams.cs	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/custom/Streams.cs	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1,264 @@
+//
+//  Copyright (C) 2018 Jackie Ng
+//
+//  This library is free software; you can redistribute it and/or
+//  modify it under the terms of version 2.1 of the GNU Lesser
+//  General Public License as published by the Free Software Foundation.
+//
+//  This library is distributed in the hope that it will be useful,
+//  but WITHOUT ANY WARRANTY; without even the implied warranty of
+//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+//  Lesser General Public License for more details.
+//
+//  You should have received a copy of the GNU Lesser General Public
+//  License along with this library; if not, write to the Free Software
+//  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+//
+using System;
+using System.IO;
+
+namespace OSGeo.MapGuide
+{
+    /// <summary>
+    /// A read-only, rewindable stream
+    /// </summary>
+    public abstract class ReadOnlyRewindableStream : Stream
+    {
+        /// <summary>
+        /// Resets the internal position of the stream
+        /// </summary>
+        public abstract void Rewind();
+
+        /// <summary>
+        /// Gets whether this stream supports reading
+        /// </summary>
+        public override bool CanRead
+        {
+            get { return true; }
+        }
+
+        /// <summary>
+        /// Gets whether this stream supports seeking
+        /// </summary>
+        public override bool CanSeek
+        {
+            get { return false; }
+        }
+
+        /// <summary>
+        /// Gets whether this stream supports writing
+        /// </summary>
+        public override bool CanWrite
+        {
+            get { return false; }
+        }
+
+        /// <summary>
+        /// Gets whether this stream is rewindable. If not, calls to <see cref="Rewind"/> throw a 
+        /// <see cref="T:System.InvalidOperationException"/>
+        /// </summary>
+        public abstract bool CanRewind { get; }
+
+        /// <summary>
+        /// Gets or sets the position (not implemented)
+        /// </summary>
+        public override long Position
+        {
+            get
+            {
+                throw new NotImplementedException();
+            }
+            set
+            {
+                throw new NotImplementedException();
+            }
+        }
+
+        /// <summary>
+        /// Seeks to the specified offset in the stream (not implemented)
+        /// </summary>
+        /// <param name="offset"></param>
+        /// <param name="origin"></param>
+        /// <returns></returns>
+        public override long Seek(long offset, SeekOrigin origin)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// Sets the length of the stream (not implemented)
+        /// </summary>
+        /// <param name="value"></param>
+        public override void SetLength(long value)
+        {
+            throw new NotImplementedException();
+        }
+
+        /// <summary>
+        /// Writes the specified buffer into the stream (not implemented)
+        /// </summary>
+        /// <param name="buffer"></param>
+        /// <param name="offset"></param>
+        /// <param name="count"></param>
+        public override void Write(byte[] buffer, int offset, int count)
+        {
+            throw new NotImplementedException();
+        }
+    }
+
+    /// <summary>
+    /// Represents a method that returns a <see cref="OSGeo.MapGuide.MgByteReader"/> instance
+    /// </summary>
+    /// <returns></returns>
+    public delegate MgByteReader GetByteReaderMethod();
+
+    /// <summary>
+    /// A read-only <see cref="System.IO.Stream"/> adapter for the <see cref="OSGeo.MapGuide.MgByteReader"/>
+    /// class.
+    /// </summary>
+    public class MgReadOnlyStream : ReadOnlyRewindableStream
+    {
+        private MgByteReader _reader;
+
+        /// <summary>
+        /// Creates a new instance
+        /// </summary>
+        /// <param name="method"></param>
+        public MgReadOnlyStream(GetByteReaderMethod method)
+        {
+            _reader = method();
+        }
+
+        /// <summary>
+        /// Initializes a new instance of the <see cref="MgReadOnlyStream"/> class.
+        /// </summary>
+        /// <param name="reader">The reader.</param>
+        public MgReadOnlyStream(MgByteReader reader)
+        {
+            _reader = reader;
+        }
+
+        /// <summary>
+        /// Releases unmanaged resources and performs other cleanup operations before the
+        /// <see cref="MgReadOnlyStream"/> is reclaimed by garbage collection.
+        /// </summary>
+        ~MgReadOnlyStream()
+        {
+            Dispose(false);
+        }
+
+        /// <summary>
+        /// Releases the unmanaged resources used by the <see cref="T:System.IO.Stream"/> and optionally releases the managed resources.
+        /// </summary>
+        /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
+        protected override void Dispose(bool disposing)
+        {
+            if (disposing)
+            {
+                _reader.Dispose();
+            }
+            base.Dispose(disposing);
+        }
+
+        /// <summary>
+        /// When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.
+        /// </summary>
+        /// <exception cref="T:System.IO.IOException">
+        /// An I/O error occurs.
+        ///   </exception>
+        public override void Flush()
+        {
+
+        }
+
+        /// <summary>
+        /// When overridden in a derived class, gets the length in bytes of the stream.
+        /// </summary>
+        /// <returns>
+        /// A long value representing the length of the stream in bytes.
+        ///   </returns>
+        ///   
+        /// <exception cref="T:System.NotSupportedException">
+        /// A class derived from Stream does not support seeking.
+        ///   </exception>
+        ///   
+        /// <exception cref="T:System.ObjectDisposedException">
+        /// Methods were called after the stream was closed.
+        ///   </exception>
+        public override long Length
+        {
+            //NOTE: MgByteReader only returns remaining length! Should we
+            //be keeping track of position and adding on this value?
+            get { return _reader.GetLength(); }
+        }
+
+        /// <summary>
+        /// Gets whether this stream is rewindable. If not, calls to <see cref="Rewind"/> throw a
+        /// <see cref="T:System.InvalidOperationException"/>
+        /// </summary>
+        public override bool CanRewind
+        {
+            get { return _reader.IsRewindable(); }
+        }
+
+        /// <summary>
+        /// Resets the internal position of the stream
+        /// </summary>
+        public override void Rewind()
+        {
+            if (!CanRewind)
+                throw new InvalidOperationException("Stream is not rewindable");
+
+            _reader.Rewind();
+        }
+
+        /// <summary>
+        /// When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.
+        /// </summary>
+        /// <param name="buffer">An array of bytes. When this method returns, the buffer contains the specified byte array with the values between <paramref name="offset"/> and (<paramref name="offset"/> + <paramref name="count"/> - 1) replaced by the bytes read from the current source.</param>
+        /// <param name="offset">The zero-based byte offset in <paramref name="buffer"/> at which to begin storing the data read from the current stream.</param>
+        /// <param name="count">The maximum number of bytes to be read from the current stream.</param>
+        /// <returns>
+        /// The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.
+        /// </returns>
+        /// <exception cref="T:System.ArgumentException">
+        /// The sum of <paramref name="offset"/> and <paramref name="count"/> is larger than the buffer length.
+        ///   </exception>
+        ///   
+        /// <exception cref="T:System.ArgumentNullException">
+        ///   <paramref name="buffer"/> is null.
+        ///   </exception>
+        ///   
+        /// <exception cref="T:System.ArgumentOutOfRangeException">
+        ///   <paramref name="offset"/> or <paramref name="count"/> is negative.
+        ///   </exception>
+        ///   
+        /// <exception cref="T:System.IO.IOException">
+        /// An I/O error occurs.
+        ///   </exception>
+        ///   
+        /// <exception cref="T:System.NotSupportedException">
+        /// The stream does not support reading.
+        ///   </exception>
+        ///   
+        /// <exception cref="T:System.ObjectDisposedException">
+        /// Methods were called after the stream was closed.
+        ///   </exception>
+        public override int Read(byte[] buffer, int offset, int count)
+        {
+            int read = 0;
+            //For good times, please always have the offset as 0
+            if (offset == 0)
+            {
+                read = _reader.Read(buffer, count);
+            }
+            else //So you want to play the hard way eh? Bad performance for you!
+            {
+                byte[] b = new byte[count];
+                read = _reader.Read(b, count);
+                Array.Copy(b, 0, buffer, offset, read);
+            }
+            return read;
+        }
+    }
+}
\ No newline at end of file

Index: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native	2020-11-10 10:05:25 UTC (rev 9761)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native	2020-11-10 10:20:15 UTC (rev 9762)

Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native
___________________________________________________________________
Added: svn:ignore
## -0,0 +1,2 ##
+*.dll
+*.pdb
Added: sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native/README.txt
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native/README.txt	                        (rev 0)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/DotNet/OSGeo.MapGuide.Foundation/runtimes/win-x64/native/README.txt	2020-11-10 10:20:15 UTC (rev 9762)
@@ -0,0 +1 @@
+All ummanaged libraries being P/Invoked (including their dependencies) go here
\ No newline at end of file

Index: sandbox/jng/vanilla_swig/Bindings/src/Managed/Java/org/osgeo/mapguide
===================================================================
--- sandbox/jng/vanilla_swig/Bindings/src/Managed/Java/org/osgeo/mapguide	2020-11-10 10:05:25 UTC (rev 9761)
+++ sandbox/jng/vanilla_swig/Bindings/src/Managed/Java/org/osgeo/mapguide	2020-11-10 10:20:15 UTC (rev 9762)

Property changes on: sandbox/jng/vanilla_swig/Bindings/src/Managed/Java/org/osgeo/mapguide
___________________________________________________________________
Added: svn:ignore
## -0,0 +1 ##
+*.class


More information about the mapguide-commits mailing list