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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Problem using COM dll

Problem using COM dll

Scheduled Pinned Locked Moved C#
helpcsharpcomvisual-studioperformance
3 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.
  • S Offline
    S Offline
    shezh
    wrote on last edited by
    #1

    Hello, I'm using a third party COM dll, which I've referenced in my C# project. However, when I call a certain function in it, it throws an error message saying "The instruction at 0x10153c89 referenced memory at 0x0751629c. The memory could not be 'read'" and then the application terminates. Is this most likely to be an error in the COM dll, or does anyone else have any other ideas on what the problem may be? When Visual Studio generates the interop assembly for the COM dll and places it in your build output directory, how does it 'route' the function calls to the actual COM dll it wraps, or is this information contained within the interop assembly itself? Thanks for your time and help Shehzad

    J 1 Reply Last reply
    0
    • S shezh

      Hello, I'm using a third party COM dll, which I've referenced in my C# project. However, when I call a certain function in it, it throws an error message saying "The instruction at 0x10153c89 referenced memory at 0x0751629c. The memory could not be 'read'" and then the application terminates. Is this most likely to be an error in the COM dll, or does anyone else have any other ideas on what the problem may be? When Visual Studio generates the interop assembly for the COM dll and places it in your build output directory, how does it 'route' the function calls to the actual COM dll it wraps, or is this information contained within the interop assembly itself? Thanks for your time and help Shehzad

      J Offline
      J Offline
      Judah Gabriel Himango
      wrote on last edited by
      #2

      cheeze103 wrote:

      When Visual Studio generates the interop assembly for the COM dll and places it in your build output directory, how does it 'route' the function calls to the actual COM dll it wraps, or is this information contained within the interop assembly itself?

      The COM interop assembly contains the globally unique identifier (GUID) of COM object it's calling. The CLR will marshal the data between managed and unmanaged appropriately (sometimes with hints from code, such as the MarshalAsAttribute). As far as the error, there's no way that we can know. Can you show us the function signature (both native COM and .NET wrapper) for that function that's causing the error?

      Tech, life, family, faith: Give me a visit. I'm currently blogging about: Is Jesus the Jewish Messiah? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

      S 1 Reply Last reply
      0
      • J Judah Gabriel Himango

        cheeze103 wrote:

        When Visual Studio generates the interop assembly for the COM dll and places it in your build output directory, how does it 'route' the function calls to the actual COM dll it wraps, or is this information contained within the interop assembly itself?

        The COM interop assembly contains the globally unique identifier (GUID) of COM object it's calling. The CLR will marshal the data between managed and unmanaged appropriately (sometimes with hints from code, such as the MarshalAsAttribute). As far as the error, there's no way that we can know. Can you show us the function signature (both native COM and .NET wrapper) for that function that's causing the error?

        Tech, life, family, faith: Give me a visit. I'm currently blogging about: Is Jesus the Jewish Messiah? The apostle Paul, modernly speaking: Epistles of Paul Judah Himango

        S Offline
        S Offline
        shezh
        wrote on last edited by
        #3

        blockquote class="FQ">

        Judah Himango wrote:

        As far as the error, there's no way that we can know. Can you show us the function signature (both native COM and .NET wrapper) for that function that's causing the error? Sure: in 'original COM dll' (shown in VB6): Public Sub ConnectProjectEx(_ByVal DomainName As String,_ByVal ProjectName As String,_ByVal UserName As String,_ByVal UserName As String,_Optional ByVal Password As String = " "_) and in the interop wrapper (using ildasm): .method public hidebysig newslot virtual instance void ConnectProjectEx([in] string marshal( bstr) DomainName, [in] string marshal( bstr) ProjectName, [in] string marshal( bstr) UserName, [in][opt] string marshal( bstr) Password) runtime managed internalcall When I pass to this function an invalid username or password, it actually throws an exception, saying 'The user so and so does not exist'. However, when I give it a correct user, it throws the application error I mentioned before - it seems that it gets further in the dll function, and then fails, and since I can't see the actual code in the COM dll (since it's third party), I don't know what to do! Thanks for your help. Shehzad

        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