Callbacks from .NET 1.1 process to .NET 2.0


G

Guest

Is it possible to call a .NET 2.0 delegate from an event in a .NET 1.1
process? We have a class compiled with Framework 1.1 that has a public
Event called 'Error.' That class is instantiated in a separate
process and made available to our Framework 2.0 process via
Remoting. A class in the 2.0 process hooks up to the 1.1 event.

When Visual Studio steps through the code in the 2.0 process, it
shows Error as always being non-null, and hooked up to the proper
delegate. However, the .NET 1.1 process always claims that the Error
event is null, and thus cannot call it.

I assume that this is a result of the difficulties of calling events
in unknown assemblies (the 2.0 app references the 1.1 assembly, but
not vice versa because 1.1 apps are seemingly unable to reference 2.0
assemblies). During remoting instantiation, the TypeFilter.Full
property is set.

What manner can be used to let 1.1 callbacks receive 2.0 delegates?
 
Ad

Advertisements

J

Jeffrey Tan[MSFT]

Hi dbooksta,

Thanks for your post!

Based on my knowledge and testing, in VS.net2003, we can not reference
..Net2.0 assembly. While .Net remoting requires both client and service
reference the assembly containing remoting class. Can you show me some
detail information regarding how do you do remoting between .Net1.1 and
..Net2.0? Do you place the remoting class in a .Net1.1 assembly, so that
both client and server can reference it without any problem?

For efficiency's sake, is it possible for you to provide a sample project
to demonstrate the problem? Then we can troubleshoot it efficiently.

I look forward to your feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
G

Guest

I have posted a minimal sample solution demonstrating the problem at
http://204.9.191.76/NailYale/RemoteSample.zip

This is all VS2005; we are using MSBee to force the remote process to run
under .NET 1.1. (See the Readme.txt for info on where to get that plug-in).

Is this sufficient to see and help with this problem?
 
J

Jeffrey Tan

Hi Dave,

Thanks for your feedback.

I will perform some test and research on your sample project. I will update
you ASAP. Thanks.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Dave,

Yes, I can reproduce out this problem now. I will spend some more time on
analysising it. Thanks for your patient.

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

Jeffrey Tan[MSFT]

Hi Dave,

I am still contacting US support team for coworking on this issue, is it
possible for you to send an email to (e-mail address removed)(remove
"online.")? We will work with you more efficiently. Thanks!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Ad

Advertisements

G

Guest

Solution finally found! It turns out I was not doing the Remoting correctly.

First of all, the remoted class has to inherit from MarshalByRefObject.

Second of all, for the callback to be possible the remoting has to be done
across a TcpChannel with both a Client and Server Sink Provider, like the
following:

BinaryServerFormatterSinkProvider serverProv = new
BinaryServerFormatterSinkProvider();
BinaryClientFormatterSinkProvider clientProv = new
BinaryClientFormatterSinkProvider();
serverProv.TypeFilterLevel =
System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
IDictionary props = new Hashtable();
props["port"] = 2555;
TcpChannel channel = new TcpChannel(props, clientProv,
serverProv);
ChannelServices.RegisterChannel(channel);
 
Ad

Advertisements

J

Jeffrey Tan[MSFT]

Hi Dave,

Thanks for your the solution information!

MarshalByRefObject is a basic point, it seems that we both missed it :-(.

Again, thank you sharing the solution with the community!

Best regards,
Jeffrey Tan
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top