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

I have the following regular expression : I figured out most of the part
Of course most languages have library functions for this, but suppose I want to
I have the following script, which is working for the most part Link to
I'm attempting to implement this paper . I've have most of it down, but
I have created a VB.NET 2008 Class Library that has, for the most part,
On my team we have a logging standard, and for the most part the
I am not familiar with various XML formatting I have recieved XML document most
This is part of an iPhone application but should apply to Cocoa written in
I am in the training of web developement.I have seen in most of the
Encoding issues are among the one topic that have bitten me most often during

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.