DCSIMG
Advices - עומר.נט

Browse by Tags

All Tags » Advices (RSS)

Circumventing the KB957543 .NET 3.5 SP1 Regression Bug

Posted Jan 29 2009, 06:23 PM by עומר ון קלוטן  

A couple of days ago I hit a regression bug in .NET 3.5 SP1, in which when you have a generic class that implements ISerializable and has static variables – you can not serialize it using a BinaryFormatter without your application either hanging (x86) or raising an exception (x64 – a TargetInvocationException...

The Death of System.DateTime?

Posted Dec 18 2008, 05:56 PM by עומר ון קלוטן  

It’s been a few months since I started getting acquainted with the System.DateTimeOffset type and I can honestly say I don’t see any reason to use System.DateTime anymore. I’ve even gone as far as ask whether anyone knew when I would rather use DateTime over DateTimeOffset . The responses I got were...

Visual Studio 2008 Load Testing Checklist

Posted Sep 09 2008, 03:33 PM by עומר ון קלוטן  

After a couple of days of trying to run a load test for a web service on several agents via Visual Studio 2008, I come out much wiser and with a few new bald-spots, where hair I pulled out in the process used to be. I got a few errors whose messages have nothing to do with what really happened, so here's...

LINQ Performance Pitfall - Deferred Execution

Posted May 27 2008, 10:37 PM by עומר ון קלוטן  

When using LINQ, queries may bloat up to dozens of lines. My personal style is to take these queries and break them apart to smaller units of logic. To each unit of logic, I append a call to ToArray . @yosit asked me why I did it and I answered I was avoiding a possible pitfall. Here's what I meant...
תגים:,

A Limitation of Lambda Expressions and Overloaded Extension Methods

Posted May 07 2008, 03:07 PM by עומר ון קלוטן  

Tamir hates lambdas. He was having a problem with one of his lambda expressions and twittered about it. Around that time I opened my twitter account (yes, Yosi finally convinced me) and offered my help. He wanted to have a single extension method that could iterate over a collection and either change...
תגים:,

Catching Handled Exceptions During Debugging

Posted Jan 13 2008, 09:13 AM by עומר ון קלוטן  

Got an exception being thrown with only its name being displayed in the output window? Want to catch that exception? Just click on Debug -> Exceptions (Ctrl D, E) and check the exception you want to catch whenever it's thrown: Now the debugger will catch any exception of that type, regardless...

Linked List Insertion Capable of Surviving Abnormal Termination

Posted Nov 20 2007, 02:57 PM by עומר ון קלוטן  

I just finished a short conversation with Aaron Randall from London who used the little Windows Live Messenger Flash application in my sidebar (oh, how I love thee, Internets) to ask me a question he had about linked lists after reading one of my posts : "I am trying to understand the data structure...

ObservableCollection<T>.CollectionChanged Caveat

Posted Oct 25 2007, 08:51 PM by עומר ון קלוטן  

DO NOT return null values from collection properties or from methods returning collections. Return an empty collection or an empty array instead. Users of collection properties often assume that the following code will always work: IEnumerable < string > list = GetList(); foreach ( string name...

Windows Forms' GenerateMember

Posted Apr 12 2007, 05:05 PM by עומר ון קלוטן  

A little known, as far as I can tell from asking around, yet extremely useful property in the Windows Forms designer's property grid is GenerateMember . Defaulting to true , it decides whether a control/component gets declared as a field on the form ( true ) or as a local variable in the InitializeComponent...

Finding Out Why Control.Invoke Throws Undocumented Exceptions

Posted Apr 01 2007, 02:38 AM by עומר ון קלוטן  

A colleague was baffled by having Control.Invoke (when called from a different thread) throw an ArgumentException at him and asked if I knew what was happening. Opening the stack trace, I found that the exception originated from Control.MarshaledInvoke : at System.Windows.Forms.Control.MarshaledInvoke...

Bubbling Windows Forms Events With Anonymous Methods

Posted Mar 08 2007, 05:24 PM by עומר ון קלוטן  

The following code illustrates a great use for anonymous methods. public class MyContainerControl : Control { private class MySpecializedControl : Control { protected virtual void OnMyEvent(EventArgs e) { if ( this .MyEvent != null ) this .MyEvent( this , e); } public event EventHandler MyEvent; } private...

Save User Details For Team Explorer

Posted Jan 21 2007, 08:55 AM by עומר ון קלוטן  

Since I've started working with CodePlex, Team System failed to even remember my username whenever I started Visual Studio. After digging a bit, I found the answer. Start the Stored User Names and Passwords control panel: rundll32 keymgr.dll,KRShowKeyMgr Add a new server (for CodePlex, it's tfs01.codeplex...