Solved

How do I diagnose and fix .Net Framework and/or COM interop issues?

Posted on 2007-12-03
4
601 Views
Last Modified: 2013-11-26
I have created a .Net dll that I call from VB6.  This works on most computers.  Some customers get the following error:
Run-time error '429'  ActiveX component can't create object.

To try to debug this, I create a simple VB6 app and a simple VB6 dll and simple .Net dll and I think the problem is with the .Net framework.  I uninstalled and reinstalled the framework (2.0) and on some users' machines that worked.  On several others, it doesn't work.  

The simple test I created just has a VB6 form with a two command buttons.  The code in the command buttons instantiate the VB6 dll or the .Net dll object and calls a function that simply displays a message box.  I figured it doesn't get any easier than that.  

On the machines that fail, when I click on the button that uses the .Net object, I get the dreaded 'Run-time error '429'  ActiveX component can't create object' error message.  
I created a simple VB dotNet (VS2005) class library that I called SimpleTest.  On the compile tab of the property page, I have checked the Register for COM interop option.  Here is the code:
 

<ComClass()> _

Public Class InteropTest

    Public Function ShowDialog() As Boolean

        MsgBox("Hello from .Net 2.0!")

    End Function

End Class
 

I then create a simple VB6 ActiveX dll called SimpleVB6.  Here is the code:

Public Function ShowDialog() As Boolean

    MsgBox ("Hello from VB6!")

End Function
 

I then created a simple VB6 Standard EXE application and set references to both SimpleTest (the dotNet dll) and SimpleVB6 (VB6 dll).  I put two command buttons on the form and added the following code:

Private Sub Command1_Click()

    Dim st As SimpleTest.InteropTest

    Set st = New SimpleTest.InteropTest

    st.ShowDialog
 

End Sub
 

Private Sub Command2_Click()

    Dim st As SimpleVB6Test

    Set st = New SimpleVB6Test

    st.ShowDialog

End Sub

Open in new window

0
Comment
Question by:DalexSupport
4 Comments
 
LVL 1

Expert Comment

by:wizengamot
ID: 20400001
I would check out the security for managed code between the two machines.  The applet you are looking for is in control panel --> administrative tools --> .NET Framework 2.0 Configuration.  The place I would concentrate my energies in comparing would be under My Computer (within the applet)  and the section entitled Runtime Security Policy.

I hope this helps.  This is the only thing I can think of that would make your DLL work or not work and a reinstall of the framework fixes it on some computers.  This means there is Nothing wrong with your DLL and everything that could be wrong is in the configuration of the framework
0
 

Accepted Solution

by:
DalexSupport earned 0 total points
ID: 20415847
.NET Framework 2.0 Configuration doesn't appear there.  

I have done some additional digging in one of my customer's computer and found that the 1.0 Framework seems to be the problem.  This computer is running the Tablet edition of Windows XP.  I found a tool at http://blogs.msdn.com/astebner/archive/2005/04/08/406671.aspx that is disigned to remove any .Net framework version. However, this tool would not remove the 1.0 framework because it said it was required by the Table Edition of the operating system (as well as the Media Center Edition).  

The only way I can get the the 2.0 framework to function is to uninstall all frameworks, reboot in safe mode and then delete the following files/folders:
C:\WINDOWS\Microsoft.NET\Framework
C:\WINDOWS\system32\mscoree.dll
C:\WINDOWS\system32\mscorier.dll
C:\WINDOWS\system32\mscories.dll

Then reboot normally and install the 2.0 framework and my app and all is well.

Am I doing anything here that can prevent other apps from running?
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20555478
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now