Welcome to MSDN Blogs Sign in | Join | Help

August 2005 - Posts

Adding IronPython scripting engine to Mdbg

I hear IronPython is a great managed scripting language to embed in other managed apps, so I thought I'd try this out by writing an MDbg Extension to drop IronPython 0.9.1 into the MDBg Beta 2 sample. (both pieces are publicly available downloads). The
Posted by jmstall | 12 Comments
Filed under: ,

The importance of fortifying your subsystems.

In Writing Solid Code , Steve Maguire warns to "fortify your subsystems". This is especially important if your subsystem takes liabilities on other systems. One of our (CLR debugging teams') most common bugs from Whidbey Beta 2 is a case where we hadn't
Posted by jmstall | 1 Comments

What's on my blog-todo list.

At this point, I've got what seems to be an endlessly long list of things I'd like to eventually blog about. My list includes: ( Update 10/25/05 : added more hyperlinks since I've now down some of these) 1.) Brushing up on some AI: A coworker lent me
Posted by jmstall | 3 Comments
Filed under:

Boring blogs?

Some of you are probably wondering why I sometimes blog on such strange topics. Great question! There are lots of reasons: 1.) My area of expertise (ie, the only thing I know more than you about) is the CLR Debugging Services. Based off blog comments
Posted by jmstall | 12 Comments
Filed under:

Converting a managed PDB into a XML file.

I wrote some C# sample code to get an ISymbolReader from a managed PDB (Program Database) file and then dump it back out as XML. The managed PDB stores all the source-level debugging information such as: - the mapping between IL offsets and source lines.
Posted by jmstall | 11 Comments
Filed under: ,

ICorDebugStepper and using ICorDebugStepper2::SetJMC

We added Just-My-Code (JMC) stepping (the ability to step through just your code and skip code that's not yours) in Whidbey. I blogged a demo from the end-user's perspective here . In response to some email, I wanted to talk a little more about how a

Size of Visual Studio

Ever wonder how large Visual Studio is? This public comment from the MSDN feedback gives some good stats: Visual Studio is over 43 million lines of code , there are over 30 teams working on different pieces, with roughly 700 developers checking-in code
Posted by jmstall | 21 Comments
Filed under:

Sample code for Plagiarism Searcher tool

Here's my sample code for a tool to catch blog plagiarism that I described earlier . In retrospect, it was pretty easy to write (under 400 lines!). And edit-and-continue in C# and interceptable exceptions made my development time a lot faster! The tool
Posted by jmstall | 8 Comments
Filed under:

Using the clipboard as input for console tools.

The clipboard can be a very handy source of input for certain console tools. I've written some console C# tools that want to take in a large amount of text from some open document (such as a webpage or a window in my IDE). It would be annoying to have
Posted by jmstall | 3 Comments
Filed under:

Sample code to execute MSN searches from C#

For kicks, I started writing a tool to use internet searches to automatically catch plagiarism . The first thing I needed was a way to easily execute a search (I'll use MSN search ) from a C# API. Ideally, it would be a function that takes in a search
Posted by jmstall | 8 Comments
Filed under:

Tool to catch plagiarism

If you copy somebody else's blog entry verbatim, credit the original author and link back to the original post. Sometimes I'll google my own topics to learn more about what other people have to say about it. I stumbled across some blatant plagiarism.
Posted by jmstall | 12 Comments

Why <font> is bad and easy intro for Cascading Style Sheets

I embarrassed to admit I hadn't used CSS before. I googled it, this tutorial came up, I found it quick and helpful, so I wanted to pass it along. It's a great, concise, easy-to-follow, tutorial about why the <font> tag in HTML is bad and how to
Posted by jmstall | 3 Comments
Filed under:

Auto-attach to child process is not supported in managed-debugging

Native-only debugging allows you to debug child processes. In other words, you can debug process A, and then if A spawns process B, your debugger can automatically start debugging process B. This eliminates the need to manually attach to process B, and
Posted by jmstall | 1 Comments

Lessons from nullable: Superstars + Feedback

Soma (my boss's boss's boss's boss) recently blogged about how the CLR took a major change to fix Nullable . There are 2 lessons here. First, this is a lesson in super-stars. Some background: this was a major change done very late in the game. That's
Posted by jmstall | 1 Comments
Filed under:

How should a generic method be displayed?

I've heard several different opinions about how the debugger should display a generic method in the callstack. Say you have a method Class<T>::Method<S>(...). Say you have 3 instances, of with (T=int, S=string), (T=int, S=object), and (T=float,
Posted by jmstall | 8 Comments
Filed under: ,

Nesting C#'s yield

C#'s yield keyword is sure neat, but I notice it only lets you yield a single item. It does not let you yield another enumerator and then flatten for you. You can manually do this by having the for-each yourself. foreach(int i in GetValues()) { yield
Posted by jmstall | 7 Comments
Filed under:

MDbg Sample is updated for Beta 2 and RTM

The Mdbg (a managed debugging written in pure C#) sample, which includes full source, has now been updated and released. The previous sample was for beta 1. This new sample has been updated for Whidbey beta 2 and will also be compatible with the final
Posted by jmstall | 14 Comments
Filed under: ,

Problem: The debugger attaches too slowly:

From the mailbag: "I notice that running and attaching the debugger takes on average now 8-10 seconds for even a simple console application." I'm not a VS expert, but here are some trouble-shooting tips: 1. Try a managed-only attach instead of interop
Posted by jmstall | 3 Comments

You can't get a mixed-mode callstack from inprocess.

You can't get a full-mixed (both managed+ native) stack of a thread within your own process. You can get a native-only stack from function like DbgHelp!StackWalk64 (which is what this article on Codeproject does) to get the native callstack of a native
Posted by jmstall | 7 Comments

Implementing your own XmlReader the easy way.

Implementing an XmlReader is very difficult because there are over 25 abstract methods. Here's a simple way to change the problemspace to implement XmlReader with only 1 real method.
Posted by jmstall | 6 Comments
Filed under:

Harness that Attach instead of Launch

I've given sample code for MDbg-based harnesses that launch an app and then print all loaded modules or print exceptions that occur. In both cases, the harness launches the app. One reader asked how to modify them to attach to an existing app. It's actually
Posted by jmstall | 7 Comments
Filed under:

TextReader based off C# Yield

Here's how to use C#'s yield keyword to conveniently implement a stream on top of a complex data source
Posted by jmstall | 4 Comments
Filed under:

On why C#'s "abstract-override" is so cool:

Good language design usually results in a few well defined simple primitives that can be combined together in intuitive and intelligent ways. In contrast, poor language design usually results in many bloated constructs that don't play well together. The
Posted by jmstall | 6 Comments
Filed under:

Deriving from TextReader

TextReader is an abstract base class that represents reading a textual stream. It's like an enumerator for characters (IEnumerable<char>). Common derived classes in the frameworks include StringReader (which presents a string as a text stream) and
Posted by jmstall | 6 Comments
Filed under: ,

Jonathan Keljo has started a blog!

Jonathan Keljo has started a blog ! Jonathan is a Program Manager (PM) on the CLR (which means he understands the big picture better than developers like me). He's had a major impact on the managed debugging services in Whidbey. He's been up to profiling,
Posted by jmstall | 0 Comments

More caveats about #line

I posted here about how you can use #line in the C# compiler to associate C# code with some other source file than the one it was compiled with. This can be very useful for code generation and for "hiding" various parts of the function from the debugger.
Posted by jmstall | 5 Comments

What my dog taught me about race conditions

I have a black Labrador named Sofie. She's about 2 and a half now, but still a puppy at heart. Here's a picture of her (along with her best friend, Sierra, who is a yellow lab): One morning, Sofie reminded me of a valuable issue with threading and race
Posted by jmstall | 9 Comments
Filed under: ,

Simple example of an API design flaw.

Here’s a simple example of an API design flaw in ICorDebug. (ICorDebug is the API that Visual Studio / MDbg and other debuggers use to debug managed code). Here’s the background knowledge: 1) When a thread first executes actual IL (whether jitted or ngenned)
Posted by jmstall | 3 Comments
Filed under: ,
 
Page view tracker