Cannot instantiate COM+ application component

G

Guest

H

We have ported our VB 6 application into VB .NET but are still integrating with a few COM + applications written in VB6 running on our application server (Win 2000 Server). We have the proxies to link to the application server installed but we every now and then get a error when we try to make a call to a component running on the app server. The error message is something like

Object reference not set to an instance of an objec

at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolen[] CopyBack

We instantiate the component in the .NET code by using the following line of code

objOMS680 = CreateObject("rppOMS.clsOMS680"

The error message is immediately displayed in the client application, but if you look at the component running within the COM+ application it just sits there spinning.

What can be the cause of this problem?

Regard
Carel Lotz
 
Y

Yan-Hong Huang[MSFT]

Hello Carel,

Thanks for posting in the group.

Based on my understanding, now the issue is: You ported VB6 application to
VB.NET. But VB.NET application is still communicating with a few COM+
applications writtenin VB6 runnong on Win2000 Server. The error message is:

Object reference not set to an instance of an object
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolen[]
CopyBack)

The code that caused error is:
objOMS680 = CreateObject("rppOMS.clsOMS680")

Please correct me if I have anything misunderstood.

Currently I am finding somebody who could help you on it. We will follow up
here with more information. At the same time, could you please provide the
following information:

1) Which version of .NET framework are you running in that VB.NET
application machine?

2) Which version of VS.NET are you using? VS.NET 2002 or VS.NET 2003?

3) Which OS are you running on for that VB.NET application? Service Pack
version?

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
 
J

John Eikanger [MSFT]

HI, Carel

I've created an escallation for this issue and routed it to the COM+ team.
The site where most of the COM+ team works is closed today due to icy
conditions, so there may be a delay in getting you a response. If you wish
to contact me directly, just remove "online." from my alias and it should
get to me.

Thank you for choosing the MSDN Managed Newsgroups,

John Eikanger
Microsoft Developer Support

This posting is provided “AS IS” with no warranties, and confers no rights.
--------------------
| Thread-Topic: Cannot instantiate COM+ application component
| thread-index: AcPkDo48c+MAgfYER/mNl83BT5sblg==
| X-Tomcat-NG: microsoft.public.dotnet.general
| From: "=?Utf-8?B?Q2FyZWwgTG90eg==?=" <[email protected]>
| Subject: Cannot instantiate COM+ application component
| Date: Mon, 26 Jan 2004 05:16:06 -0800
| Lines: 18
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Hi

We have ported our VB 6 application into VB .NET but are still integrating
with a few COM + applications written in VB6 running on our application
server (Win 2000 Server). We have the proxies to link to the application
server installed but we every now and then get a error when we try to make
a call to a component running on the app server. The error message is
something like:

Object reference not set to an instance of an object

at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolen[]
CopyBack)

We instantiate the component in the .NET code by using the following line
of code:

objOMS680 = CreateObject("rppOMS.clsOMS680")

The error message is immediately displayed in the client application, but
if you look at the component running within the COM+ application it just
sits there spinning.

What can be the cause of this problem??

Regards
Carel Lotz
|
 
G

Guest

H

1) .NET v1.
2) VS 200
3) Client machines we get the problem on all platforms i.e. Win98 SE, WinME, Win NT4.0 SP 6a, Win 2000, Win XP Home, Win XP Prof SP 1. Server is running Win 2000 Server SP

Care

----- Yan-Hong Huang[MSFT] wrote: ----

Hello Carel

Thanks for posting in the group

Based on my understanding, now the issue is: You ported VB6 application to
VB.NET. But VB.NET application is still communicating with a few COM+
applications writtenin VB6 runnong on Win2000 Server. The error message is

Object reference not set to an instance of an objec
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o,
Type objType, String name, Object[] args, String[] paramnames, Boolen[]
CopyBack

The code that caused error is
objOMS680 = CreateObject("rppOMS.clsOMS680"

Please correct me if I have anything misunderstood

Currently I am finding somebody who could help you on it. We will follow up
here with more information. At the same time, could you please provide the
following information

1) Which version of .NET framework are you running in that VB.NET
application machine

2) Which version of VS.NET are you using? VS.NET 2002 or VS.NET 2003

3) Which OS are you running on for that VB.NET application? Service Pack
version

Thanks very much

Best regards
Yanhong Huan
Microsoft Community Suppor

Get Secure! ¨C www.microsoft.com/securit
This posting is provided "AS IS" with no warranties, and confers no rights
 
G

Guest

Hi Matt

The server installation is brand new. I'll try re-installing and re-creating the proxies, but I doubt whether this will solve the problem. Remember, we get calls through to the component running on the server successfully. It is only after a few calls that the component stops responding and the client application receives the error message mentioned. I then need to shut down the COM+ application on the server whereafter everything works again ... only for a while though.

As to adding a reference to it from VS .NET - we do not want to do this as we want to use late binding to call the proxy. The component that calls the proxy is shared between different user roles in our application and not every role is allowed to call the proxy. By using late binding, we can therefore distribute the component to the unauthorized users without having to distribute the proxy as well - worked fine in the VB6 only solution. Authorized users get the proxy via a Role Manager application that is installed afterwards.

Carel

----- Matt Ozdemir wrote: -----

First of all, delete rppOMS COM+ package and unregister all rppOMS DLLs from the server if there are any. I recommend rebooting your server to clear the memory. Then create a new proxy installation package. Afterwards install the proxy using the proxy installation package. Add reference to it from VS.NET. Rebuild your application.
 
R

Rob Maushardt

Hi Carel,

I read the posts on this thread. I understand that you have a VB6 COM+
Component called from a VB.NET client EXE located on a different machine.
At times, you receive an error message stating that an object reference is
not set to an instance of the object.

Unfortunately, this error message is somewhat generic, but from one of your
posts, it seems that you recover from the failing state by restarting the
COM+ Server Application. If that is correct, then you would need to
troubleshoot the COM+ Server Application. It may be hanging. If you are
familiar with using the Debugging Tools for Windows, you can attach the
debugger and investigate the cause of the error. If you are not familiar
with using the debuggers, you can create a process dump and open a case
with Microsoft PSS for dump analysis.

Before doing that, let's confirm a few things.

When the problem happens, does it affect all clients at once, or just one
(or a few)? If it happens to affect all users, then the COM+ Server App
has a problem. If it affects just one person at a time, then we may need
to look into networking issues.

You stated that when the client receives the error, the COM+ App just
spins. Is this a high CPU situation, or is this DLLHost.EXE process idle?
You can check the CPU utilization in TaskManager, but you may have several
DLLHost.EXE processes running. To identify the particular one, you can use
the Component Services MMC, select the COM+ Applications folder on the
left-hand side, and select View menu / Status View. This will display the
PID (Process ID) for each Server App on the right-hand side. You can then
cross-reference the PID to those in TaskMgr. If PID is not displayed in
TaskMgr, you can select View menu / Select columns... and tick the box for
PID.

When the client receives the error message, can you do a CreateObject from
a VBScript on the COM+ Server? You can test this with code like this:
Dim o
Set o = CreateObject("rppOMS.clsOMS680")

(just paste into Notepad, and save as C:\Test.VBS, then run that from a
CMD.EXE prompt)

Can you also post the exact Exception, including all inner exceptions (if
any), and the stack trace from the client? That may help identify other
potential causes for this error.


Cheers,
Rob


Rob Maushardt
Microsoft Distributed Services


This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
| Thread-Topic: Cannot instantiate COM+ application component
| thread-index: AcPlbTObGUKptnzlTKqE9o8/oADPMQ==
| X-Tomcat-NG: microsoft.public.dotnet.general
| From: "=?Utf-8?B?Q2FyZWwgTG90eg==?=" <[email protected]>
| References: <[email protected]>
<0#[email protected]>
| Subject: RE: Cannot instantiate COM+ application component
| Date: Tue, 27 Jan 2004 23:06:07 -0800
| Lines: 50
| Message-ID: <[email protected]>
| MIME-Version: 1.0
| Content-Type: text/plain;
| charset="Utf-8"
| Content-Transfer-Encoding: 8bit
| X-Newsreader: Microsoft CDO for Windows 2000
| Content-Class: urn:content-classes:message
| Importance: normal
| Priority: normal
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
| Newsgroups: microsoft.public.dotnet.general
| Path: cpmsftngxa07.phx.gbl
| Xref: cpmsftngxa07.phx.gbl microsoft.public.dotnet.general:122874
| NNTP-Posting-Host: tk2msftcmty1.phx.gbl 10.40.1.180
| X-Tomcat-NG: microsoft.public.dotnet.general
|
| Hi

1) .NET v1.1
2) VS 2003
3) Client machines we get the problem on all platforms i.e. Win98 SE,
WinME, Win NT4.0 SP 6a, Win 2000, Win XP Home, Win XP Prof SP 1. Server
is running Win 2000 Server SP 4

Carel

----- Yan-Hong Huang[MSFT] wrote: -----

Hello Carel,

Thanks for posting in the group.

Based on my understanding, now the issue is: You ported VB6
application to
VB.NET. But VB.NET application is still communicating with a few COM+
applications writtenin VB6 runnong on Win2000 Server. The error
message is:

Object reference not set to an instance of an object
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object
o,
Type objType, String name, Object[] args, String[] paramnames,
Boolen[]
CopyBack)

The code that caused error is:
objOMS680 = CreateObject("rppOMS.clsOMS680")

Please correct me if I have anything misunderstood.

Currently I am finding somebody who could help you on it. We will
follow up
here with more information. At the same time, could you please provide
the
following information:

1) Which version of .NET framework are you running in that VB.NET
application machine?

2) Which version of VS.NET are you using? VS.NET 2002 or VS.NET 2003?

3) Which OS are you running on for that VB.NET application? Service
Pack
version?

Thanks very much.

Best regards,
Yanhong Huang
Microsoft Community Support

Get Secure! ¨C www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no
rights.


|
 
G

Guest

Hi Ro

1) Yes, when the problem occurs, it affects all clients at once
2) No, it is not a CPU utilization issue as the process is not using any CPU tim
3) Yes, I can successfully run the VB script file as you mentioned. I can do a CreateObject within the vbs file, but as soon as I try to call a method of the object I get the erro
4) Complete .NET exception details [there is no inner exception set]

?ex.ToStrin
"System.NullReferenceException: Object reference not set to an instance of an object
at Microsoft.VisualBasic.CompilerServices.LateBinding.LateGet(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack
at ConsoleOMS.TestOMS.CallOMS() in C:\Development\VS .NET\VB\ConsoleOMS\TestOMS.vb:line 46

I got the above mentioned error by writing a simple .NET app (ConsoleOMS) that instantiates the object and tries to call a method on the object

One or two other observations
When using the test app, I saw that the component sat spinning in the COM+ explorer until I physically closed the app (thus ending the client process). I would have thought that this would happen as soon as the instance variable goes out of scope. Because these are still VB6 components, there is no Dispose available for me to call on the instance variable. The result is that if I run 5 instances of the test app concurrently, I get 5 activated instances within the COM+ explorer. This does not seem to be a problem though as they activated instances eventually timeout on the server. Should I be concerned about this

Another thing that I've noticed is the problem sometimes occurs more regularly if the client application receives an exception in between calls to the component running on the App server, i.e. the user would make a successful call to the component, receive an exception which it successfully dealt with by the app and on the next call to the application server you get the exception I've mentioned

Hope this help

Carel
 
R

Rob Maushardt

Thanks for the clarifications, Carel.

The behaviour you see where the COM+ Components remain activated in COM+
until the client process ends suggests that the managed heap still holds
the reference to the RCW (Runtime Callable Wrapper) for the COM component.
This in turn means that the COM Component's ref count has not decreased to
zero, so COM+ keeps it around. When the client process ends, these
left-over components will be cleaned up.

If this is indeed what is happening, you should call the static (or shared
in VB.NET) Marshal.ReleaseComObject() method before the client-side
variable goes out of scope. Failing to call ReleaseComObject can result in
exceptions when the CLR tries to GC the managed reference to the unmanaged
object, and other errors. Here's an example of the call:

Dim simpleCOMPlusComponent As New SimpleCOMDLL.SimpleCOMClass
Console.WriteLine(simpleCOMPlusComponent.WhatTimeIsIt())
Marshal.ReleaseComObject(simpleCOMPlusComponent)
simpleCOMPlusComponent = Nothing

You will need to import the System.Runtime.InteropServices namespace if you
don't have it already, or prefix that to the Marshal type name.

Here's a link to the MSDN documentation on this call (the URL may wrap in
the news readers):
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/
frlrfSystemRuntimeInteropServicesMarshalClassReleaseComObjectTopic.asp


Rob Maushardt
Microsoft Distributed Services


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