5
votes

Here is a link to a sample application which reproduces the error: http://sdrv.ms/17j2Ale

I have three projects. One is a .NET 2.0 Windows Forms application (.NET App), one is a VB6 Standard EXE application (VB App), and the other is a VB6 ActiveX DLL (VB DLL). The .NET App references the VB DLL which is already registered. This VB DLL essentially launches Crystal Reports. The VB App launches the .NET App via the Shell() command. Here's what happens:

If I run the .NET App directly, I can open a Crystal Reports document with no problem. However, when the VB App launches the .NET App via the Shell() command, when the .NET App attempts to open the Crystal Reports document, I get an Out of Memory error.

Now here's the kicker - this worked on Windows XP, but when we attempt to launch it in Windows 7 64-bit, we run into this issue. I'm sure there's got to be a simple solution out there for it. Any takers?

You can jump to Update 5 where I narrowed down the problem.

Update: I also tried creating a second .NET 2.0 Windows Forms application (.NET Launcher), and launched the .NET App from it via:

Process.Start(@"C:\Path\OtherApp.exe");

and when I tried open the Crystal Reports document in the .NET App it still gave me the same Out of Memory error.

Update 2: removed due to update 4

Update 3: So today I discovered that the reason the .NET App was able to open the report when it was launched directly was because I was launching it within Visual Studio. When I tried the executable outside Visual Studio, the error returns. I noticed that Visual Studio, as of 2005, began using a vshost.exe to launch windows applications to speed up debugging startup: http://blogs.msdn.com/b/dtemp/archive/2004/08/17/215764.aspx When I disabled the vshost feature, the out of memory error returned. So I suppose the question is, what is this vshost process doing that allows it to work on windows 7?

Update 4: I was able to compile the VB6 DLL with debug information and load the source and debug information into Visual Studio and step through it when the .NET app executes the VB6 code. The Out of Memory exception comes from this line:

Dim myForm As frmTheForm

Set myForm = New frmTheForm 'OOM Error right here

So inside the vshost.exe this form is able to initialize but not without it.

Update 5: I have narrowed down the problem to the Crystal Reports ActiveX Viewer. I started a new VB ActiveX DLL project from scratch and started with only a form. This worked every which way. Then I added the Crystal ActiveX Report Viewer Library 11.5 - and the error returned! It is definitely the Report Viewer. I'm told that this problem may be able to be fixed by a simple registry adjustment.

Update 6: I used Procmon.exe from Sysinternals and generated a logfile that can be found here:

http://sdrv.ms/194aO7A

3
Are you sure all of the assemblies were built in Release mode? This question is the reverse but might be related (stackoverflow.com/questions/1723797/…). Also can you confirm that all the required dependencies are available on the Win7 machine?keyboardP
@Zach: I dont know if it is possible. Is it possible to run this application as compatible with 64 bit environment? My guess is vshost could be doing it for you, with some command line argument.shahkalpesh
I have tried running in release mode. Also I'm sure I'm targeting x86 platform. I'd really like to know what vshost does to the running environment.Zach
Which version of the Crystal Reports viewer are you using? Is it the one bundled with Visual Studio, if so which version of VS are you running?Warren Rox
The Cystl32.ocx that's registered is version 8. The library referenced in the VB6 project is Crystal ActiveX Report Viewer Library 11.5.Zach

3 Answers

1
votes

I've got such problems when I use 32Bit C/C++-Dll's with .NET code running on 64Bit Windows. If your .NET project has "any platform" as target then the runtime compiles the code to 64Bit on a 64Bit Windows, on a 32Bit Windows I think you'll have no problems.

You have to set your target platform to "x86", you wrote you did this. Please verify that all your .NET projects in your .NET solution are set to x86 as target.

The Crystal Reports *.dll should be a 32Bit COM *.dll, and the VB6 *.dll too.

1
votes

I found a workaround solution to the out-of-memory error; however, it is not an allowable solution. Apparently, this issue is resolved in future versions of the crviewer.dll but Mister Uher makes it very clear in his response to my question here: http://scn.sap.com/thread/3405856 that we are not allowed to use the versions after 11.5 due to licensing restrictions. It would seem this is a common question he receives. Unfortunately, we are forced to accept the response that we are to upgrade our applications to .NET. If anyone else is feeling adventurous enough to attempt to troubleshoot the out-of-memory exception, I would am happy to leave my sample project above available to anyone who wishes to venture it. Best of luck to anyone else feeling my pain of CR 11.5 interop support.

0
votes

Not sure if this information will help, but I have faced similar problems in the past with crystal and a Web Forms applications. I resolved it by ensuring that the application pool has the 'Enable 32 bit applications' option checked? You can find it under the advanced settings -> General....