Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

What are the best refactor and profiler tools for VS2005?

If you have some experience with refactoring or profiling tools (preferably with experience of multiple tools), I would be really interested to know what you think.

For refactoring tools, the pick seem to be either JetBRAINS ReSharper or DevExpress RefactorPro. ReSharper is $250 and seems to have similar functions to RefactorPro which weighs in at $99 with free updates for a year, or $250 if bundled with CodeRush. There is also JustCode and C# Refactory but these both seem to be less mature compared to ReSharper and RefactorPro.

Read More

Misfire on the keyboard

Every now and then, and sometime more often than that, I happened to not have my fingers on the right keys. The results are usually terrible, but can sometimes be kinda cool. I just tried typing “similar” and came up with “sunukar” instead. Maybe that should be the name of my next piece of software.

Following in one of the trends of Microsoft, I have been naming software according to town names. Could this be the new method of generating code names? Just bash the keyboard in semi-random positions.

Read More

ASMX interoperability with WCF

If you have an ASMX client, you can get it to call a WCF endpoint with some restrictions. You have to use the basicHttpBinding on the WCF service and the service implementation (or contract) needs to be decorated with the XmlSerializerFormat attribute.

I have encountered a problem under SSL though. I am wanting to use username/basic authentication with the service over SSL. This article makes the following reference:

The easiest straightforward way for a successful interoperability scenario is to leverage on transport-layer security. This also means that a properly configured WCF implementation can interoperate with a Basic Profile 1.0 compliant ASP.NET Web Service (ASMX) that is currently deployed via SSL / HTTPS as well as with a WSE 2.0 service or client and likewise.

WCF has a standard binding called “<basicHttpBinding>” which derives its name from the Basic Profile specifications. There is a security mode within this binding called “TransportWithMessageCredential”. You can choose either a transport or a message credentials in this security mode. Setting it to <message clientCredentialType=”UserName”/> uses Transport-Level Security (SSL / HTTPS) with SOAP-Level Username token security credentials. This is in accordance with the WSS SOAP Message Security Username Token Profile 1.0 and it implements WSS SOAP Message Security 1.0 specification for username/password (for client authentication) over HTTPS (for privacy).

Read More

Free digital certificates from StartCom/StartSSL

I was doing some reading a while ago about digital certificates. The kind of certificate I was after was so that I could use HTTPS in IIS. It looked like the certificates were all very expensive for what they are. I finally came across a post that referred to StartCom. These guys offer free digital certificates for domain or email validation. At this stage, the only hitch is that the CA certificate is not on client machines by default, but can be installed from the StartCom site.

Check it out here.

Read More

How TFS stores workspace information

Given the recent problems on CodePlex, I have had to change the TFS server that one of my projects is hosted on. I found this to be a problem because I wanted to use the same directory for the source on my local drive. Even after removing the source control bindings and removing the TFS server settings, Visual Studio still complained that the directory is configured for the old server address.

TFS stores workspace directory mapping information in a VersionControl.config file located in _C:\Documents and Settings[YOUR PROFILE]\Local Settings\Application Data\Microsoft\Team Foundation\1.0\Cache_. The old server isn’t removed from this configuration when you remove the server from TFS in Visual Studio. This bit, you have to do yourself.

Read More

Does the WorkflowRuntime have a memory leak?

Over the last week at work, we have been doing some testing of our WCF services that call into a business layer that uses WF. We have the services set as single instance, and we are using a new instance of the WorkflowRuntime for each service call. There are obvious inefficiencies of creating the runtime for each call, but that isn’t the issue. The problem is that we noticed that the memory went up and didn’t get released (until the AppDomain was unloaded).

After a lot of testing, it came down to the WorkflowRuntime instances that were remaining in memory, even through all of our other objects were cleaned up and disposed. We did everything we could to release the runtime from our code but the memory issues remained. So, is there are memory leak in the runtime?

The solution seems to be to wrap the runtime as a singleton. Singletons have been bashed a lot over recent months and while I agree with the criticism over the misuse/overuse of singletons, I think this is an appropriate case for one. Initial testing has shown that there is no memory problems once only a single WorkflowRuntime was used. This also comes with the performance benefit of not having to create and destroy the runtimes for each call.

Scott Allen has some more pitfalls to watch out for with the runtimes.

Read More

How does the GC handle circular references?

I am a little curious about how the garbage collector cleans up CLR objects. From what I understand, it will wait until objects are de-referenced and then will go through a couple of generations (as required) to release objects from memory.

The following is a simple scenario of GC:

Object A that has a reference to B that has a reference to C. When A goes out of scope, the GC can collect it. When it removes A, B is has a reference count of 0 and can also be removed and then likewise for C as B is removed.

Side question: does this happen in the same GC cycle or is this over three GC cycles?

Ok, simple enough. But how does the GC handle the following scenario:

Object A has a reference to B which has a reference to C. C has a reference back to B.

When A goes out of scope, is B available for the GC as it is still referenced by C? How does the GC handle these circular references?

Read More

Shane helps to shape the future

We just had Shane Morris come to my work to spend some time with us talking about UX. There was a statement he made that really stood out. It was something like:

Usability is the natural enemy of functionality. A successful application is usually one with features left out.

Hope I’m not misrepresenting him, but I think this is a really important point, especially when UX is normally a developer responsibility. Developers tend to cram in functionality because that is what the business spec told them to do.

From the developer community, and their managers, I think there needs to be more of a focus on what the final product will become (good or bad) rather than just ticking the boxes to say that we covered all the use cases. I think the key here is to have a change of perspective.

I have often thought that if you have developed the greatest software on the planet, but the UX is terrible, then you really missed the point (and wasted a lot of money/time). UX is just as important as every other piece of the software puzzle. I’m glad that this is becoming a bit more accepted in the industry.

Read More