BUG: VB.NET compiler crashes itself or the IDE, when referencing C# DLL
Building any of various trivial VB programs from the command line with a
refernce to my DLL produces the 0xC0000005 error from the compiler (which
looks like the hex value of Access Violation to me!).
When built in the DevStudio IDE, the compile stage may do any of:
a) go off but not return , but can be stopped with the End Build command
b) crash with a stick-up
c) crash the entire IDE, triggering a "send this bug to Microsoft?" stickup.
Actually "running" the VB program is out of the question - the IDE is so
sick I can't properly edit as auto-complete and incremental compilation
crash with every edit; and the Form Designer is stuffed as it has no
resource file to work with, as the compiler never gets so far as to
re-generate it. (I keep cleaning out the obj folders to give the thing a
chance to start again - sometimes it helps).
The DLL "bin\MGDS_Net.dll" is my own, coded in C#. C# programs compiled
against it build fine (and run fine, too!). Removing the DLL reference lets
the compile run properly, although understandably it is only to generate
compilation errors since the required classes and functions are not
defined...
G:\My Documents\Visual Studio Projects\SampleVB>vbc /verbose form1.vb
/reference:bin\MGDS_Net.dll,c:\winnt\Microsoft.NET\Framework\v
1.0.3705\System.Windows.Forms.dll,c:\winnt\Microsoft.NET\Framework\v1.0.3705
\System.dll /target:winexe
Microsoft (R) Visual Basic .NET Compiler version 7.00.9466
for Microsoft (R) .NET Framework version 1.00.3705.209
Copyright (C) Microsoft Corporation 1987-2001. All rights reserved.
Adding file 'G:\My Documents\Visual Studio Projects\SampleVB\Form1.vb'
Adding assembly reference 'G:\My Documents\Visual Studio
Projects\SampleVB\bin\MGDS_Net.dll'
Adding assembly reference
'c:\winnt\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll'
Adding assembly reference
'c:\winnt\Microsoft.NET\Framework\v1.0.3705\System.dll'
Compiling...
Loading C:\WINNT\Microsoft.NET\Framework\v1.0.3705\mscorlib.dll.
Loading
C:\WINNT\Microsoft.NET\Framework\v1.0.3705\Microsoft.VisualBasic.dll.
Loading G:\My Documents\Visual Studio Projects\SampleVB\bin\MGDS_Net.dll.
Loading c:\winnt\Microsoft.NET\Framework\v1.0.3705\System.Windows.Forms.dll.
Loading c:\winnt\Microsoft.NET\Framework\v1.0.3705\System.dll.
vbc : Command line error BC2010 : compilation failed : '0xC0000005'
Compilation failed: 1 error
It appears it may be affected by the sheer number of functions in the DLL...
The DLL defines approx 800 private static extern functions calling on into a
C DLL, and the same number of C# public static interludes which turn error
codes into thrown exceptions, and massage argument types. If I cut out
almost all the functions then VB.NET will compile against the DLL; as I
re-introduce them, VB.NET re-builds start to hang, then crash, then
(sometimes) crash the IDE, as the number of functions increase.
The worst problems come with the full DLL with all its functions, structs
and enums.
[There was an early stage when I just had the basic static extern functions
with no interludes, no nice error trapping, no enums etc, which *did* build
and run fine, but it was like using VB6 with a sprinkling of .NET sugar...
ick!]
We're using Win 2000 SP2, Dell 4100 (Piii/866) with 512MB memory and plenty
of free disk, on machines with VC6 and DevStudio 7 (VC7, VB.NET, C#)
installed side-by-side. [We don't have VB6 on the machines I'm developing
on.]
If it helps, I can supply the built DLL (approx 100KB) or even the C# source
of the DLL as it's only trival interludes... But I am stumped, along with
the rest of us here.