473,769 Members | 5,724 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem Invoking a .net dll (Class Library - com+)

Hi,

I am developing a .NET application which will invoke the methods from
different COM / .NET DLLs. While invoking methods from .NET DLLs, I am
encountering the following error. I have also included the detail of the
error stack trace and the code that I have written to invoking the methods.

I would appreciate if you could let me know the cause of this error and
possible workarounds to avoid this situation.

Error Message
-------------

Cannot load type OrchServerSync. ASrvrSync, OrchServerSync, Version=3.0.6.0 ,
Culture=neutral , PublicKeyToken= 5552a996b9dd0e5 d.

Error StackTrace
----------------

at System.Runtime. Remoting.Remoti ngServices.GetO rCreateProxy(Id entity idObj,
Object proxy, Boolean fRefine)\r\n at
System.Runtime. Remoting.Remoti ngServices.Inte rnalUnmarshal(O bjRef objectRef,
Object proxy, Boolean fRefine)\r\n at
System.Runtime. Remoting.Remoti ngServices.Unma rshal(ObjRef objectRef)\r\n
at
System.Enterpri seServices.Serv icedComponentPr oxyAttribute.Cr eateInstance(Ty pe
serverType)\r\n at
System.Runtime. Remoting.Activa tion.Activation Services.IsCurr entContextOK(Ty pe
serverType, Object[] props, Boolean bNewObj)\r\n at
System.RuntimeT ype.CreateInsta nceImpl(Boolean publicOnly)\r\n at
System.Activato r.CreateInstanc e(Type type, Boolean nonPublic)\r\n at
System.Activato r.CreateInstanc e(Type type)
Code used for Invoking:
----------------------

object retObj = null;

Type Obj = Type.GetTypeFro mProgID(sClassN ame);

object ObjMsp = Activator.Creat eInstance(Obj);

retObj = Obj.InvokeMembe r(sMethodName, BindingFlags.In vokeMethod, null,
ObjMsp, null);

System.Runtime. InteropServices .Marshal.Releas eComObject(ObjM sp);

Thanks in advance
Dhandapani
Jun 5 '06 #1
2 1959
Hi Dhandapani,

Thank you for your post!

After reviewing the problem description, I am not clear on some points.
Could you please help me on the following questions so that we can work
more closely?
1) Is the COM component exposed from .NET?
2) Is the component a COM+ component deployed in remote COM+ explorer?
3) From your posted stack trace, it seems the exception is thrown from the
call to Activator.Creat eInstance(), which means the Type info is retrieved
successfully. Maybe you could Add Watch on the Type instance to see whether
or not the assembly is located correctly.

If there is any something you would like to add, please feel free to reply
here. I am happy to work with you on this.

Regards,
Walter Wang
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.

Jun 6 '06 #2
Hi Praveen,

Based on my understanding, the question is:
1) You are building a ServicedCompone nt using Visual Studio 2003
2) You deployed it as a Server application in COM+ explorer
3) You are calling it using C# client with following code:

Type Obj = Type.GetTypeFro mProgID(sClassN ame);
object ObjMsp = Activator.Creat eInstance(Obj);

and get "Cannot load type" exception while calling "CreateInstance ".

If I've misunderstood anything, please feel free to post here.

Based on my research, for Type.GetTypeFro mProgID, if you don't provide
additional ServerName parameter, it's loading the type locally. Since a
COM+ server application runs in its own process, we must provide a
ServerName parameter to Type.GetTypeFro mProgID to force it load the type
remotely with the Com Callable Wrapper (CCW). You can inspect the loaded
Type instance while debugging:

1) When not providing the ServerName parameter, the loaded assembly is the
locally installed one with the actual type
2) When providing the ServerName parameter, the loaded assembly is
mscorlib.dll, which is the actual COM implementation of all .NET exposed
components.

Actually, the recommended way to call a ServicedCompone nt built with .NET
from a .NET client is to reference the assembly and call with early-bind
rather than late-bind.

Hope this helps. Please feel free to post here if anything is unclear.


Regards,
Walter Wang
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.

Jun 12 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
6181
by: Patrick | last post by:
Following earlier discussions about invoking a .NET class library via ..NET-COM Interop (using regasm /tlb) at http://groups.google.com/groups?hl=en&lr=&threadm=%23Van7eSrEHA.4004%40TK2MSFTNGP10.phx.gbl&rnum=1&prev=/groups%3Fhl%3Den%26lr%3D%26selm%3D%2523Van7eSrEHA.4004%2540TK2MSFTNGP10.phx.gbl I have concluded that my .NET class library (following the suggestions. namely setting the marshall type, etc.) , I can 1) Invoke public methods...
1
1686
by: TheOne | last post by:
I have two classes: class OntologyParser { ... protected: virtual void startElement(void *userData, const char *name, const char **atts); virtual void endElement(void *userData, const char *name);
1
1674
by: Andrea | last post by:
I was trying to deserialize my xml file (I enclose it below ) into a class. So I generated an xsd file given my xml using the MS xsd tool; then I generated the corresponsing C# class (using the MS xsd tool): the UserSecurityData class. When I try to execute my app to deserialize my xml file, my application crashes causing a strange FileNotFoundException when invoking the XmlSerializer constructor (second line of my code fragment). Is there...
0
1111
by: Michal | last post by:
Hi. I've been searching all over the internet, and I didn't find solution of my problem :( I hope someone can help me here... The problem is: Im writing a library in C# (COM Library). This library will be used by an application, which is wrote in VB6. I will call it "MainApp".
0
1337
by: graciezzzzz | last post by:
Hi all, I create a Web Service project called 'eSelectService' and another Class Library project called 'MonerisVO', and a Windows Form project called 'maps' as well. The reason why I need the Class Library project is because I don't want to pass more than 30 parameters when I try to invoke the Web Method. I used the class in Class Library as a value object to contain all the information I need.
22
2778
by: ypjofficial | last post by:
Is there any possibility of invoking the member functions of a class without creating an object (or even a pointer to ) of that class. eg. #include <iostream.h> class test { public: void fun() {
4
1734
by: ma740988 | last post by:
Trying to build on something I picked up from a Scott Meyers. Consider: class BaseMenuItem { public: virtual void invoke() const = 0; }; template<class Class, class MemFuncPtr, class Param>
2
1616
by: gwoodhouse | last post by:
Hello all, I have an application at the moment which uses forms. The main form (which has ALOT of things going on it in) also happens to do alot of network proccess's which ive put in Threads. DUring refactoring i decided i wanted to seperate as much non-form related logical from the main page as i could. I created a new static class, thinking i could call a "ThreadStart" method which, when it needs to access form elements, drops into...
2
1221
by: Bob.Sidebotham | last post by:
If I run the following code: class path(object): def __init__(self, **subdirs): for name, path in subdirs.iteritems(): def getpath(): return path setattr(self, name, getpath) export = path(
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10211
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8870
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6673
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3561
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.