4 blog posts tagged debugging

LINQ to SQL log to debug window, file, memory or multiple writers

The Log property on a LINQ to SQL data context takes a TextWriter and streams out details of the SQL statements and parameters that are being generated and sent to the server.

Normally in examples you will see Console.Out being assigned to it which is fine for small demos and sandboxes but sooner or later you’ll want access to it in Windows or web applications. Here are some examples of how to redirect TextWriter output such as the DataContext log to other destinations.

Conditional operator bug in .NET 1.x & 2.0

  • 📅
  • 📝 397
  • 🕙 2
  • 📦 .NET

Update: This behavior is as expected according to the .NET team but it’s probably unexpected for most users.

I encountered a strange problem this week when a conditional operator appeared to be evaluating the false expression contrary to the C# documentation. The line looked like:

Visual Studio 2003 – System.ArgumentException in debugger

I recently ran into a problem while debugging inside Visual Studio 2003.Net. Google couldn’t find me an answer, only a few other people with the same problem. Here’s my solution in the hope it might save somebody else some time.

Whenever debugging a specific VB.NET application that used a C# class library I would receive the following error certain objects in the C# class library: