Rick Byers

The CLR, diagnostics tool support and programming languages.

Browse by Tags

Tagged Content List
  • Blog Post: Sample Reflection.Emit code for using exception filters from C#

    In this post , I mentioned that one way to use exception filters from C# code is to generate them with Reflection.Emit.  Personally I usually prefer static compilation (even post-build assembly merging or rewriting) – there’s really nothing here that necessitates dynamic code generation, but I can...
  • Blog Post: 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 in the CLR has lots of complicated algorithms for...
  • Blog Post: 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 to have multiple CLRs loaded in the same...
  • Blog Post: 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 what you want and so shouldn't be the default in Visual...
  • Blog Post: 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 support purposes, but more sophisticated applications will...
  • Blog Post: 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 that we're finally able to start talking about...
  • Blog Post: 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 is optimized". Typically non-optimized (debuggable...
  • Blog Post: 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 be used generally for non-virtual calls, but it’s...
  • Blog Post: 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 names and line numbers, etc.) for each frame whose...
  • Blog Post: 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; using System.Diagnostics;...
  • Blog Post: 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 you’d want to do this usually involve passing an object...
  • Blog Post: 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 describe what this bit does. Understanding sequence...
  • Blog Post: 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 or (in the case of JMC-mode in VS) impossible...
  • Blog Post: 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 and reflection to do this. We were talking about...
  • Blog Post: 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> to a List <object> ? After all,...
Page 1 of 1 (15 items)