Hi Brian,
I agree with Willy's suggestion. Normally after GC, the finializers will be
called by the finializer threads. It is likely that something that is
disposed in finializer result to the AV error. And for such exception, it
maybe hard to debug through break statically in source code. As Willy
mentioned, you can use debugger to attach the process and waitign for the
exception point. The windbg(debugging tools for windows) is a common
debugger for production environment debugging(crash, hang ,high cpu...).
Here is some reference introducing it:
#Production Debugging for .NET Framework Applications
http://msdn2.microsoft.com/en-us/library/ms954594.aspx
#.NET Debugging Demos - Information and setup instructions
http://blogs.msdn.com/tess/pages/net...on-and-setup-i
nstructions.aspx
#A word for WinDbg (2)
http://mtaulty.com/communityserver/b...hive/2004/08/0
3/4671.aspx
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(E-Mail Removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>Reply-To: "Brian" <(E-Mail Removed)>
>From: "Brian" <(E-Mail Removed)>
>References: <(E-Mail Removed)>
<O0J$(E-Mail Removed)>
>Subject: Re: Debugging code being run during garbage collection?
>Date: Thu, 10 Apr 2008 09:45:43 -0500
>
>
>"Marc Gravell" <(E-Mail Removed)> wrote in message
>news:O0J$(E-Mail Removed)...
>> Well, GC doesn't run Dispose(); only finalize.
>>
>> And you shouldn't be touching any other objects except "this" in a
>> finalizer; the idea is to release unmanaged resources, such as Win32
>> handles that only exist as an int/IntPtr/etc.
>>
>> You shouldn't touch any other object in a finalizer; it might not really
>> be there...
>
>
>I understand. And actually, I try not to write finalizers at all anyway.
>But we use .NET WinForms and embed Office in our app using DSO Framer.
>So, we use code that Microsoft has written that has finalizers.
>
>And, yes, it might not really be there. But I added a debug command that
>just invokes System.GC.Collect. After doing certain things in our app, if
>I invoke that command, then I get the AccessViolationException. Its
>possible
>that its a timing thing and it was just a really really "lucky"
coincidence.
>
>Any suggestions on how to get an idea of what object's finalizer is causing
>that would be GREATLY appreciated.
>
> Brian
>
>
>