?
Solved

VB6 Application crashes with an Access violation - code c0000005 after calling >Net Com Interop Lib which open, reads and close OleDBConnection

Posted on 2014-01-05
11
Medium Priority
?
1,802 Views
Last Modified: 2014-02-02
My Company have an application build in VB6, which I have been updating for a few years. All new changes are mostly in the way of C# Com Interop Libraries, so eventually porting the main App to .Net will be easier.
We are preparing a big release, which we are out of schedule. The main problem we are experiencing is that the application crashes in testing  PCs, but not in my development one, which is a Windows XP Pro SP3.

The crashing happens calling a method of one of the COM Interop libraries, which is written in C# and built for .Net 4.0. The method call is below:
    ' Create and set preloaded list object
Private Sub LoadPreLoadList(PreloadCategoryID As Integer, NoEnteringOffSiteHours As Boolean)
    Dim intI As Integer
    Dim lngCharPos As Long
    Dim strPreloadName As String
    Dim curPreldItemData As Long
    Dim blnComboHasBeenCleared As Boolean
    Dim PreloadListObj As PreloadedList
    Dim RFIDUserObj As RFIDUser
    Set PreloadListObj = New PreloadedList
    
    Set PreloadListObj.DBProperties = GetDBPreloadListProperties()
    blnComboHasBeenCleared = False   
    
    ' Retrieve provided preloaded category
    ' ==> The next line is causing the Access violation
    If PreloadListObj.LoadPreloadedNamesList(PreloadCategoryID) Then
     ==> execution do not pass to this point <==

' Other process ...
End Sub

Open in new window

The LoadPreLoadList() procedure is called from another procedure while loading the form. Before calling LoadPreLoadList() , other COM interop objects are created and methods are called without problem, which also use an OleDBConnection (open, reading and closing it).

One interesting thing is that if a call LoadPreLoadList(), from a button in the form, the operation is clear, no crash.

I'm attaching the WinDbG files for the crashing system and the one from my developmenten PC, which is working without problems.

We have tested in Windows 7 and Windows XP, with same results.
Debug-CrashApp.txt
Debug-DevelopPC.txt
0
Comment
Question by:IdentAKid
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +1
11 Comments
 
LVL 35

Expert Comment

by:sarabande
ID: 39758848
you should install the vs2008 redistributables at the client pc's. this package is free and can be downloaded from msdn.

'access violation' is pointer error. that means one of the dll's, your application was loading, tries to use an object where the pointer is (address) is invalid. that is most likely be due to a missing dll, I would guess a com add-on for ms office.

note, the vb6 you were using doesn't need these vc.net enhancements but you seem to invoke common components which do.

porting the app to .net probably would also help as your new setup would add the redistributable components.

Sara
0
 
LVL 46

Expert Comment

by:aikimark
ID: 39758945
Is .Net 4 installed on the crashing PC?
0
 

Author Comment

by:IdentAKid
ID: 39759254
@Sara, do you mean installing VC++ 2008? If so, the answer is yes, our installer has that package as pre-requisite, so it is installed.
After posting here yesterday, we were able to make the app running in one of our testing VMs by installing different versions of VC+++ (2005, 2008 - like three versions of this,, and 2010).

Although, we haven't been able to make it work in a different VM. On top of that, the VM where the app worked yesterday is not working today (same problem).

@aikimark, yes .Net 4 is installed by the installer (if not present).
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 46

Expert Comment

by:aikimark
ID: 39759470
You might have to reregister the interop
C:\windows\microsoft.net\Framework\v4.0.xxxxx\regasm.exe

You will need to navigate to the version-specific directory of your .Net framework on your XP box.
0
 
LVL 35

Expert Comment

by:sarabande
ID: 39759532
do you mean installing VC++ 2008?
I only meant the redistributable package of vs2008. in your logfilet the error occurs after loading

C:\Program Files\Common Files\Microsoft Shared\office14\Cultures\office.odf

Open in new window


and the dll which was not loaded successfully was

C:\Windows\WinSxS\x86_microsoft.vc90.mfc_1fc8b3b9a1e18e3b_9.0.30729.4148_none_4bf5400abf9d60b7\mfc90.dll

Open in new window


'WinSxS' means Windows site by site and is a folder which contains (mostly) references to files residing in other folders like system32 or syswow64. mfc90.dll is the mfc dll for vs2008. if it fails to load, some of its references cannot be loaded. that could be references to former or current msvc dll's (vs2002, vs2003, vs2005, vs2008) or the corresponding .net packages where those dlls rely on. if you installed vs2008 on a computer all those packages were part of the setup. for a client computer, you normally will have the packages installed as there are many programs which would need them. however, on some older systems which were not updated on a regular base you may need to add one or more of these packages.

Sara
0
 

Author Comment

by:IdentAKid
ID: 39759552
@aikimark, thanks for your interest and yes the installer is registering all interop libraries. As I mentioned before we got the app running at one point, although it failed again and we think it has to be with VC++ redistributable.
0
 

Author Comment

by:IdentAKid
ID: 39759588
@Sara, thanks also for your interest in our problem, just to clarify, my VB6 development PC has Visual Studio 2005 (vs2005) installed only. I have developed the .Net 4 libraries in a different PC (Windows 7 Enterprise x64) using Visual Studio 2010 (vs2010) and after compiling the libraries, I moved and register them in my XP Development PC (where VB6 is installed).

Now, the XP machine has Visual C++ 2005 Redistributable (vc++ 2005) installed, as well as vc++ 2008 (as I mentioned before a couple of different versions).

We made the application work again, after reinstalling vc++ 2008 and restarting Windows but after closing the application and reopening, it failed again.
0
 

Accepted Solution

by:
IdentAKid earned 0 total points
ID: 39759775
We finally found out what the problem is: we are using a third party component, which is causing the problem. It is an .ocx control, which uses vc++ 2008. Once we remove the component and all references the application runs fine.
Weird thing is that the component has worked without problem in previous versions, and in the current one our customers are using.

Thank you all for taking time to response.
0
 
LVL 49

Expert Comment

by:Martin Liss
ID: 39827475
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
Code that checks the QuickBooks schema table for non-updateable fields and then disables those controls on a form so users don't try to update them.
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses
Course of the Month12 days, 2 hours left to enroll

752 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