Skip to main content

78 posts tagged with "dotnet"

View All Tags

Rethrowing Exceptions Is a Dangerous Business

· 3 min read

Problem

in Visual Studio's debugger, you've landed on an Exception statement. You look at the stack trace but it just points back to a custom exception class you've created. But you know that code is good, it can't be throwing the error. What's going on here?

Solution

this is an easy mistake to make. I've run it across it in code from a number of people, and recall making the mistake myself at one point. The problem is most likely due to nested throws to a new custom exception.

Collection Performance Comparisons

· 2 min read

This is not part of my series on performance tuning a specific app.

Problem

I have a Registry class in which I want to place a generic collection of objects. In this way I can add new items to the registry on the fly (i.e. from a user application), without having to recompile the library containing the the class. What is my best option, in terms of performance, for a .Net 2.0 collection to hold my mixed-bag of objects? I'll be referring to these with a string name.

Performance #3: CLR Profiler

· 3 min read

This article is part of the series An Exercise in Performance Tuning in C#.Net.

Where else could I improve performance? I thought I should inspect the memory usage and garbage collection. For that I found a great little tool from Microsoft, the CLR Profiler, which I found through the MSDN Patterns & Practices series of guides on application performance and scalability. The specific article that I found most helpful was How To: Use CLR Profiler.

Running Both .Net 1.1 and 2.0 in Windows 2003 Server 64 Bit Edition

· One min read

Problem

Microsoft .Net Framework 1.1 and .Net Framework 2.0 don't play well together (as ASP.Net apps) on Windows 2003 Server 64 Bit Edition.

Solution

either upgrade any ASP.Net 1.1 to 2.0 or switch to 32 bit compatibility mode. Of course switching to 32 bit mode will cause you to lose out on some performance benefits, but maybe you're okay with that (unless you're running under a very high load). Two easy steps:

Autoscrolling in the DataGridView

· 2 min read

Problem

In a .Net 2.0 Windows Forms application, user action causes a new

row to be added to a DataGridView control. When the viewport fills up, causing the vertical scrollbar to appear, the most recent entry is hidden "below the fold" — off the screen. Users want to see the latest entry at all times.

safnet logo