Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 271237
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T00:07:47+00:00 2026-05-12T00:07:47+00:00

I have for the most part successfully embedded firefox/xulrunner into our c# application, but

  • 0

I have for the most part successfully embedded firefox/xulrunner into our c# application, but it is not without troubles. Once in a great while a AccessViolationException will be thrown which I believe is caused by the GC moving a managed object in memory and the unmanaged xpcom attempts to use it after it has been moved. For example I created a protocol handler for a custom protocol that implements some interfaces that firefox/xulrunner calls upon. After doing that, the AccessViolationException’s became much more predominate. I looked into GCHandle.Alloc(object, GCHandleType.Pinned) as a possible solution, but couldn’t find enough information on how to write a custom marshaller to make my class that implemented the interfaces “blittable”. So does anyone have any ideas on how to deal with this problem or how to translate my class into a “blittable” one? Also its near impossible to track down what parts of the interop are causing the AccessViolationException. Ugh 🙁

Thanks for any insight!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T00:07:47+00:00Added an answer on May 12, 2026 at 12:07 am

    I believe I have an answer to this through the means of another question I asked "does GetComInterfaceForObject pin the object?". Basically what I believe is the AccessViolationExceptions where being generated by an object going out of scope in the .net side, if my understanding is correct the unmanaged reference will not keep a managed object alive. So any managed object that I create that needs to be around for an extended period of time so the unmanaged code can call upon it, is now stored in either a field or a list. Also on the side of a "blittable" object, I haven’t found a way to pin a class, but I did manage to figure out how to pin a struct that implemented an interface. The interface was an interop interface that had MarshalAs attributes defined, which allowed the conversion to unmanaged code, therefore apparently allowing the object to be pinned. Not sure if this is possible with a class implementation as I still received errors even though it was implemented in the same exact manner as the struct.

    🙂

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

well i have most probably an extremly stupid problem but could not figure it
I have a simple grammar that works for the most part, but at one
I have a GUI application with a lot of controlles. The most part of
I have some code that needs Unicode strings for the most part, but I
I have this query running. For the most part it works ok, but there
I have mastered for the most part taking my designs and coding them as
I have the following script, which is working for the most part Link to
EDIT Sorry I forgot the most important part here. Each key can have more
I have the following regular expression : I figured out most of the part
I have part objects and material objects. Each part has at most 1 material

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.