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. C#
  4. Getting UNMANAGED stack trace in C#

Getting UNMANAGED stack trace in C#

Scheduled Pinned Locked Moved C#
csharpc++comdata-structures
3 Posts 3 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.
  • F Offline
    F Offline
    Fayu
    wrote on last edited by
    #1

    Is it possible to get UNMANAGED stack trace in c#. Here is what I am trying to do: I have a COM written in c#. I have VB6/C++ code calling this COM component. In the COM component, I want to be able to find out who called the COM function(s). I have tried using the System.Diagnostics.StackTrace class, but that seems to only return MANAGED stack traces. For Example: COM Interface/Implementation

    [Guid(###)]
    [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
    public interface ISkel
    {
    [DispId(1)]
    void DoSomething(int id);
    }

    [Guid(###)]
    [ClassInterface(ClassInterfaceType.None)]
    public class Skel : ISkel
    {
    public void DoSomething(int id)
    {
    ...
    }
    }

    VB (VBProject Name = VBProject1)

    Private Sub Command1_Click()
    dim s as new Skel
    s.DoSomething(1)
    End Sub

    From the C# code, I want to get a value indication that the calling project (VBProject1) and the method (Command1_Click()) Any ideas/suggestions? Thanks in advance.

    D A 2 Replies Last reply
    0
    • F Fayu

      Is it possible to get UNMANAGED stack trace in c#. Here is what I am trying to do: I have a COM written in c#. I have VB6/C++ code calling this COM component. In the COM component, I want to be able to find out who called the COM function(s). I have tried using the System.Diagnostics.StackTrace class, but that seems to only return MANAGED stack traces. For Example: COM Interface/Implementation

      [Guid(###)]
      [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
      public interface ISkel
      {
      [DispId(1)]
      void DoSomething(int id);
      }

      [Guid(###)]
      [ClassInterface(ClassInterfaceType.None)]
      public class Skel : ISkel
      {
      public void DoSomething(int id)
      {
      ...
      }
      }

      VB (VBProject Name = VBProject1)

      Private Sub Command1_Click()
      dim s as new Skel
      s.DoSomething(1)
      End Sub

      From the C# code, I want to get a value indication that the calling project (VBProject1) and the method (Command1_Click()) Any ideas/suggestions? Thanks in advance.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      AFAICT, the StackTrace will only work with managed calls. I can't find any method of getting the unmanaged stack trace from managed code.

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
           2006, 2007, 2008
      But no longer in 2009...

      1 Reply Last reply
      0
      • F Fayu

        Is it possible to get UNMANAGED stack trace in c#. Here is what I am trying to do: I have a COM written in c#. I have VB6/C++ code calling this COM component. In the COM component, I want to be able to find out who called the COM function(s). I have tried using the System.Diagnostics.StackTrace class, but that seems to only return MANAGED stack traces. For Example: COM Interface/Implementation

        [Guid(###)]
        [InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
        public interface ISkel
        {
        [DispId(1)]
        void DoSomething(int id);
        }

        [Guid(###)]
        [ClassInterface(ClassInterfaceType.None)]
        public class Skel : ISkel
        {
        public void DoSomething(int id)
        {
        ...
        }
        }

        VB (VBProject Name = VBProject1)

        Private Sub Command1_Click()
        dim s as new Skel
        s.DoSomething(1)
        End Sub

        From the C# code, I want to get a value indication that the calling project (VBProject1) and the method (Command1_Click()) Any ideas/suggestions? Thanks in advance.

        A Offline
        A Offline
        Abhinav S
        wrote on last edited by
        #3

        You cannot view unmanaged code in the stack trace - you could use the disassembly window, however.

        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