HighTechTalks DotNet Forums  

J# interop design flaw?

Dotnet VJSharp microsoft.public.dotnet.vjsharp


Discuss J# interop design flaw? in the Dotnet VJSharp forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Ulf Werner
 
Posts: n/a

Default J# interop design flaw? - 10-31-2003 , 09:03 AM






Being in the process of migrating to J# a rather big J++
distributed application with J++ code both on clients and
as COM+ components I have run into the following problem:

In J++ a JActiveX generated interface with a
com.ms.com.Variant argument would be COM-marshalled as the
COM type VARIANT. In J# using the same interface the
argument will be marshalled to COM directly as
com.ms.com.Variant. When using J# on both sides, this
seems to be funtionally equivalent as long as methods are
called In Process. However, when calling Out of Process
the remoting framework tries to serialize
com.ms.com.Variant and throws

System.Runtime.Serialization.SerializationExceptio n:
The type com.ms.com.Variant in Assembly vjslib,
Version=1.0.5000.0, Culture=neutral,
PublicKeyToken=b03f5f7f11d50a3a is not marked as
serializable.

This makes it impossible to call a J# assembly with a
method with Variant arguments installed as a Server
component in COM+. At least as long as you call from a
client J# assembly with the same JActiveX generated
interface.

Is this a design flaw or is there some way to get around
this? A simple solution would have been to let the
com.ms.com.Variant class be serializable. The same
reasoning goes for com.ms.com.SafeArray.

The only way I see around this (except for rewriting large
amounts of legacy code which J# was intended to save me
from!) is to use RealProxy and intercept all method calls
to the server. Variant and SafeArray arguments could be
wrapped in a serializable class and all arguments could be
marshalled over to a Dispatcher class on the server which
could unwrap Variants and SafeArrays and then invoke the
method In Process. But should this really be neccessary?

Any advice is welcome.

/Ulf Werner



Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: J# interop design flaw? - 11-03-2003 , 04:34 PM






Ulf,

Can you please describe the actual COM object you are calling? Is it
written in Java or C++? Can you share the interface declaration so I can
get a better idea of what is going on?

Thanks,

Thanks,

Michael Green
Microsoft Developer Support

This posting is provided "AS IS" with no warranties, and confers no rights.
Please reply to newsgroups only.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.