Welcome to MSDN Blogs Sign in | Join | Help

Browse by Tags

All Tags » CLR   (RSS)

Quickly seeing where an exception may land in the debugger

A co-worker asked me recently how he could predict where an exception that was about to be thrown would land while debugging a managed application.  The real answer to this question is “you can’t – step into the throw and see”.  The EH system
Posted by rmbyers | 0 Comments
Filed under: ,

New interviews with my CLR team members up on Channel9

There are a bunch of great new CLR v4-related video interviews up on Channel9. In particular: Jon, Thomas and Dave from my team (CLR diagnostics) discuss the advancements in debugging and profiling APIs in v4 Simon and I discuss in-process SxS (ability
Posted by rmbyers | 0 Comments
Filed under:

AnyCPU Exes are usually more trouble than they're worth

Over the past few months I've had some interesting debates with folks here (and some customers) about the cost/benefit trade-off of "AnyCPU" (architecture-neutral) managed EXEs. I think we've converged on a consensus that most of the time they're not
Posted by rmbyers | 6 Comments
Filed under: ,

Getting good dumps when an exception is thrown

Often, when an unexpected exception occurs in production code, applications want to generate (and potentially report) some sort of diagnostics information.  Sometimes people just want to write to a log file (and perhaps pop some error dialog) for
Posted by rmbyers | 4 Comments
Filed under: ,

CLR 4.0 advancements in diagnostics

We announced at PDC today that we're making some significant advances in diagnostics tool support for CLR v4! In particular, we've been investing heavily in improving our support for production diagnostics scenarios over the past couple years. I'm excited
Posted by rmbyers | 16 Comments
Filed under: , ,

Func-eval can fail while stopped in a non-optimized managed method that pushes more than 256 argument bytes

In this blog entry , Mike describes that func-eval will fail when not a GC-safe point. In VS this results in the error "Cannot evaluate expression because a thread is stopped at a point where garbage collection is impossible, possibly because the code
Posted by rmbyers | 1 Comments
Filed under: ,

Invoking a virtual method non-virtually

Method calls using the C# ‘ base ’ keyword get compiled to an IL ‘ call ’ instruction, rather than the ‘ callvirt ’ that is normally used . This is the one case in C# where a virtual method can be invoked without virtual dispatch. The CLR allows it to
Posted by rmbyers | 3 Comments
Filed under: ,

Customizing PDB lookup for source information in StackTrace

The System.Diagnostics.StackTrace class in .NET can be used to generate a textual representation of the current callstack. This is used, for example, by Exception.ToString() . If requested by the caller, StackTrace can include source file locations (file
Posted by rmbyers | 1 Comments
Filed under: ,

Code Sample - StackTrace with manual Symbol lookup

// Sample to demonstrate creating a stack trace with source location information while controlling // how PDB files are located. // Written by Rick Byers - http://blogs.msdn.com/rmbyers // 6/21/2007 - Initial version using System; using System.Collections.Generic;
Posted by rmbyers | 1 Comments
Filed under:

More on generic variance

In my entry on generic variance in the CLR , I said that you can’t convert a List<String> to a List<Object>, or even an IEnumerable<String> to IEnumerable<Object>. I should point out however that the real-world scenarios where
Posted by rmbyers | 20 Comments
Filed under: ,

DebuggingModes.IgnoreSymbolStoreSequencePoints

In my last post I gave an overview of the DebuggableAttribute, what values the C# compiler gives it, and how the CLR uses those values. I mentioned that with /debug+, the C# compiler sets the IgnoreSymbolStoreSequencePoints DebuggingModes bit, but I didn't
Posted by rmbyers | 3 Comments
Filed under: ,

DebuggableAttribute and dynamic assemblies

Mike Stall has a great little sample showing how to make your dynamically generated code debuggable. However, there is one more detail you should be aware of. By default the JIT compiler will enable optimizations for the module, making debugging difficult
Posted by rmbyers | 7 Comments
Filed under:

Run-time exception checking

One of our partners asked us how a .NET program can tell what the currently active “try” blocks are on the stack. This seemed like a dubious thing to want to do, but regardless a colleague of mine whipped up some sample code that uses the StackTrace class
Posted by rmbyers | 4 Comments
Filed under:

Generic type parameter variance in the CLR

When people start using C# generics for the first time, they are sometimes surprised that they can’t convert between related generic instances. For example, since you can convert a string to an object , shouldn’t you also be able to convert a List <string>
Posted by rmbyers | 19 Comments
Filed under: ,
 
Page view tracker