Archives
-
Wrapping the RAS
A couple of years ago I had a need to automate dialing a RAS connection and retrieving the IP address allocated by the server. I found myself writing a small, rather limited wrapper around the RAS P/ … more
-
Crossing the line - Reflection and Reality
When we're working Reflection, we tend to think in different terms than we do when we're actually calling methods. There's an extra level of abstraction in everything we do. Translating between these … more
-
Code Generation, SharedContracts and The Sneaky Bug
A short discussion ensued today on the topic of Code Generation tools like CodeSmith. Like Unit Testing, code generation is a topic that some people swear by and some reject out of hand. I'm sure … more
-
Creating CustomBindings programatically
I had another revelation earlier, when going over Nicholas Allen's explanation of the GetProperty<T> method and BindingContexts:The Binding objects supplied by the WCF framework are only a … more
-
Aggregated Interface Implementation
I've been struggling around the aggregation used in WCF's Binding object model, as implemented in the GetProperty<T> method (see relevant discussions with Nicholas Allen from the WCF team here … more
-
WCF: Navigating the Binding maze
A few days ago I ranted a bit about the Binding object model in WCF and how restrictive it feels when I want to imperatively describe my service bindings without being tied down to a specific … more
-
WCF Serialization Part 2d: A Solution, a Conclusion and a Contribution
This is the last part of my continuing saga of serializing dictionaries over WCF and beyond.Quick recap: While WCF allows me to serialize an IDictionary easily, trying to serialize that dictionary … more
-
WCF Serialization Part 2c: Hacking the NameValueCollection (unsuccesfully)
As we mentioned here and here, I've been struggling to get the NameValueCollection object to pass through WCF serialization. Please read the first two posts first for some context. In the … more
-
WCF Serialization Part 2b: WCF Collection Serialization
As we mentioned here, I'm currently struggling with getting WCF to serialize my NameValueCollection object on a service operation. The previous post goes over the general details, while here I' … more
-
WCF Serialization Part 2a: NameValueCollection Denied!
As we all know, IDictionaries aren't serializable. This is has been a cause of much concern and consternation throughout the years. Throughout these trying times, however, we had one shining … more
-
WCF Serialization part 1: Interfaces, Base classes and the NetDataContractFormatSerializer
One of WCF's goals is interoperability with standard protocol stacks, like WSE or other WS-* implementations. This led, I am told, to the design of WCF's default object serializer - the … more
-
WCF and Non-polymorphic bindings
I've been using WCF for the past few months and on the whole, I think the programming model works. I'm getting to really like the extensibility model and the whole deal seems to click … more
-
UI Usability - case studies and recommendations?
Doing work on our WinForm application, we find ourselves having to make choices - too many choices - about the UI. We don't have access to professional UI engineers, unfortunately, and we make … more
-
A silly little C# language feature request: .! operator
When we step back for a moment from our SOAs and Factories and Polymorphism, we have to admit that at the root of much of our code lie a hell of a lot of simple if/else statements. Like it or not, … more
-
File Properties in Word 2007
A client asked me the other day what happened to File->Properties in Word 2007. They simply couldn't find it.In the Beta1 TR, I remember it was confusingly located on the Status Bar (!) – … more
-
A Better Obfuscation, or How To Write Code That Will Make Someone Kill You
The following code is perfectly valid C#, and compiles without errors: int _;_ = 5; If we take it a bit further, we can do something like this: int _, __, ___, ____; _ = 5; __ = 10; ___ = 15; ____ = 2 … more
-
Ping Notifier!
How many times have you connected to a server via Remote Desktop to install some components?How many have you rebooted a remote server and sat around waiting for it to go up?How many times have you … more
-
Visual Studio obstructing DebugView
I've mentioned it before, but SysInternal's DebugView is a great utility. It allows you to get the Debug.WriteLine() strings from your application even when you're not attached with a debugger, … more
-
Some thoughts on uninstalling Sharepoint '12' Beta 1
I'm uninstalling an old beta of the Sharepoint servers from a VPC I have on my computer to make room for the newer Beta 2 servers, and I noticed several things: 1) The installation originally … more
-
My Singleton is disappearing!
WCF's Instance Context model allows me to specify my service's instantiation behavior - I can get a new instance for every call, have WCF manage a session for me and keep an instance per session, or … more
-
Hiding properties from the Property Grid
Taking a break from the main components, I decided to get around to writing a small configuration editor using .NET 2.0's lovely ability to edit .config files from code. I have a custom Section … more
-
URIs are not local paths.
It's easy to forget that even though a local filesystem path ("C:\MyDir\MyFile.dll") can be represented as a Uri (file://C:/MyDir/MyFile.dll), these two entities are different, and have different … more
-
ParamArrays and CLS-compliance.
In my previous post, I noted that when I write this code in C#: public void MyMethod (params object[] args) { ... } What I actually get in my IL is this: public void MyMethod ([System.ParamArray] … more
-
Problems with params array?
I noticed today that the ever-popular String.Format() method has several overloads - in addition to the Format(string format, params object[] args) overload I was expecting, it seems there are three … more
-
Query SUBST information
For various reasons involving out testing framework, I found myself needing to get the full command-line of the current executing assembly. However, our development environment uses the DOS SUBST … more
-
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
-
Serializing a Binding object - TimeSpan serialization error.
Seeing as our project is all distributed and stuff, with various services possibly running on different servers, we wanted to have the whole service address business be flexible, and not rely on … more
-
VSS and mapped file locations
Just a quick tip about the some new problems we're having with VSS:To ease integration and control, all developers on the team have their local development drive mapped to drive P:\, to make sure all … more
-
Adding custom headers to every WCF call - a solution
At last, a solution presented itself. While I must admit that at first I was very skeptical of the extensibilty model for WCF which seemed far too involved and complicated, but after implementing a … more
-
How do I add a custom header to every WCF message?
One thing I still haven't managed to do is create my proxy in such a way that a custom header is added to every call that is made through that proxy. Currently, this is done by instantiating a new … more
-
Adding custom headers to a WCF message - Jan CTP
Guy Burstein, again, writes about adding custom headers to a call made by a WCF proxy.This is all very nice and well, but his code only works with the Feb. CTP of WCF, while I'm still using January … more
-
VSS2005 - staying in line
Working with Visual SourceSafe always feels to me like walking on eggshells. One wrong move and you get that sickening crunching feeling and things seem to collapse.My current project's integrator … more
-
Genericizing the GenericProxy<T>
A few days ago, Guy Burstein wrote a entry on avoiding design-time generated proxies by extending the ClientBase class to create a GenericProxy. This proxy uses the client binding data in the app. … more
-
Creating metadata from WCF executables
So I've started messing around with WinFX and WCF. It certainly feels like it needs more work, especially on the dev-tool end of things.I was trying to run SvcUtil to generate metadata and proxy from … more
-
Problems I've encountered today when installing the WinFX January 2006 CTP
1) Documentation Errors When reading the documentation, I get scripting errors when accessing every page – a 80041001 script error, after which the page is readable but suffers from some layout … more
-
Kerberos and Web Service Preauthentication
My current project has been having various inconsistent, irreproducible 401 Unauthorized errors on our web service calls. We tried various tests, checks, changes and wild guesses, and we think we’ve … more
-
When is a dash not a dash?
An interesting an unusually frustrating pitfall that I've stumbled into a few times: Many times when we're preparing for deployment of a software product, we find ourselves preparing a Word document … more
-
Macro Origins
I've been wondering about the origin and etymology of the term "macro" as it is used in programming. The general use for it is to mean something large - the opposite of "micro" - but it didn't seem … more