none
Runtime Access Violation ONLY after GAC installation RRS feed

  • Question

  • Hi all,

    The following is probably the most obscure bug/crash I have ever witnessed in my whole life as a programmer. We've been working in a memory intensive framework using managed/unmanaged code interop for image processing, and, after an extensive testing period, figured out everything was ok for deployment.

    Since this was an internal framework product to be applied over many applications, we figured it convenient to deploy the framework assemblies to the GAC. After release, we started getting reports of memory access violations of the kind "Attempted to read or write protected memory." after long run periods.

    Apparently something appeared to be wrong with our garbage collector related routines so we got back to testing and reverifying everything. After a whole week of code verification, we came back empty handed. Nothing seemed out-of-place.

    Finally, someone from our team discovered the bizarre fact: the access violations happened ONLY when the assemblies were deployed to the global assembly cache. If the assemblies were deployed locally, the access violations did not appear, even after days of continuously running the applications.

    So basically, my question is this: Is there any runtime difference, besides assembly loading, for assemblies in the GAC? It doesn't make ANY sense that this is so, but the fact is that we've got applications which consistently and permanently keep crashing hard with GAC-installed assemblies and that run for days and days for local deployed assemblies.

    Why the enormous difference in behavior? Does the CLR handle code execution differently for GAC-assemblies in any way at all?

    Any insight on this topic, whichever small, would be enormously appreciated. Lots of debugging effort and code verification of our team has been spent at going through this and this was our only consistent find so far. As such, we turn to the forums for support.

    Best regards,

    Gonçalo

    • Edited by Kodachi Monday, September 29, 2008 1:13 PM
    Monday, September 29, 2008 1:12 PM

All replies

  • You might want to check the CLR version your assemblies are binding to in both the cases. You can use the debugger and do a "lm vm" to check this. By default, assemblies in the GAC will always bind to the runtime version they were built against.

    -sanket
    Thursday, October 9, 2008 11:32 PM