Archives
-
From Accessors to Properties
For various debugging processes, I find myself needing to find several bits of runtime information for my properties. This means I want to get the property's PropertyInfo object by Reflection when … more
-
Serializing Dictionaries
Dictionaries have been an annoyance when serializing for a while now. IDictionary in v1.1 and now IDictionary<K,V> in v2.0 are both non-serializable, forcing us to find workarounds or use … more
-
Bad compiler warnings when using anonymous methods for Predicate<T>
I was sitting around munching some code, and needed to filter a list I had: List<Whatever> list = // get list outputList = list.FindAll(delegate(Whatever item){ if (// blah … more
-
Creating nested directories
Just a quick tip to prevent others from feeling as foolish as I do: The static CreateDirectory() method of the System.IO.Directory class will create the entire directory tree passed to it. There's no … more
-
Non-generic default values in C#? Why not?!
A relatively obscure new keyword in C# 2.0 is the default(T) keyword. It's shorthand for checking if the given generic parameter T is a value type or reference type. If it's a reference type, it … more
-
Context-Bound Thread Queuer - FunFun.
As I mentioned in my previous post, I have a need to consistently pass an operation context to any thread I choose to spin. Doing so manually, as I did here, involves a lot of ugly, repetitive code … more
-
OperationContext is ThreadStatic
WCF Services tend to be big, heavy duty things. When I write a service I often want it to do a lot of work for a lot of clients, and it should do it efficiently. This usually means that I will use … more
-
Share your interfaces - avoid static proxies.
When using WCF services, we have several options for creating the proxies. We can create them statically using SVCUTIL or the build-in IDE support (Add Service Reference...), or we can generate them … more
-
Deperplexing WCF errors pt. 3 - Interfaces and KnownTypes
Another error message that stumped me today (after I had removed the IsOneWay parameter and actually got to see it) was the following exception:System.ServiceModel.CommunicationExceptionThe server … more
-
Deperplexing WCF errors pt. 2 - IsOneWay swallowing exceptions
The first step in understanding WCF error messages is making sure you actually get them.You can have an OperationContract defined with the IsOneWay parameter set to True, thus optimizing it by not … more
-
Deperplexing WCF errors pt. 1 - CommunicationObjectAbortedException for security mismatch
As a follow-up to this post: another reason why we get CommunicationObjectAbortedExceptions is because our client channel definition does not send any credentials (using a binding that has the … more
-
System.Reflection.Omit
In TechEd Israel 2006, I listened to Roy Osherove's excellent talk on the new reflection features in .NET 2.0 - a great assortment of topics on things ranging from DynamicMethods to the … more
-
Indigo Errors Perplexing
I was writing a very simple WCF service. Nothing fancy - just returning an array of structs via TCP, just like 3 others already implemented. Started testing, stepped through the server code, returned … more
-
One-Click Wonder
It turns out that you can easily close a tab with one click on the middle mouse button. On most modern mice, this would be the scroll wheel button. No fuss, no right-clicking, no selecting the tab … more
-
A new conditional assignment operator??
This one may have slipped beneath the radar, with all the new .NET 2.0 and WinFX and other improvements and APIs and language changes. It appears that C# 2.0 adds a new operator to the mix, and I … more