.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Access Violation in .NET 4 Runtime in gc_heap::garbage_collect with no unmanaged modules

Posted By:      Posted Date: September 22, 2010    Points: 0   Category :.NET Framework

Hi all,

We are experiencing an access violation in the .NET 4.0 runtime, in a piece of code that uses NHibernate heavily. None of our own code interops with native code directly, nor does the 3rd party code we are using (to the best of our knowledge). We cannot identify the memory pattern that is appears to be corrupting the GC heap, and we don't know whether the problem is in the GC itself or in some other piece of code that is corrupting it.

I've included below the stack trace of the offending thread, and the list of loaded modules.

We need some help debugging this issue. What should we do next?

Adam Smith
Director, Technology
Hubbard One
Thomson Reuters


0:000> !EEStack
Thread   0
Current frame: clr!WKS::gc_heap::find_first_object+0x64
ChildEBP RetAddr  Caller, Callee
0012bf30 791fa5b8 clr!WKS::gc_heap::mark_through_cards_for_segments+0x116, calling clr!WKS::gc_heap::find_card
0012bf38 791fa618 clr!WKS::gc_heap::mark_through_cards_for_segments+0x563, calling clr!WKS::gc_heap::find_first_object
0012bfc4 791faaa1 clr!WKS::gc_heap::relocate_phase+0x5b, calling clr!WKS::gc_heap::mark_through_cards_for_segments
0012c000 791f7a52 clr!WKS::gc_heap::plan_phase+0x851, calling clr!W

View Complete Post

More Related Resource Links

access violation in gc_heap::mark_object_simple


My windows service is crashing in production, seemingly randomly.  It's a 32-bit .NET Framework 3.5 app, running as a service on a Windows Server 2003 machine.  My client has sent me a few crash dumps generated using ADPlus.  Windbg shows the following stack trace for the exception:

ChildEBP RetAddr  Args to Child             
0709fef0 79f7b47e 089b972c 090ae514 006c7f94 mscorwks!WKS::gc_heap::mark_object_simple1+0x148
0709ff1c 79f472d5 03d13a70 00000000 79f769cf mscorwks!WKS::gc_heap::mark_object_simple+0x2b4
0709ff50 79f46d81 00000002 00000000 00000000 mscorwks!WKS::gc_heap::c_drain_mark_list+0x95
0709ff7c 79f47773 7a3b9010 7a3b9028 0709ffb0 mscorwks!WKS::gc_heap::c_mark_phase+0xaa
0709ff98 79f82425 00000000 00000000 00000000 mscorwks!WKS::gc_heap::gc1+0x59
0709ffb0 79f82477 00000000 77e6482f 00000000 mscorwks!WKS::gc_heap::gc_thread_function+0x9f
0709ffb8 77e6482f 00000000 00000000 00000000 mscorwks!WKS::gc_heap::gc_thread_stub+0x73
0709ffec 00000000 79f82448 00000000 00000000 kernel32!BaseThreadStart+0x34

Everything I can find about errors similar to this indicate that the managed heap is corrupted, but !verifyheap produces no output other than "-verify will only produce output if ther

Workflow Runtime Crashed with Access Violation Exception




We have an AddInProcess32.exe hosting Workflow Runtime (.Net 3.51 SP1) and the program is targeted to run on a Windows 2008 server (SP2). During the stress testing, some 30-60 workflows were be executed by the program repeatedly for a few days. Everything looked fine except at one time  AddInProcess32.exe crashed with information at Windows Log

Faulting application AddInProcess32.exe, version 3.5.30729.1, time stamp 0x488ef947, faulting module mscorwks.dll, version 2.0.50727.4206, time stamp 0x4bf4c6a7, exception code 0xc0000005, fault offset 0x00024414, process id 0x%9, application start time 0x%10.

.NET Runtime version 2.0.50727.4206 - Fatal Execution Engine Error (73227B6E) (80131506)


We don't have any COM interop or PInvoke. Also, the failed workflow type has been executed successfully more than one thousand times except the one crashed above.


With WinDBG and the crashed dump file, we managed to get the calling sta

Security in .NET: Enforce Code Access Rights with the Common Language Runtime


Component-based software is vulnerable to attack. Large numbers of DLLs that are not tightly controlled are at the heart of the problem. Code access security in the Common Language Runtime of the Microsoft .NET Framework addresses this common security hole. In this model, the CLR acts as the traffic cop to assemblies, keeping track of where they came from and what security restraints should be placed on them. Another way the .NET Framework addresses security is by providing preexisting classes which have built-in security. These are the classes that are invoked in .NET when performing risky operations such as reading and writing files, displaying dialog boxes, and so on. Of course, if a component calls unmanaged code, it can bypass code access security measures. This article covers these and other security issues.

Keith Brown

MSDN Magazine February 2001

Access violation in wpfgfx_v0400.dll - How to find the problem?

I have an access violation exception generated inside wpfgfx_v0400.dll. I have the minidump loaded in visual studio 2010 with all my program's symbols loaded in debug mode. Unfortunately, the stack is of little use. I have searched on the net for help but I could not find anything. I would like to know what I can do from here. Here is the stack for the thread that caused the access violation. Unhandled exception at 0x778b64f4 in WERE8E3.tmp.hdmp: 0xC0000005: Access violation reading location 0x24448900. >   ntdll.dll!778b64f4()      [Frames below may be incorrect and/or missing, no symbols loaded for ntdll.dll]        wpfgfx_v0400.dll!6abb6d2e()          wpfgfx_v0400.dll!6ab9e2d5()          wpfgfx_v0400.dll!6ab22c98()          wpfgfx_v0400.dll!6ab22c98()          wpfgfx_v0400.dll!6ab22c98()          wpfgfx_v0400.dll!6ab23dca()          wpfgfx_v0400.dll!6ab22dbb()          wpfgfx_v0400.dll!6ab291e2()    

access textbox added to tabpage at runtime

  I  have a TabControl1 with no tabpages. I am adding the tabpages at runtime and also adding one textbox to each tabpage. I am using the following to add the Textbox TabControl1.Tabpages(i).Controls.Add(New Textbox)   I am using TabControl1.Tabpages(i).Controls(0) to access the textbox. But doing this way, I cannot access the Multiline property of a textbox.   I want to be able to change the various properties of each textbox on each tabpage. How do I do that?  

Microsoft Access Write conflict when using 5 Access modules concurrently

Iam new to using Access & SQL server. We use Microsoft Access as front end and SQL server as backend for data Access. I am trying to run a userdefined function(limit check) which takes 2 parameters and returns me a value.  I implemented this way: A subform on a main form connects to the Table. The first 2 columns takes the 2 parameters from the subform and 3 column (computed column specification which runs the userdefined function and gives me a value in 3 column) Iam returning the 3 column value back to Access from. The primary key is on first 2 parameter columns. This worked fine when using 1 Access module. But In production when 5 Access modules try to access the same subform I get "write conflict error" This record has been changed by user since you started editing it. If you save this record you will overwrite the changes the other user made. Copying the changes to the clipboard will let you look at the values the other user entered, and then paste your changes back in if you decide to make changes.The 3 options that I have save record, drop changes,copy to clipboard. Though the 2 records are different somehow sql is thinking that I am trying to modify the same record. When I drop changes press Esc, go back and re run the check it is working fine. Is there any way to get around this problem? There is a way to directly call the function in Access but I

Log Reader Agent Access Violation


I recently set up transactional replication from one server database to another server database.  I keep getting a Log Reader Agent error:  An access violation occurred. 

The SQL Server agent starts under one Windows account but the Server is registered under the system account.  The log reader agent is using the system account.

I'm not sure what else to check or what database permissions or roles should be set.  Can somebody help?  Thanks.

Server crashing - Access Violation error



Would someone be able to help? We have a major problem with our SQL Server (2008 RC) installation. SQL Server keeps crashing. The key parts of the dump file seem to be these:

Log was backed up. Database: sage_broadata0506, creation date(time): 2010/06/30(13:26:32), first LSN: 18395:3126:1, last LSN: 18395:3126:1, number of dump devices: 1, device information: (FILE=1, TYPE=DISK: {'E:\Program Files\Microsoft SQL Server\Backup\sage_broadata0506\sage_broadata0506_backup_2010_10_14_085501_6709455.trn'}). This is an informational message only. No user action is required.
2010-10-14 08:55:03.37 spid61      Using 'dbghelp.dll' version '4.0.5'
2010-10-14 08:55:03.72 spid61      ***Stack Dump being sent to E:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\LOG\SQLDump0112.txt
2010-10-14 08:55:03.74 spid61      SqlDumpExceptionHandler: Process 61 generated fatal exception c0000005 EXCEPTION_ACCESS_VIOLATION. SQL Server is terminating this process.
2010-10-14 08:55:03.74 spid61      * *******************************************************************************
2010-10-14 08:55:03.74 spid61      *
2010-10-14 08:55:03.74 spid61      * BEGIN STACK DUMP:

Workflow Error ......System.Workflow.Runtime.Hosting.PersistenceException :Cannot access a disposed

I have a workflow that works fine on our development server...However on the production server it gives the exception below....

I have compared the configuration on both the servers and its the same.
I have hard to get around this error...

Can someone help please...

.WorkflowRuntimeService._workflowRuntime_WorkflowTerminated() Workflow ab37dd8b-c642-4a2a-9573-566e54a566cf Terminated: System.Workflow.Runtime.Hosting.PersistenceException: Cannot access a disposed object.
Object name: 'Transaction'. ---> System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'Transaction'.
  at System.Transactions.Transaction.Rollback(Exception e)
  at System.Workflow.Runtime.Hosting.WorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)
  at System.Workflow.Runtime.Hosting.DefaultWorkflowCommitWorkBatchService.CommitWorkBatch(CommitWorkBatchCallback commitWorkBatchCallback)

What's the best method to control access to documents and jpgs at runtime?


I want to be able to control access to photos and PDF documents at run time.

My site sells plans for decks, porches, sheds, etc.

I want users to be able to download the photos and documents as soon as they pay for them instead of having to wait for me to email the items to them.

What's the best way to do this?  I am using VB.net, SQL Server, and ASP.net.

I am entry level to lower-middle in my programming skills, but can usually follow along.

Thanks in advance for any help. 

Dynamic controls added at runtime, threading, The calling thread cannot access this object because a




My problem is on load I initialise a new thread. This thread create a new control then tries to add the control to a stackapnel and the error I receive is -

The calling thread cannot access this object because a different thread owns it.

Heres is my code e-




t = new

Subscribing to events from .NET COM component leads to access violation


I wrote a tiny COM component in C#.  The COM component fires an event, and I'm subscribing to the event in an MFC dialog app.  The event fires, and percolates up to the MFC app, and all seems fine.  But, when you exit the MFC app, an exception in mscorwks.dll generates this line in the Visual Studio Output window:

First-chance exception at 0x7006f877 in UseDotnetFormDllMfc.exe: 0xC0000005: Access violation reading location 0xfeeefef6.

Just subscribing to the event seems to cause this.  If I skip AfxConnectionAdvise, then the exception does not occur.  I assume I'm doing something wrong on the C# side.  The C# code appears below.  Does anyone happen to know what might be going wrong?


using System;

using System.Collections.Generic;

using System.Text;

using System.Runtime.InteropServices;


namespace DotnetFormDll


    // Declare INMSInternalUIEvents as a COM event source

    public delegate void CancelDelegate();


    // Define event interface


        ComVisible(true), // This interface should be in the typelib (defines events)


BackgroundWorker calling COM api method get "Access Violation" error


My WPF appl need to call methods in a COM object (VC++) to do some work. It works perfectly when I call those methods   from the UI thread. As those calls take a very long time to finish, so I decided to move the interaction with COM to a BackgroundWorker. But I got an exception in one COM methods (Other methods still working fine). The error reads:

Unhandled exception at 0x62a7be37 (msvcr100d.dll) in TestApp.exe: 0xC0000005: Access violation writing location 0x0ab0f000.

The signature of the COM method is:


            DWORD size = some func get the size;

            BYTE* pSrcData = the src data address;

            memcpy((void*) pData, pSrcData, size);   //Error occured on this line


    return S_OK;


How the C# calls the method:


Access Violation in SqlServerCe 3.5 SP2 with entity framework


We are developing a .net 4 application that uses sqlServerCe with entity framework.
We get random access violation exceptions when we read from the database. The exceptions always occurs in SqlServerCe.NativeMethods but exact location/function varies.

Platform: There are more exceptions running this on XP but they also occurs on Windows 7.

Any ideas?



Microsoft Visual Studio 2010
Version 10.0.40219.1 SP1Rel

Microsoft .NET Framework
Version 4.0.30319 SP1Rel

Installed Version: Ultimate

Microsoft Visual C# 2010   01019-532-2002102-70982

Microsoft Visual Studio 2010 Ultimate - ENU Service Pack 1 (KB983509)   KB983509
This service pack is for Microsoft Visual Studio 2010 Ultimate - ENU.
If you later install a more recent service pack, this service pack will be uninstalled automatically.
For more information, visit http://support.microsoft.com/kb/983509.

 System.Data.dll C:\Windows\Microsoft.Net\assembly\GAC_32\System.Data\v4.0_4.0.0.0__b77a5c561934e089\System.Data.dll
 System.Data.Entity.dll C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Data.Entity\v4.0_4.0.0.0__b77a5c561934e089 

How do I access a FlowDecision's TrueLabel and FalseLabel values at runtime?

Is it possible to get access to these values, either from the activity or from the ModelItem? I can't see any obvious way of doing it.

MVC architecture in ASP.Net using C# and Microsoft Data Access Application block

The Model-View-Controller (MVC) pattern separates the modeling of the domain, the presentation, and the actions based on user input into three separate classes [Burbeck92]:

Model. The model manages the behavior and data of the application domain, responds to requests for information about its state (usually from the view), and responds to instructions to change state (usually from the controller).

View. The view manages the display of information.

Controller. The controller interprets the mouse and keyboard inputs from the user, informing the model and/or the view to change as appropriate.

ASP.NET Architecture - ASP.NET Worker Process - HTTP Pipleline - Http Modules and Handlers

"ASP.NET is a powerful platform for building Web applications, that provides a tremendous amount of flexibility and power for building just about any kind of Web application. Most people are familiar only with the high level frameworks like WebForms and WebServices which sit at the very top level of the ASP.NET hierarchy. In this article I'll describe the lower level aspects of ASP.NET and explain how requests move from Web Server to the ASP.NET runtime and then through the ASP.NET Http Pipeline to process requests.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend