[Mono-dev] RE: Com Interop Patch

Daniel Morgan monodanmorg at yahoo.com
Sat Jan 7 10:37:26 EST 2006


I tried it a different way this time. This works on .net 2.0 too, but not mono.
  
              IWebBrowser2 ie = new InternetExplorerClass();
              IntPtr p = IntPtr.Zero;
              object o = (object)p;
  
              ie.Navigate(@"http://www.mono-project.com",
                  ref o, ref o, ref o, ref o);
              ie.Visible = true;
  
  
  
  $ mono ConsoleApplication1.exe
  COMInteropHelpers.CreateInstance before return
  
  Unhandled Exception: System.NotImplementedException: Unsupported VARIANT type: V
  T_EMPTY
  in <0x00179> System.Variant:VariantFromObject (System.Object obj)
  in <0x00021> System.Runtime.InteropServices.Marshal:GetNativeVariantForObject (S
  ystem.Object obj, IntPtr pDstNativeVariant)
  in (wrapper managed-to-native) ie_tester.InternetExplorerClass:Navigate (string,
  object&,object&,object&,object&)
  in <0x00061> ie_tester.Program:Main (System.String[] args)
  
  

Daniel Morgan <monodanmorg at yahoo.com> wrote:  Date: Sat, 7 Jan 2006 07:23:38 -0800 (PST)
From: Daniel Morgan <monodanmorg at yahoo.com>
Subject: RE: [Mono-dev] RE: Com Interop Patch - mcs
To: "Jonathan S. Chambers" <Jonathan.Chambers at ansys.com>, 
    mono-devel-list at lists.ximian.com

  Now, I added some code to navigate to a web  page.  I built with vs.net 2005.  It runs on .net 2.0  okay.  It fails to run on Mono with your COM interop patch.
  
              IWebBrowser2 ie = new InternetExplorerClass();
              object o = null;
              ie.Navigate(@"http://www.mono-project.com",
                  ref o, ref o, ref o, ref o);
              ie.Visible = true;
  
  Here is the exception I get:
  
  $ mono ConsoleApplication1.exe
  COMInteropHelpers.CreateInstance before return
  
  Unhandled Exception: System.NullReferenceException: Object reference not set to
  an instance of an   object
  in <0x0002a> System.Variant:VariantFromObject (System.Object obj)
  in <0x00021> System.Runtime.InteropServices.Marshal:GetNativeVariantForObject (S
  ystem.Object obj, IntPtr pDstNativeVariant)
  in (wrapper managed-to-native) ie_tester.InternetExplorerClass:Navigate (string,
  object&,object&,object&,object&)
  in <0x00050> ie_tester.Program:Main (System.String[] args)
  
  What do I do?
  
  

"Jonathan S. Chambers" <Jonathan.Chambers at ansys.com> wrote:  Here is a zip of a simple program to launch ie. I defined the interface  and class in C#, so you don't need an interop assembly.

If you  want to compile the source, compile with the MS compiler. The mono  compilers appear to not work correctly. The included exe was compiled  with VS.2005, and works with both mono (with my patch) and .Net. An  .exe produced by the mono compilers doesn't run on mono or .Net. Not  sure if the issue is with my COM stuff, or the compilers.

- Jonathan


-----Original Message-----
From: Daniel Morgan [mailto:monodanmorg at yahoo.com]
Sent: Fri 1/6/2006 8:01 PM
To: Jonathan S. Chambers; mono-devel-list at lists.ximian.com
Cc: 
Subject: Re: [Mono-dev] RE: Com Interop Patch - mcs

Can you provide some examples that work on Mono?
  
"Jonathan S. Chambers"  wrote:  Here the patch for the class libs.

-----Original Message-----
From: Jonathan S. Chambers 
Sent: Friday, January 06, 2006 11:33 AM
To: mono-devel-list at lists.ximian.com
Subject: Com Interop Patch

 Here's a first attempt at a patch for COM Interop. This only
provides support for RCWs (Runtime Callable Wrappers), i.e. using
unmanaged COM components from managed code. This should support both
classes used from   Interop Assemblies (where metadata is known), as well
as bare interface pointers (with no metadata) who are wrapped using
__ComObject.

 The patch doesn't seem to introduce any regression failures, and
theoretically no code in this patch should even be hit unless you are
using COM Interop functionality.

 Just as a quick update, as much functionality as possible has
been moved to managed code (either in the Marshal or COMInteropHelpers
classes). This helps maintenance, doesn't bloat the runtime with
component specific code, removes compile time dependencies, etc. I'm
hoping for all code in the runtime to be generic component support code.
All specific component code (COM, XPCOM, Mainwin COM) will be in
managed. 

 There's lots left to do, but this provides basic functionality.
I'm sure the patch needs cleanup before commit, so please let me know
what needs   changed.

Thanks,
Jonathan

_______________________________________________
Mono-devel-list mailing list
Mono-devel-list at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/mono-devel-list



  
---------------------------------
Yahoo! Photos – Showcase holiday pictures in hardcover
 Photo Books. You design it and we’ll bind it!





    

---------------------------------
Yahoo! Photos
   Ring in the New Year with Photo Calendars. Add photos, events, holidays, whatever.


			
---------------------------------
Yahoo! Photos
 Got holiday prints? See all the ways to get quality prints in your hands ASAP.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20060107/f2f10919/attachment.html 


More information about the Mono-devel-list mailing list