473,503 Members | 1,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.InvalidCastException: QueryInterface for interface ... erro

A VB.NET 2003 application accesses a custom VB 6 DLL. It has run successfully
several months, and has been modified without problem a few times during that
period. Recently another set of changes were made to both the VB.NET code and
the DLL. The new version was successfully installed on our production server,
and ran without problem for 2 weeks until a scheduled reboot of the server
occurred. Since the reboot, the application always fails with the following
exception messages whenever the DLL is accessed. As far as can be
ascertained, no patches or further changes were applied either to the
application or to the server between installing the application and the
subsequent reboot.

The DLL in question is CmCalclib2.DLL, and PIACE.BaCPM.Compressor is defined
in VB.NET code.

Error: ---System.InvalidCastException: QueryInterface for interface
CmCalclib2._Compressor failed.
at CmCalclib2.CompressorClass.set_Config(CMCompressor )
at PIACE.BaCPM.Compressor.InitialiseCompressor()
--- End of inner exception stack trace ---
at PIACE.BaCPM.Compressor.InitialiseCompressor()
at PIACE.BaCPM.Compressor.ACECalculations()

The program still runs successfully on a development server under the
debugger. There do not appear to be any security issues to prevent the DLL
being executed by the application (and in any case, no configuration changes
were made when the server was rebooted).
Dec 18 '07 #1
9 2132
Sounds like one problem with two symptoms. I would bet on someone
breaking compatibility in CmCalclib2.dll two weeks (or more) earlier,
but it did not become evident on the server until the reboot because
the old version was cached.

Check your new CmCalclib2.dll interface GUIDs, make sure they match
the old version. If they don't, go back and recompile CmCalclib2.dll
with binary compatibility and redeploy, reboot.

If you don't care about maintaining compatibility, (no other
application is using CmCalclib2.dll), just unreference and rereference
CmCalclib2.dll in your VB.NET project references.
Dec 18 '07 #2
You are right - the change to CmCalclib2.dll did break binary compatibility.
The application in question is the only application to use it. I have already
unreferenced and rereferenced the DLL and rebuilt and reregistered the DLL,
and rebuilt and reinstalled the VB.NET project, more than once in an attempt
to fix it, but it hasn't helped. (The production server has not been rebooted
again - but you don't appear to say that rebooting is necessary if
compatibility doesn't have to be maintained.)
Dec 18 '07 #3
D,

Option strict is set to on in the top of your code?

Cor

"D Jarvie" <ja***@newsgroup.nospamschreef in bericht
news:19**********************************@microsof t.com...
>A VB.NET 2003 application accesses a custom VB 6 DLL. It has run
successfully
several months, and has been modified without problem a few times during
that
period. Recently another set of changes were made to both the VB.NET code
and
the DLL. The new version was successfully installed on our production
server,
and ran without problem for 2 weeks until a scheduled reboot of the server
occurred. Since the reboot, the application always fails with the
following
exception messages whenever the DLL is accessed. As far as can be
ascertained, no patches or further changes were applied either to the
application or to the server between installing the application and the
subsequent reboot.

The DLL in question is CmCalclib2.DLL, and PIACE.BaCPM.Compressor is
defined
in VB.NET code.

Error: ---System.InvalidCastException: QueryInterface for interface
CmCalclib2._Compressor failed.
at CmCalclib2.CompressorClass.set_Config(CMCompressor )
at PIACE.BaCPM.Compressor.InitialiseCompressor()
--- End of inner exception stack trace ---
at PIACE.BaCPM.Compressor.InitialiseCompressor()
at PIACE.BaCPM.Compressor.ACECalculations()

The program still runs successfully on a development server under the
debugger. There do not appear to be any security issues to prevent the DLL
being executed by the application (and in any case, no configuration
changes
were made when the server was rebooted).
Dec 18 '07 #4
Option Strict is set to on. I also saw some comments on the internet about
turning it off, so I tried that as well, but it didn't help.
Dec 18 '07 #5
D,

That it does succesful run in the debugger does not mean that everything is
correct.

Did you already set the references again to be sure that you are actually
pointing to the same DLL/s

Cor

Dec 19 '07 #6
It would need to be rebooted, for the same reason the problem did not
show up for 2 weeks after your changes. The previous CmCalclib2.dll
is still in cache despite you copying a new version to the server.

On Tue, 18 Dec 2007 09:36:09 -0800, D Jarvie <ja***@newsgroup.nospam>
wrote:
>You are right - the change to CmCalclib2.dll did break binary compatibility.
The application in question is the only application to use it. I have already
unreferenced and rereferenced the DLL and rebuilt and reregistered the DLL,
and rebuilt and reinstalled the VB.NET project, more than once in an attempt
to fix it, but it hasn't helped. (The production server has not been rebooted
again - but you don't appear to say that rebooting is necessary if
compatibility doesn't have to be maintained.)
Dec 19 '07 #7
Hi,

You may also check the interop assembly (generated by Visual Studio when
you add reference to a COM component and copied to your output directory),
it contains the interface ID of your COM component. You can use Reflector
(http://www.aisto.com/roeder/dotnet/) to open it and check if the GUIDs are
correct. You can use Oleview to view your VB6 COM component to determine
correct GUIDs.

Regards,
Walter Wang (wa****@online.microsoft.com, remove 'online.')
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.

Dec 19 '07 #8
"Grok" wrote:
It would need to be rebooted, for the same reason the problem did not
show up for 2 weeks after your changes. The previous CmCalclib2.dll
is still in cache despite you copying a new version to the server.
Is there no way to update the cache other than rebooting? Rebooting the
production server has implications for other processes, and is not something
which can be done lightly.
Dec 19 '07 #9
Yes. You need to unload the process which loaded CmCalclib2.dll.

You can use Process Explorer from SysInternals to locate which process
has it loaded. If as you say only one process uses it, just exit
that. If that one process is a website on IIS5 or IIS6, and your IIS
is configured for separate application spaces, simply unload that
website. I think you're out of luck if it's IIS4, you'll have to stop
IIS and restart. But server does not require rebooting.

In any event, End Process will do the trick in Process Explorer. Once
the process using CmCalclib2.dll is unloaded, you can start it back up
and it should grab the new, correctly-referenced version.

On Wed, 19 Dec 2007 03:23:02 -0800, D Jarvie <ja***@newsgroup.nospam>
wrote:
>"Grok" wrote:
>It would need to be rebooted, for the same reason the problem did not
show up for 2 weeks after your changes. The previous CmCalclib2.dll
is still in cache despite you copying a new version to the server.

Is there no way to update the cache other than rebooting? Rebooting the
production server has implications for other processes, and is not something
which can be done lightly.
Dec 19 '07 #10

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

Similar topics

1
4507
by: Peter Sparago | last post by:
I am working with the MSHTML editor control. I used win32com.client.gencache.EnsureModule on the MSHTML type library to generate the necessary IDispatch support for all the various interfaces used...
0
417
by: Jason | last post by:
I'm writing a small console app in .NET that needs to reference a 3rd party dll. I wrote the app by adding a reference to the 3rd party dll in my project and my code builds and executes...
7
4700
by: Julien | last post by:
Hi !!! I hav a problem when I try to initialize my workbook (opening or creation) in my windows form... I got the Exception 'System.InvalidCastException' : QueryInterface for interface...
4
4889
by: Ram | last post by:
I am running a test web site on my own Win2k professional computer. I have a VB6 COM component (running on COM+) on a seperate application runnint as "Server". When running an ASP.NET page calling...
0
1084
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...
1
1314
by: adiel_g | last post by:
Hello, I have created a activeX dll in vb6 that contains some functions I am using in .NET. I created the dll in vb6 with: Instancing = 5-Multiuse MTSTransactionMode = 2-RequiresTransaction...
2
4702
by: Michael | last post by:
Hello all and thanks in advance, I'm running a vb.net program and part of it copies files from one server to another. It generally works fine but once in a while I get this error: ...
5
1467
by: Geoff Kell (Lockdesign Ltd) | last post by:
I have just started using VB.Net and I am developing a class to provide data to clients from an IBM-MQ queue. I have developed a class which connects to the queue and issues a read. When a...
6
4062
by: Mark Rae | last post by:
Hi, I'm in the process of updating an ASP.NET v1.1 web app to v2. The app uses ActiveDirectory a great deal, and I'm trying to use the new System.Collections.Generic namespace where possible,...
0
7203
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,...
0
7281
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,...
0
7334
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6993
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...
0
7462
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...
1
5014
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...
0
3168
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
383
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.