Help! "ecall methods must be packaged into a system module"

KAMAZON

Golden Member
Apr 4, 2001
1,300
0
76
www.alirazeghi.com
http://msdn.microsoft.com/msdn...otes.htm#RemotingError

What the heck is MS telling me to do here? Any suggestions on how I can implement this? We cannot have people RDP and run sql2005 enterprise manager. =(


'ECall methods must be packaged into a system module' Error When Using System.Runtime.Remoting
(Thanks to Jim Klopfenstein and Peter Drayton for pointing out this issue and testing the fix.)

An incorrect error may occur when running applications that use System.Runtime.Remoting.

The error that occurs is:

!"ECall methods must be packaged into a system module,
such as MSCOREE.DLL"

The problem is due to a section of code in ecall.cpp that was inadvertently removed from the beta refresh of the SSCLI.

The solution to this problem is to download a new version of the file ecall.cpp from

http://download.microsoft.com/...a2/wxp/en-us/ecall.tgz

Copy the downloaded file over the existing file in the sscli\clr\src\vm directory and rebuild.

Here is some sample code (from http://radio.weblogs.com/0105476/2002/06/03.html#a63) that will demonstrate the problem. This problem should not occur once the ecall.cpp file has been replaced and the entire SSCLI rebuilt.

Declare an interface in file echoif.cs:

public interface IEcho
{
void repeatAfterMe(string s);
}

Implement a server in file server.cs:

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
public class Echo : MarshalByRefObject, IEcho
{
public Echo()
{
Console.WriteLine("Echo constructed");
}
public void repeatAfterMe(string s)
{
Console.WriteLine("Repeating... {0}",s);
}
}
public class MyServer
{
public static int Main(string[] args)
{
HttpChannel chan = new HttpChannel(1234);
ChannelServices.RegisterChannel(chan);
RemotingConfiguration.RegisterWellKnownServiceType(
typeof(Echo),"myecho",WellKnownObjectMode.Singleton);
System.Console.WriteLine("Hit to exit...");
System.Console.ReadLine();
return 0;
}
}
Implement a client in file client.cs:

using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Http;
public class Client
{
public static int Main(string [] args)
{
HttpChannel chan = new HttpChannel(998);
ChannelServices.RegisterChannel(chan);
Object obj = RemotingServices.Connect(
typeof(IEcho),"http://localhost:1234/myecho");
try
{
((IEcho)obj).repeatAfterMe("Hi there");
}
catch (System.Exception e)
{
Console.WriteLine("Failed to connect to or call server");
Console.WriteLine(e.Message);
}
return 0;
}
}
Compile the sample:

csc /t:library echoif.cs
csc /r:echoif.dll /r:System.Runtime.Remoting.dll server.cs
csc /r:echoif.dll /r:System.Runtime.Remoting.dll client.cs

Problems With Build Environment on Microsoft Windows
If you are experiencing general problems building on Windows there may be problems with the environment. When documenting these problems it is good to include a dump of the environment variables from a SSCLI build console after running env.bat.

Some things to look out for:

Make sure that COMSPEC environment variable points to cmd.exe in the Windows system32 directory. For example, if COMSPEC points to command.com then you are running in a 16-bit command console and will experience issues with environment size limitations among many other problems.
Make sure your path isn't unnecessarily long. For example, if your path already includes the Visual Studio .NET binary directories before running env.bat then you will have them in your path twice. There have been reported cases of unusual build behavior when the path environment variable becomes too long. If you experience odd errors like 'cl is not recognized as an internal or external command' then shorten your path to the minimum (location of perl.exe, Windows, and Windows\system32) and then run env.bat.