Native Thread in Managed Code calling Managed thread method...NullReferenceException!!! RRS feed

  • General discussion

  • I have a Managed C++ class that in the constructor takes a C# business object.  The managed C++ class wraps a Native C++ class that wraps a native C++ library that starts a Native thread that then has call backs into the Native C++ class, which then creates a Business Object (defined in C#), and passes that to the Managed C++ class which then fires an event

    However when the event is fired I get a NullReferenceException!!!

    In summary I'm trying to pass a Business object (defined in C#) but constructed in a Native C++ thread and class through a Managed C++ object event.  Is this possible, or will it only work on managed threads?  Is there a way for me to marshal the object from the native thread to the managed thread? 

    Sorry this question was so long.
    Tuesday, May 6, 2008 6:14 PM

All replies

  • Sorry this question was so short, you give us absolutely nothing to go by.  Look around the forums at this site and see what it takes to ask a question that invites an answer.  Practice the "code snippet" feature of the post editor too.
    Wednesday, May 7, 2008 12:41 AM
  • We are changing the issue type to “Comment” because you have not followed up with the necessary information. If you have more time to look at the issue and provide more information, please feel free to change the issue type back to “Question” by editing your initial post and changing the radio button at the top of the post editor window. If the issue is resolved, we will appreciate it if you can share the solution so that the answer can be found and used by other community members having similar questions.


    Thank you!


    Monday, May 12, 2008 4:18 AM