Category name:.Net

Game studio express and XNA

Yesterday I posted about a news scoop at Ars-Technica referring Game studio express. Microsoft already posted a press bulletin about this at their site (here). But I wasn’t aware of this.

Rob Tillie mentioned in the comments that he doesn’t think that this is the successor.

I don’t think it has anything todo with KPL, it’s just VS with a couple of addons, so I guess we can write our new block buster xbox 360 game (which runs fine too on vista) in C# πŸ™‚

Well this is sort of the mission statement that the KPL team had when they were thinking about the next version because the current KPL is too restricted in it’s IDE when you want to take it a step further.

XNA brings xbox360 technology available on XP(+) and in a managed way. Previously we had Managed DirectX on top of DirectX but this isn’t really supported anymore AFAIK. We cannot use it for xbox360 development either because it lacks the xbox feature set. Although you could argue for hours about this :-).

So now we have XNA! A neat and nice managed environment but we don’t have the support from it from within Visual Studio. So Microsoft developed an extension called ‘Game Studio Express’ and not only does it support XNA it seemes that it also comes with some cool tooling like a modeller (why else would Autodesk be part of this). My guess is that is also has the nice high-level framework just like the KPL has to create tile based (horizontal/vertical scrollers) and (as Dennis said) simple 3d games with build-in physics which can be seen at the XNA Team Blog. The example at their site shows some sort of Marble Madness (a mid 80’s game classis) on steriods.

So I will download the bits on august 30 because the beta will then be available according the press item.

NDepend 2.0 beta

I just received a notification that NDepend 2.0 beta is released by Patrick Smacchie. NDepend analyzes your dotnet 1.x assemblies and outputs a huge set of code metrics based on the IL. It can also create a nice dependancy chart of your assemblies where you can see the references to external (framework) assemblies.

This 2.0 version now has a nice gui ala WinDirStat with the name VisualNDepend . It visualizes the complexity of your assembly which looks pretty cool. It has a query language so you can easily create queries. For example to focus on certain aspects in your code that you want to improve for simplified maintenance or just refactoring.

Just take a look at the toolset! Is really deserves your attention πŸ˜‰

WS-Addressing and routing is a pain in the ass

So here we have our nice soap 1.2 messaging standard. All works fine with encryption, signing, policies, end-points, validation, schema’s. Microsoft created most drafts for the WS-* specs I think and in time they were slowly change to requests from the market and WSE (wizzy) is a nice product of their effort. I know that we’ll get WCF in the future but that also has to work with the WS-* standards and doesn’t solve the problem I am currently having.

We start our adventure with a contract first design. We create a nice interface with mostly fat messages in a fire and forget fashion if possible and then start to implement the damn service. But then multiple systems start implementing the same service. Not a problem of course because the loosely coupled design of the contract first method is exactly the reason why we choose this.

Our client knows the interface and asks some kind of service locator for an end-point that knows this contract and voila we seem to have multiple implementations. This isn’t an issue when you are within one enterprise. You just configure to use just one implementation for your client. But now imagine that we want to connect multiple enterprises that all publish at least one service with this contract.

The question the client is having is "I want to communicate with enterprise X with contract Y and I want an end-point for that enterprise". Not a problem if system X is allowed to directly communicate with another system. The soap specs has the WS-Addressing for this. We have a Destination element that contains a uri for the service identifier (Address) and the end-point that knows how to process this message (Via). All is working fine if you can communicate directly through any transport mechanism. Doesn’t matter if it’s http, msmq, smtp, tcp, udp or in-process it just works.

But now we have this issue that says that all messages between systems pass a message broker. The sender knows where the message must be going (enterprise X) and know through which system the message must be routed being the message broker. I could those between the following implementations:
A – The client knows the exact end-point uri but sends it to the message broker and supplies it with meta-information to route the message (the soap service end-point that processes the message).
B – The client only knows the contract and no end-point and sends it to the message broker with meta-information about the destination enterprise (domain name for example)

1. In the first scenario (A) I would imagine that the client sends a the soap message to the message broker that just picks it up and sends it to the listener within enterprise X. It does this for example with meta-information in a custom soap-header within the soap envelope. The message structure stays the same and only the soap header gets slightly modified by the message broker.

2. Another option is that the client wraps up the message within another message. The inner message contains the actual message to be delivered to enterprise X. The outer message contains information where to route/send the inner message to. The message broker unwraps the outer message and sends the inner message to end-point for enterprise X that knows this contract.

3. In the second scenario (B) the client is unaware of end-point for enterprise X. It only knows that the message is for enterprise X. Here we can do the same two techniques as I just described.

I always try to reflect these kind of situations to everyday stuff. So this seems like the normal snail mail system we have. We write a message for a department, stuff the paper in an envelope and write the address of the organisation that should receive it on the envelope. We only know that mailbox in our street and only god knows how that envelope can get shipped that fast to the other side of the world. The envelope was never opened or  repackaged but it did travel by car, fan, plane or bicycle (the different transports). What did happen is that the envelope got wrapped in a container. This container could be the actual car, fan or plane. So you could say it got wrapped by the enveloper that is needed for that kind of transport.

This makes me quite confused to be honest….

But then I thought "those soap dudes that thought about the design of  WS-Addressing must have thought about it’s usage thoroughly". After googling for hours searching for examples and browsing the w3c documents I can just come up with one conclusion. WS-Addressing does not fix my problem.

I have found the most interesting posts about routing problems with WS-Addressing at Steve Main his blog:
 – [Adventures in Next-Hop Routing (part 1 of n)],
 – [Adventures in next-hop routing part 2: the return address rabbit-hole],
 – [Subsuming WS-Referral with WS-Addressing]

These are posted about 2 years ago but the best I could find.

With this information I come to the conclusion that the soap messages should not be wrapped within a new soap envelope. The existing soap envelope should be extended with end-point information and routing hints. But it seems that there isn’t a standard for this. I also found an msdn article [Moving from WS-Routing to WS-Addressing Using WSE 2.0] where they have the following example:


     <wsa:PortType xmlns:prefix0="urn:chat">prefix0:WseChatSoapPort</wsa:PortType>
     <wsa:ServiceName wsa:PortName="ChatPort" xmlns:c="urn:chat">c:WseChat</wsa:ServiceName>

But the sample is wrong especially with the contract first approach in mind. The To references a real end-point without service information. The rather strange thing is that the ReplyTo mentions a ServiceName. So.. shouldn’t this be there too in the To? And why do we have a Address and a To in the header?

I just want to have the following information in my envelope:
 – Service identifier ( urn:MyCoolContractFirstService )
 – A logical endpoint reference ( )
 – A physical endpoint reference that routes my message ( msmq://$/soaprouterincoming or like tcp://localhost:12345/soaprouter)

To be continued….

Kids programming language reminds me of Amos

I read the Z-Buffer blog once in a while and the Z-man refers to an article at channel9 about the KPL . It remembers me to the days that I was programming in Amos on my Amiga 500. I made all sorts of small fun things and coding in Amos is indeed FUN. They try to achieve that with KPL too and maybe this is the environment to recommend to people that want to play around in an IDE to find out what programming is all about. I occasionally get questions from friends about programming. For example what it is, where to start and such. Most people think programming is dull and boring while this is of course plain wrong (lol). The point is that I really can’t explain to them why am I so addicted to programming and why I am so eager to keep me up-to-date on certain aspects of programming. I am just too experienced in programming too explain it in dummy style because when I try that it is still way too advanced πŸ™‚

What is even more interesting is that they localized the KPL syntax if I heard them say in the video. This makes it even more accessible for people that aren’t really that good in English.

The next version (2.0) has wrappers around the managed directx framework and the way I see KPL is a fun addictive, environment to learn programming in your own native language. On the technical side it looks like a something between Amos pro and the 3d construction kit (also an Amiga game programming environment) but then a nice modern jacket.

They make it possible to generate vb/c# code from the KPL language and compile it with the .net environment. They made the KPL framework libraries available to .net applications to achieve this. This means that when people have advanced far enough in the KPL IDE they can learn new stuff, a new language, a new framework and even begin optimize their code which is awesome I think.

HttpHandler to format csharp, xml,, etc.

Today isn’t the best sunday in the Netherlands to enjoy the weather so that left me with the decision to do something usefull (like the household) or do some rainy sunday coding. I obviously choose the latter and that is the reason for this post.

I’m currently busy refining my home buildserver. Build results can be browsed as well as the sourcecode but the code didn’t get formatted. So wouldn’t it be handy if you have a HttpHandler that formats sourcecode like csharp,, xml (related) and html? So I started googling but could find one! So that left me with some work!

I based the HttpHandler on Manoli’s CSharpFormat class. There are three HttpHandlers available:

  • CSharpFormatHttpHandler
  • HtmlFormatHttpHandler
  • VisualBasicFormatHttpHandler

They resemble Manoli’s formatters if you didn’t noticed already….

You need to add Manoli’s CSharpFormat assembly and my Exyll.Web.HttpHandlers.Code assembly to you bin directory of you website. To make it all work you have to edit the web.config file and add the http handlers as shown in the web.config example Watch out that you don’t give access to your files that need to be secure!!!

After configuring all you need to do is test it! If everything works then you should see something like shown here.

Code formatter shown in action

Download the HttpHandler for csharp, xml and code formatting.
See an example web.config.

Sign your distributables free and easy!

I was using signtool.exe a while ago to see what it does and learned that it is a security tool to sign any executable or dll (thus not .net only). Maybe even other weird filecontainer formats that Microsoft made are supported.

Anyway, I was struggling with openssl and makecert alot to make it work. Well, not really struggling but if you don’t have a lot of PKI knowledge then your in for a treat! Months passed and then I found the nice and free certificate provider CAcert. I registered and scored enough points to get me a nice personally named certificate. The system is comparable with Thawtes web of trust but I think Thawte’s certificates can only be used for e-mail signing and encryption.

I am busy with a tool that can backup running virtual server machines. Don’t know if this functionality is already made by somebody or that it is available in the R2 release. More on this in a future post. I thought that it would be nice if would sign those assemblies and started signtool in the wizard mode.

    signtool.exe signwizard

It was really easy to sign my assemblies with my personal CAcert certificate. I really don’t understand why major software providers like Mozilla took so long before they started signing there Windows downloads when it is so easy to do.

The signwizard is a bit problematic in an automated build environment like a nightlybuild (or even better a nice continious integrated one). Luckily for us were also able to do all of this from the commandline.

    signtool.exe sign /a /d "Ramon Smits" /du  *.exe *.dll

This assumes that the certificate it stored in the personal store without
There is also a timestamp option. Verisign has a public timestamp service and you only have to add the following to make use of it.


After signing you can view the results by viewing the properties of your application and selecting the digital signatures tab that has become available. Selecting details will bring up the following dialog.

The most important thing about signatures is that you check if you trust the specified party including it’s certification path. Any application can have a valid certificate but that doesn’t mean I will trust everyone :-).

"After viewing the certification path I decided that I trust this dude…"

My favorite browser is FireFox but is has doesn’t have the nice security option that internet explorer has. When you download an executable with internet explorer and this executable is opened locally then you will see the following dialog.

Windows shows this message because Internet Explorer had added meta information about the download in an alternate filestream. Downloading it with firefox and then run it will not have any check performed. I don’t remember this very well but I think Windows Vista does show this message with any application. Clicking on the first url will navigate to (the /du param of signtool.exe) and the second shows the same dialog as explorer (Digital Signature Details).

A major benefit of codesigning downloads is that you can easily host your download at other locations without the risk that others can modify it. Downloaders have a quick and easy way to check it the download is valid and not been tampered with.

Use command line option ‘/keyfile’ or appropriate project settings instead of ‘AssemblyKeyFile’

I got the following error after converting an old project.

Use command line option ‘/keyfile’ or appropriate project settings instead of ‘AssemblyKeyFile’

So I did what it asked me and then suddenly it added my keyfile to my project! Well… that wasn’t really what I wanted because now it would be part of my project that is saved in my code repository (subversion by the way..). So I did a rollback (sometimes having version control is a big plus), run the build again and voila the warning appeared again. My fingers hit the F1 button to see what the microsoft help propaganda had to say about this and then the following text appeared:

There were security issues due to the attributes being embedded in the binary files produced by the compiler. Everyone who had your binary also had the keys stored in it.

Well I was in shock when I read this. But this is an error I presume? Shouldn’t this be "Everyone who had your binary also had the PUBLIC keys stored in it" ? Well I hope that is the case or else my strongnamed assemblies would be worth shit security wise!

So I continued reading and read the following:

There were usability issues due to the fact that the path specified in the attributes was relative to the current working directory, which could change in the integrated development environment (IDE), or to the output directory. Thus, most times the key file is likely to be ..\..\mykey.snk. Attributes also make it more difficult for the project system to properly sign satellite assemblies. When you use the compiler options instead of these attributes, you can use a fully qualified path and file name for the key without anything being embedded in the output file; the project system and source code control system can properly manipulate that full path when projects are moved around; the project system can maintain a project-relative path to the key file, and still pass a full path to the compiler; other build programs can more easily sign outputs by passing the proper path directly to the compiler instead of generating a source file with the correct attributes.

Well yes! Exactly.. that is why I wanted to use the attribute this way! πŸ™‚ But they are correct with all that relative path mess so I thought let’s install the keypair in a key container. This is all working well with the good old AssemblyKeyName attribute! But now again a compiler warning.

Use command line option ‘/keycontainer’ or appropriate project settings instead of ‘AssemblyKeyName’

So I browsed the project properties to see if there is an option to select a key container to sign the assembly but that isn’t possible. Opening the project file (*.csproj) revealed an element named AssemblyKeyContainerName but Microsoft Visual C# 2005 Express Edition doesn’t use it when compiling because the resulting output is still unsigned.

The help doesn’t show me how to use a key from a container so I am currently stuck with leaving the last warning as is.

If anybody knows how to solve this then leave your comment please πŸ™‚

I can atleast disable the warning with the new #pragma keyword (found that one here, it also shows a different settings screen then in VC#2005 ED).

#pragma warning disable 1699
[assembly: AssemblyKeyName(@"MyCoolKeyContainer")]
#pragma warning restore 1699

Debug and Release build in Visual Studio Express edition

So.. where did it go? It took me a couple of minutes to find it but it seems to be an "advanced" feature πŸ™‚

Go to:
Tools –> Options…

Check the ‘Show all settings’ box in the lower right corner

Then go to:
Projects and Solutions –> General

Check the ‘Show advanced build configurations’ box somewhere in the middle section.

Visual Studio Express advanced features
(Click to enlarge)

Now you will have the option to quickly toggle between debug and release builds in the toolbar and see all sort of ‘advanced’ features in the solution and project properties.

This also gives access to the option to use tabs instead of spaces. Don’t know why the default is spaces. I want to decide myself how many spaces a tab should be ;-).

String Resource Generator (SRG) and VS2005

I thought that VS2005 or well.. Visual Studio Express edition would have the string resource generator (SRG) feature build in. Turns out that it only has the resources as strongtyped properties and lacks the cool parameterized methods. So I installed the string resource generator but visual studio express edition couldn’t run it. Seemed that more people had problems with it when browsing the feedback. The problem is that visual studio doesn’t run/use generators from previous versions (VS2002/VS2003). I added the following  information to the registry to make it works again:

Visual Studio Express

Windows Registry Editor Version 5.00

@="String Resource Class Generator"
@="String Resource Class Generator"

Sorry for the bad lay-out but the "smart" editor that we use is a bit too smart so it f**ks up my post.

Visual Studio 2005

Windows Registry Editor Version 5.00
@="String Resource Class Generator"
@="String Resource Class Generator"

Sorry for the bad lay-out but the "smart" editor that we use is a bit too smart so it f**ks up my post.

You can also download the registry file here.

Christmass coding : RGB Plasma

It seems that I wasn’t the only one with some demoscene nostalgia as Frans was first today with his cheesy rotozoomer!

Way to go Frans! πŸ™‚ You can see his christmass coding rotozoomer here.

Well I was more in the mood for a simple plasma. I started with the usual math stuff like how did that cos / sin stuff worked and after that I had more questions like how to have a fps indepandant time correct effect and unsafe code for performance . But I wasn’t really satisfied with the standard XOR’ed circles and decided to use the RGB components and merge them. Below is a screenshot but I seriously suggest you download the archive and see it running.

Most code was written today but some was in the fridge for months. Waiting for a day to finish it and well.. today was the codes lucky day.

Download c# RGB plasma (needs visual studio express to build)

I also included a rotating star field as a bonus ;-).. it was the first effect to see if the crappy gdi based code actually worked. Right click the effect for a context menu to select the framerate. Press F12 for a bitmap save of the effect.

Effect source is included.

  • Recent Posts
  • Recent Comments
  • Archives
  • Categories
  • Meta