Mike Stall's .NET Debugging Blog

Notes on Managed Debugging, ICorDebug, and random .NET stuff

Browse by Tags

Tagged Content List
  • Blog Post: MVC Style parameter binding for WebAPI

    I described earlier how WebAPI binds parameters . The entire parameter binding behavior is determined by the IActionValueBinder interface and can be swapped out. The default implementation is DefaultActionValueBinder. Here’s another IActionValueBinder that provides MVC parameter binding semantics. This...
  • Blog Post: OpenSource CSV Reader on Nuget

    I did some volunteer work a few years ago that required processing lots of CSV files. So I solved the problems by writing a C# CSV reader, which I wanted to share here. The basic features here are: be easy to use read and write CSV files (and support tab and “|” delimiters too) create CSV files around...
  • Blog Post: Quiz: can you count how many combinations ...

    Here's a combinatorics quiz: If you have 2 ordered lists (lengths N, M), how many ways can they be interleaved into a single list while still preserving the partial ordering from the original lists? So if the lists were: List 1: A,B List 2: X,Y The following would be valid: A,B,X,Y A,X...
  • Blog Post: How to add Options to Live Writer PlugIns

    This entry explains how to have options associated with your Windows Live Writer plugin, including design patterns, dealing with the UI, persistence issues, and setup/uninstall implications . See here for an example of writing a plugin. What are good options ? Some things that are nice to make as options...
  • Blog Post: WiX Script for installing Live Writer Plugins

    Here's a WiX install script to build an MSI to install a Windows Live Writer (WLW) plugin dll, by xcopying the plugin dll to the Plugins directory. You can then upload your MSI to the WLW Gallery and share your plugin with others. WLW Plugins are very easy to write , so it's nice to have them easy to...
  • Blog Post: Simple Tool for text substitution plus Design questions

    I wrote a simple C# app to do text substitution. It takes a (key,value) mapping and then replaces any keys in between {% ... %} with their value. It's a really trivial app. But it also quickly opens a Pandora's box of design questions. It takes an xml file that provides the (key,value) , such as values...
  • Blog Post: Foreach codegen

    Do you know how the following C# code compiles? foreach ( int i in c) { Console .WriteLine(i); } In addition to the obvious branching opcodes, this can also emit try/finally, a call to IDisposable, unboxing opcodes. It turns out it really depends on the type of C. There are 4 interesting cases: If C...
  • Blog Post: Setting transparency in an image

    Just as Jackie Chan does his own stunts; I do my own image drawing. Some of my "art": (The yellow arrow here ). The shapes in my Silverlight 1.1 app : The astute observer probably noticed that all of my work is very primitive and done in MS Paint (yup, "%windir%\system32\mspaint.exe") . Paint is fast...
  • Blog Post: My first (non-trivial) Windows Live Writer Plugin

    So the Live Writer Plugin model is so cool and easy that I had to write a plugin. (and do it with Edit-and-Continue ). The obvious ones were already done (eg, Paste code from VS), so I scratched my head for an idea and I finally got one: a "verse of the day" plugin. This gets an RSS feed from BibleGateway...
  • Blog Post: Sample code for copying Html to Clipboard

    // Sample class for Copying and Pasting HTML fragments to and from the clipboard. // // Mike Stall. http://blogs.msdn.com/jmstall // using System; using System.Diagnostics; using System.Windows.Forms; using System.Text.RegularExpressions; using System.Collections.Generic; using System...
  • Blog Post: Copying HTML on the clipboard

    Setting plain text on the clipboard is easy. Call Clipboad.SetText("Hello!"), and it works great. But what if you want to set HTML? Tempting to think you just call Clipboard.SetText ("<b>Hello!</b>", TextDataFormat.Html ). But that doesn't work because HTML on the clipboard (in CF_HTML format...
  • Blog Post: Type-safe Managed wrappers for kernel32!GetProcAddress

    Pinvoke is cool in managed code, but sometimes you need to get straight at kernel32!GetProcAddress. For example, maybe you need dynamic control over which unmanaged dll you want to load. But that returns a void*, which is a major no-no in managed code. Here's a helper class I wrote (as part of the growing...
  • Blog Post: C# app to count #ifdef usage

    Here's a little tool I wrote to count #ifdef usage in a project. It provides a summary of the #define name and frequency; plus a detailed XML file of each location that the #define occurred at. For example, when applied to this sample file (in directory c:\temp\1): 1: void Foo() 2: { 3: #ifdef...
  • Blog Post: Viewing types with Reflection-Only

    It's natural for a tool to use Reflection-Only loading to load an assembly and view the types in it. For example, I used this in my pdb2xml tool. However, I missed an important detail that I wanted to warn you about after getting it wrong myself. Consider the following snippet which will print all...
  • Blog Post: Unit testing databases

    Here's a cool tool on CodePlex that Tim pointed me to f or anyone who needs to write unit tests on your data-access code: http://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=MassDataHandler “The MassDataHandler is a framework to assist with Database Unit Testing. The framework makes...
  • Blog Post: Writing an RTF to HTML converter, posting code in blogs.

    Visual Studio's IDE will copy code as RTF (Rich Text Format). Web browsers like HTML. So posting code from Visual into blogs means a decent RTF to HTML conversion. And having a technical blog means posting code. So I needed to solve this conversion problem. The sad tale : At first I tried Word, but...
  • Blog Post: Using CreateRemoteThread from C#

    If you want to create a new thread in your process in C#, you can use Thread.Start . But things are a little harder if you want to create a thread in another process, ala kernel32!CreateRemoteThread . Disclaimer : CreateRemoteThread is evil, could dead-lock, doesn't always work (particularly across-sessions...
  • Blog Post: Sample code for CreateRemoteThread in C#.

    // Sample for CreateRemoteThread in C# using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using System.Diagnostics; namespace CreateThread { class Program { #region standard imports from kernel32 // Thread proc, to be used...
  • Blog Post: Empty implementation of ICorDebugManagedCallback

    I have to implement the ICorDebugManagedCallback interfaces. I wrote up a stub implementation (that just E_NOTIMPLs all the methods) and am posting it here for reference. It's pretty tedious, so I'll post it here and then never have to write that again. As a language design point, it's definitely...
  • Blog Post: Sample code for snapshot tool

    //----------------------------------------------------------------------------- // Harness to snapshot a process's callstacks and some variables. // Built on MDbg. // Needs a reference to MdbgCore.dll (ships in CLR 2.0 SDK). // // Author: Mike Stall (http://blogs.msdn.com/jmstall) // More info...
  • Blog Post: Trivial RSS Writer

    Recently, I've been going through the standard fatherhood ritual of trying to setup of a webpage to share out photos of my kid. This naturally involves creating an RSS feed so that family can subscribe to the new image list. I wanted to be able to write simple C# code like this to produce the feed...
  • Blog Post: Tool to get snapshot of managed callstacks

    I wrote a simple tool to take a snapshot of a running managed process and dump the output as an XML file. I'll post the full source as a sample on MSDN. [ Update 6/26/06] After great delay, source posted here . Also, check out Managed Stack Explorer , which is a more polished tool that has similar snap...
  • Blog Post: How to embed IronPython script support in your existing app in 10 easy steps

    Previously , I added IronPython scripting support to a real existing application, MDbg (a managed debugger written in C#). In this entry, I'll go through step-by-step how I did that. I'll call specific attention to the goofy issues so that it should be very easy for other end users to get right to the...
  • Blog Post: 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 experiment went pretty well. I conclude IronPython...
  • Blog Post: Sample Python script for Mdbg-Python extension

    #---------------------------------------------------- # Python Script for MDbg commands #---------------------------------------------------- #---------------------------------------------------- # Support for accessing the root Shell object. # We can get at everything else from this. #----------...
Page 1 of 2 (41 items) 12