C# and VB6 Debugging

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Usman

    #1

    C# and VB6 Debugging

    Hi,

    I have a simple visual basic 6 program that calls a function in a class
    written in C# assembly. Running executeable directly gives me no
    problem, debugging VB6 program is also working fine. However, when I
    try to debug C# assembly with VB6 program, VB6 program simply crashes
    upon trying to create C# class object. I am attaching the VB6 and C#
    sources for reference,

    [C#]

    using System;
    using System.Windows. Forms;
    namespace UsmanCSharp
    {
    /// <summary>
    /// Summary description for Class1.
    /// </summary>
    public class Class1
    {
    public Class1()
    {
    //
    // TODO: Add constructor logic here
    //
    }

    public void ShowMessage()
    {
    MessageBox.Show ("Hello");
    }
    }
    }

    AssemblyInfo.cs ====>

    [assembly: AssemblyDelaySi gn(false)]
    [assembly: AssemblyKeyFile ("")]
    [assembly: AssemblyKeyName ("")]
    [assembly: ClassInterface( ClassInterfaceT ype.AutoDual)]
    [assembly: ComVisible(true )]

    [VB6 Program]

    Private Sub Command1_Click( )
    Dim a As UsmanCSharp.Cla ss1

    Set a = New UsmanCSharp.Cla ss1

    a.ShowMessage

    End Sub

    I have a machine running WinXP SP2 with VS.NET 2003(.NET Framework
    v1.1.4322 and v 2.0.50727) and Microsft Visual Studio 6.0 (SP6)
    installed. I registered C# assembly by RegAsm using following command,

    regasm /tlb /codebase UsmanCSharp.dll

    I had everything working fine till I got this new machine and debugging
    in VS.NET stopped working. Any ideas what might be going on?

    Thanks,
    Usman

  • Frank Rizzo

    #2
    Re: C# and VB6 Debugging

    This article might be of help.




    Usman wrote:[color=blue]
    > Hi,
    >
    > I have a simple visual basic 6 program that calls a function in a class
    > written in C# assembly. Running executeable directly gives me no
    > problem, debugging VB6 program is also working fine. However, when I
    > try to debug C# assembly with VB6 program, VB6 program simply crashes
    > upon trying to create C# class object. I am attaching the VB6 and C#
    > sources for reference,
    >
    > [C#]
    >
    > using System;
    > using System.Windows. Forms;
    > namespace UsmanCSharp
    > {
    > /// <summary>
    > /// Summary description for Class1.
    > /// </summary>
    > public class Class1
    > {
    > public Class1()
    > {
    > //
    > // TODO: Add constructor logic here
    > //
    > }
    >
    > public void ShowMessage()
    > {
    > MessageBox.Show ("Hello");
    > }
    > }
    > }
    >
    > AssemblyInfo.cs ====>
    >
    > [assembly: AssemblyDelaySi gn(false)]
    > [assembly: AssemblyKeyFile ("")]
    > [assembly: AssemblyKeyName ("")]
    > [assembly: ClassInterface( ClassInterfaceT ype.AutoDual)]
    > [assembly: ComVisible(true )]
    >
    > [VB6 Program]
    >
    > Private Sub Command1_Click( )
    > Dim a As UsmanCSharp.Cla ss1
    >
    > Set a = New UsmanCSharp.Cla ss1
    >
    > a.ShowMessage
    >
    > End Sub
    >
    > I have a machine running WinXP SP2 with VS.NET 2003(.NET Framework
    > v1.1.4322 and v 2.0.50727) and Microsft Visual Studio 6.0 (SP6)
    > installed. I registered C# assembly by RegAsm using following command,
    >
    > regasm /tlb /codebase UsmanCSharp.dll
    >
    > I had everything working fine till I got this new machine and debugging
    > in VS.NET stopped working. Any ideas what might be going on?
    >
    > Thanks,
    > Usman
    >[/color]

    Comment

    Working...