Knowing which thread BackgroundWorker will use for its events

[UPDATE 7/19/2011]  Stephen pointed me to his article covering this and more in February issue of MSDN Magazine, and I recommend it: We hit this recently, so I thought I’d post this email from Chad, a developer on version control, for anyone else who may have missed this subtlety. Today we discovered some of our…


More posts from Tim

Tim Noonan is on a blog-posting roll.  Not long ago, he did quite a bit of work to get better performance in Visual Studio when dealing with large numbers of pending changes, among other things.  Much of the performance improvements came from better use of the ListView: inserting initial items and setting checked states. He’s also posted…


C# 3.0 features

I just read Ian Griffiths’ post on C# 3.0 and LINQ – Expression Trees (linked from Jomo Fisher’s C# 3.0 post, which was linked in John Rivard’s Why Visual Studio targets only one version of the .NET Framework, which was in a link from Soma’s Multi-targeting of .NET FX in Visual Studio post, which I received…


Validating XML characters in SOAP messages

I’ve written about using the SoapHttpClientProtocol subclasses generated by wsdl.exe several times over the last year, including handling authentication, HTTP response codes, and setting timeouts properly.  Today I needed to change the code in TFS to better handle characters that are not allowed in XML. The problem is that if you have a method on your web service that takes…


How wide is a string when displayed in the console window?

Not too long ago, I had to fix the command line output for tf.exe, the Team Foundation Version Control command line app, so that output would be formatted properly for console windows (cmd.exe) using double-byte code pages. The code originally computed the output display width as the length of the string.  However, that’s not correct when…


Team Foundation Version Control client API example

[Update 3/16/2006]  I have decided to remove this version to reduce confusion.  Please see for the RTM v1 example.


Network programming links

Adarsh Khare, who is a tester for the .NET networking classes, has useful blog.  Recent posts include the new NetworkInformation namespace that includes things like network availability events and a reference to an MSDN article on running ASMX without IIS.


Timeouts on the HttpWebRequest (and thus SOAP proxies)

Last summer I wrote several posts on using HttpWebRequest and SOAP proxies.  Recently I was working on code that needed to handle requests that could take a really long time for the server to process.  The client would give up and close the network connection long before the request completed. The code had tried to…


Handling HTTP response codes in SOAP proxies

Continuing with the last post on authentication issues with wsdl.exe-generated SOAP proxies, you may need to handle HTTP status codes to provide custom exceptions.  To do this, the SoapHttpClientProtocol class (actually its parent HttpWebClientProtocol) provides a pair of GetWebResponse() methods for derived classes to override.  One method is for synchronous calls and the other for asynchronous. The…


More on working with SOAP proxies

In my last post on authentication and SOAP proxies, I mentioned setting the Credentials property on the wsdl.exe-generated proxy object.  Another way to do it and do other things is to override the GetWebRequest() method. In the following example, the culture is set in the standard HTTP header to tell the server what culture to…


Authentication and SOAP proxies

My last post discussed authentication in web service calls using HttpWebRequest.  That caused one reader to wonder how this ties back to SOAP requests. If you are using wsdl.exe to generate a SOAP proxy class, it derives from System.Web.Services.Protocols.SoapHttpClientProtocol.  That class has a Credentials property. If you want to use the currently logged-in user’s credentials,…


Authentication in web services with HttpWebRequest

Hatteras has three tiers: client, middle, and data.  The middle tier is an ASP.NET web service on a Windows 2003 Server running IIS 6.  When the client (we use C# for both it and the middle tier) connects to the middle tier, it must authenticate with IIS 6.  Depending upon the IIS configuration, that may…


TechEd C# presentations

Duncan Mackenzie just posted a link to the C# TechEd 2004 page that has slides from some of the presentations (more to come).  Cool!


Converting a text file from one encoding to another

The .NET framework handles file encodings very nicely.  Not too long ago, I needed to convert files from one encoding to another for a library that didn’t handle the encoding of the original file.  Since someone on an internal alias asked about doing this a couple of weeks ago, I thought it would be useful…