Welcome to MSDN Blogs Sign in | Join | Help

October 2006 - Posts

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
Posted by jmstall | 1 Comments
Filed under:

Possible slowdowns under a debugger

Here's a list of things that may slow down execution under a debugger. I've seen a few threads go by about ways that running under the debugger significantly slows down normal execution by more than 2x, and this is a collection of those items. Background
Posted by jmstall | 2 Comments
Filed under:

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.
Posted by jmstall | 12 Comments
Filed under:

Questions you should ask before using a callback / delegate

I just got burned by using callbacks in a multi-threaded app. I've rewritten the part to avoid callbacks, but for my good-deed-of-the-day, I wanted to issue a word of warning. Before you can safely use a callback / delegate / virtual function, particularly
Posted by jmstall | 5 Comments
Filed under:

Using Foo<T>(...) instead of Foo(System.Type, ...)

Whenever you're passing in a parameter of System.Type that is usually determined at compile-time, consider having a version with a generic parameter. This converts runtime checks into compile time checks, may let you have more efficient code, and likely
Posted by jmstall | 8 Comments

GCHandle.ToIntPtr vs. GCHandle.AddrOfPinnedObject

Both GCHandle's ToIntPtr and AddrOrPinnedObject take in a GCHandle and return an IntPtr. I had to do a double-take to remember the difference between them, so I'd thought I'd blog about it. GCHandle.AddOrPinnedObject is for passing the address of the
Posted by jmstall | 0 Comments

Pop quiz: Who wins in finally vs. return?:

Question 1) What's the return value from this C# function: static int Test() { int val = 1; try { return val; } finally { val = 2; } } Question 2) What about this (using a static instead of local) static int s_val; static int Test() { s_val = 1; try {
Posted by jmstall | 8 Comments
Filed under:

Debugging Ngen code

You can debug ngen (aka prejitted) code from VS2005 and also have the VS2005 IDE launch ngenned code. In practice, images are rarely ngenned as debuggable. And usually when under a debugger, assemblies are loaded with debuggable code-gen flags (In VS,
Posted by jmstall | 2 Comments

ICorDebugValue vs. System.Object

System.Object represents a managed object within a process. ICorDebugValue is the debugger's representation of a System.Object within the debuggee process. The key here is that the debugger and debuggee processes are ideally fully isolated from each other.
Posted by jmstall | 3 Comments
Filed under:
 
Page view tracker