views:

136

answers:

1

Is it possible, while debugging a Silverlight app, to view all current references to an object?

I know that WPF developers have the ability to use the SOS.dll, but that cannot be loaded in the VS2008 IDE while debugging a Silverlight app. I've tried it, but the load command gives me the error:

.load C:\Program Files\Microsoft Silverlight\3.0.40818.0\sos.dll

SOS not available while Managed only debugging. To load SOS, enable unmanaged debugging in your project properties.

Unfortunately, there is no way to enable unmanaged debugging for a Silverlight app through the VS2008 IDE. I've also tried to the 'Attach To' the process, but still, no dice.

+1  A: 

I'm not sure if its possible from VS2008, but if you download and run WinDbg as part of the debugging tools for windows and you can attach on to a process hosting a silverlight plugin.

Once you attach you can run the following to use SOS:

.loadby sos coreclr

There are some examples out there for tracking down managed memory leaks, etc:

http://blog.ningzhang.org/2008/12/silverlight-debugging-with-windbg-and.html

http://blogs.msdn.com/delay/archive/2009/03/11/where-s-your-leak-at-using-windbg-sos-and-gcroot-to-diagnose-a-net-memory-leak.aspx

http://weblogs.asp.net/pglavich/archive/2008/12/03/debugging-silverlight-apps-using-windbg.aspx

Dan Auclair