Merge pull request #2573 from BrzVlad/fix-conc-memusage
[mono.git] / mcs / class / corlib / System / __ComObject.cs
index def04b29e5ad51e84bfaa99f0956a9189b96aa38..18f0c43ec49761d5097b6a32b97c2910c4031816 100644 (file)
@@ -32,6 +32,7 @@
 // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 //
 
+#if !FULL_AOT_RUNTIME
 using Mono.Interop;
 using System.Collections;
 using System.Runtime.InteropServices;
@@ -51,6 +52,7 @@ namespace System
        // many times that obj.GetType().FullName == "System.__ComObject" and
        // Type.GetType("System.__ComObject") may be used.
 
+       [StructLayout (LayoutKind.Sequential)]
        internal class __ComObject : MarshalByRefObject
        {
 #pragma warning disable 169    
@@ -98,6 +100,8 @@ namespace System
                        // Guard multiple invocation.
                        if (iunknown != IntPtr.Zero)
                                return;
+
+                       System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (t.TypeHandle);
                        
                        ObjectCreationDelegate ocd = ExtensibleClassFactory.GetObjectCreationCallback (t);
                        if (ocd != null) {
@@ -226,3 +230,4 @@ namespace System
                        out IntPtr pUnk);
        }
 }
+#endif