Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. COM
  4. AccessViolationException on Vista if not run in debugger?! [modified]

AccessViolationException on Vista if not run in debugger?! [modified]

Scheduled Pinned Locked Moved COM
comdebuggingquestioncsharpvisual-studio
6 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    mav northwind
    wrote on last edited by
    #1

    Hi! I'm using a COM DLL from a third party to access some hardware. The main application is written in C# and I can create the object and use it on XP without problems using an interop assembly created with tlbimp. When I try the same on Vista SP1, I get an AccessViolationException on the first method call into the COM object. The really weird thing is: The COM DLL only crashes when I call my application outside of VS, i.e. when I'm not trying to debug it. When stepping through the code in VS (2005 SP1), everything works as on Windows XP! Running the same executable from the debug directory crashes... Can anyone explain this behaviour or tell me where to look next? Thanks in advance! Update: The DLL also crashes in VS when I turn off the VS host process or when I first start the application and attach the debugger. So the big question is: What exactly does this VS host process do to keep the DLL from crashing?

    Regards, mav -- Black holes are the places where God divided by 0...

    modified on Tuesday, August 19, 2008 7:05 AM

    L 1 Reply Last reply
    0
    • M mav northwind

      Hi! I'm using a COM DLL from a third party to access some hardware. The main application is written in C# and I can create the object and use it on XP without problems using an interop assembly created with tlbimp. When I try the same on Vista SP1, I get an AccessViolationException on the first method call into the COM object. The really weird thing is: The COM DLL only crashes when I call my application outside of VS, i.e. when I'm not trying to debug it. When stepping through the code in VS (2005 SP1), everything works as on Windows XP! Running the same executable from the debug directory crashes... Can anyone explain this behaviour or tell me where to look next? Thanks in advance! Update: The DLL also crashes in VS when I turn off the VS host process or when I first start the application and attach the debugger. So the big question is: What exactly does this VS host process do to keep the DLL from crashing?

      Regards, mav -- Black holes are the places where God divided by 0...

      modified on Tuesday, August 19, 2008 7:05 AM

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Just a guess - Does the COM DLL depend on any external files? If yes, ensure these file are located in the correct directory.

      Sohail

      M 1 Reply Last reply
      0
      • L Lost User

        Just a guess - Does the COM DLL depend on any external files? If yes, ensure these file are located in the correct directory.

        Sohail

        M Offline
        M Offline
        mav northwind
        wrote on last edited by
        #3

        Hi! Thanks for your reply, but I think that doesn't explain the behaviour. The DLL in question doesn't have any "unusual" dependencies and it does work on XP and when run inside VS...

        Regards, mav -- Black holes are the places where God divided by 0...

        L 1 Reply Last reply
        0
        • M mav northwind

          Hi! Thanks for your reply, but I think that doesn't explain the behaviour. The DLL in question doesn't have any "unusual" dependencies and it does work on XP and when run inside VS...

          Regards, mav -- Black holes are the places where God divided by 0...

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          Well once we had this problem when a colleague was using a 3rd party DLL in a .NET project using Interop. Hence I said I am guessing. To find the cause of your problem, more details would be required.

          Sohail

          M 1 Reply Last reply
          0
          • L Lost User

            Well once we had this problem when a colleague was using a 3rd party DLL in a .NET project using Interop. Hence I said I am guessing. To find the cause of your problem, more details would be required.

            Sohail

            M Offline
            M Offline
            mav northwind
            wrote on last edited by
            #5

            Hi Sohail! Just wanted to inform you (and everybody else interested) that the problem indeed was inside the 3rd-party dll. They used ATL from VS2003 for their component and this caused a problem with Vista's DEP (an explanation can be found here[^] Turning off DEP made the problem go away. Jeez - how do people find out these things?:confused:

            Regards, mav -- Black holes are the places where God divided by 0...

            L 1 Reply Last reply
            0
            • M mav northwind

              Hi Sohail! Just wanted to inform you (and everybody else interested) that the problem indeed was inside the 3rd-party dll. They used ATL from VS2003 for their component and this caused a problem with Vista's DEP (an explanation can be found here[^] Turning off DEP made the problem go away. Jeez - how do people find out these things?:confused:

              Regards, mav -- Black holes are the places where God divided by 0...

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              I have marked your reply as helpful answer. Might help someone in future. These problems are quite tricky. It's nice to hear that you are able to identify the cause. Cheers,

              Sohail

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups