Archive for the 'Visual Studio' Category

Visual Studio 2010 and ALM

Thursday, February 25th, 2010

Today I was lucky enough to attend a Microsoft / Black Marble event at Edinburgh Waverly Gate on Visual Studio, Team Foundation Server (both 2010) and the general Microsoft ALM approach.

I have been using Visual Studio 2010 and Team Foundation Server 2010 since the Beta 1 days (for both!), so have a good knowledge of them both, but figured it was a good idea to go along and see what I was missing.

And it was worthwhile.

TFS and VS integrated beautifully. You really could not wish for a better combination.  TFS provides an amazingly extensible foundation for your company to base its source control on – but don’t be fooled – TFS is not just another Subversion. It offers the end to end ALM solution – full User Case, UML diagrams for planning, Work Item and resource tracking all built into a warehouse architecture expertly exposed through a combination of Reporting Server and Sharepoint (that hurts me to say … you know how much I dislike Sharepoint!).

One of the most manager friendly functions added in 2010 is the ability to link query data out from TFS to Office products – from Excel to Project, your line manager can now manage you in their comfort zone. Maybe it’s a good idea, maybe not. One thing that was mentioned today was that anything that stopped them constantly asking “how’s it going” was probably a good. Now that is something I can certainly agree with! Getting decent reliable information out to project stakeholders has always been a challenge.

The demonstration of the new Microsoft Test Manager was very impressive too – finally something to allow us to document test scripts (you know those things that you get testers to follow, right?) and have an easy to use framework the testers can use to step through them (and it captures bugs – complete with relevant tracing information!) is incredible. Oh and it all links back to TFS and your dev team. Imagine it, dev’s talking to testers. Whatever next? Removal of management? Maybe not – someone has to read the reports after all :)   What they DO have coming is automated testing – macro-esque based visual UI testing. Currently only available for Winforms app and ASP.NET websites, but reliably confirmed as hopefully getting Silverlight support for RTM. I’m waiting with baited breath – this could potentially save me a LOT of hassle.

Blend SketchFlow is pretty impressive for mock applications too … but I still don’t see it being able to unseat the larger one’s out there in this niche market, such as Axure.

The one thing that seems to missing in all of the ALM solutions I’ve used in my career so far is an effective Release management tool.

But more on that later :)

Silverlight, Cross Browser issues with GetElementById

Wednesday, February 24th, 2010

I’ve recently spent some time tracing cross browser issues with Silverlight 3, and one in particular irked me a little.

With one project, I used the HtmlPage.Document.GetElementById managed code to get information (and ultimately set them) in HTML pages.

However, it seems this does not work properly with Chrome and Firefox. On the surface it all seems to work fine, however, settings values definitely was not working as it should.

So, the work around is a basic JavaScript function such as :

function getValue(elementName) {
var result = document.forms[“formhere”].elements[elementName];
if (result != null) {
return result.value;
}
return “”;
}

And then calling out to this using HtmlPage.Window.Invoke(“doSomething”);

This works :)   A bit messy, but at least it DOES work reliably, unlike the built in GetElementById. Here’s hoping it’s fixed in Silverlight 4.

Windows Azure: Now with OS Version Control!

Tuesday, January 12th, 2010

I expect many developers have been watching the maturation of the Windows Azure platform through its CTP to the recent release – and they may have wondered how we can control what exactly our applications are running on. I mean, what if Microsoft decide to change the operational behaviour of the operating system that your product is operating on – such as they did when they upgraded the Azure toolset last time.

Well, now they have given us a way to control these updates – at least, all the minor ones – critical ones would still override these settings.

For details, checkout this page on the MSDN site: http://msdn.microsoft.com/en-us/library/ee758710.aspx#ServiceConfiguration

Code Regions – Their use and misuse

Wednesday, December 9th, 2009

Over the last few evenings I have been reviewing code done by a fellow developer, and have come to a conclusion.

The .NET code regions (aka Collapse Regions, Collapsible blocks and dear god knows what else in other languages) can really be misused.

Correct use of regions can group common sections of code – for example code that all interacts with the same property (you might have the property itself and also a number of private functions that work with or derive from the property), for improving readability (yes, we all know that we should not have units / classes that size but we all have right?) and generally for being neat (it is cool seeing it all shrink down isn’t it?). BUT, likewise you can seriously go overboard.

This code in question has many levels of nest regions, and although it certainly does tidy the code up, it certainly does not help it’s maintainability.

I’m sure I’m not alone in the fact that I typically use a lot of keyboard shortcuts when I’m developing, but adding many many many regions, with many layers of nesting, this makes keyboard shortcuts for the region collapse / expand pretty useless. No matter what you do, you always seem to end up with too much or too little code on screen – either way, it makes development difficult.

Which brings onto a final point … if this is the case (i.e. the code is damn near impossible to understand at a glance due to the structuring in place), doesn’t this qualify as un-maintainable code?  Perhaps we should be setting up rules on TFS and the like to detect the layers of nested regions, and flag them for review when it sees someone going to excess?

Comments, as always, welcomed :)

Visual Studio 2010 Beta 2 and November Release of Azure Tools

Monday, November 16th, 2009

I’ve just had a slight dance with the new release of the Azure Tools (that adds VS 2010 Beta 2 compatibility), and thought I would quickly note down the issues I hit – and of course the solutions!

First off, as you can expect, a few things have been renamed:

RoleManager is now RoleEnvironment
ILocalResource is now LocalResource

Don’t forget to release the release notes and recreate your local dev storage databases … but watch out – the command is incorrect – the docs are missing a colon! The command should be dsinit /sqlinstance:<instance>.

More Annoying Errors – MS Azure Related (again)

Wednesday, September 9th, 2009

Argh – trying to debug an application locally with the Azure Dev Framework, and got this:

image

Yet another really helpful error message guys. Surely in dev stuff (and CTP’s) it’s worth actually giving lots of error data – at least we might understand it and be able to submit more detailed reports back :)

Quick and Simple list paging in WCF

Monday, August 24th, 2009

I had to come up with a quick way to do paging of a List of objects today as we have been hitting the packet limit on WCF – we could have easily increased the limit, but in my opinion this just masks the error and doesn’t actually fix it.

Anyway, the quick solution that I implemented is roughly as follows:

Change the interface definition on the WCF to allow you to pass in a page number

In your Data Access Layer code, take the page number and do something like:

int skipCount = (pageNumber – 1) * pageSize;

foreach (Signup alpha in webDal.Signups.Skip(skipCount).Take(pageSize))
{
// Do something else where
}

As you can see – very simple, no fuss and uses Linq. And in theory it shouldn’t load SQL either thanks to the Skip function.

I believe the RIA Services toolkit is going to have paging in there, but I don’t want to switch everything over right now ;)

Silverlight 3 changes networking stack

Tuesday, August 18th, 2009

One thing that might have managed to slip under people’s radar (and certainly did mine until this morning) is that Silverlight 3 changes the network stack options.

No longer are we tied to having the host browser carrying out the HTTP communication for us (and the subsequent issues with browsers such as Chrome and Firefox) – now Silverlight can natively handle the communications.

This also opens up the use of REST services.

Interesting development – I haven’t had a chance to test it yet, but I’m hoping that it does actually work, and fixes some of the compatibility issues that we have seen.

For more information, checkout http://blogs.msdn.com/silverlight_sdk/archive/2009/08/12/new-networking-stack-in-silverlight-3.aspx

Exceptions In Blend

Wednesday, August 5th, 2009

I am sure that everyone reading this (who has used Microsoft Expression Blend at least) has encountered the following error message:

image

You probably groan too when you see it. Where do you start looking … is it XAML related, or is it code …

Well, the answer is actually fairly simple. Debug blend.

Load the project in both Visual Studio and Blend.

Compile it in Blend.

In Visual Studio – attach the debugger to the running process of Blend – click Debug, Attach to Process and select Blend.

Now open the rough control / page / whatever in Blend.

And witness the exception (complete with details!) in Visual Studio.

Happy debugging :)

Silverlight 3 and Binary Bindings

Thursday, July 16th, 2009

One of the tasks on my todo list has been to switch our Silverlight project at work from basicHttpBindings in WCF to the new Binary Binding – which should hopefully reduce network traffic, improve security etc etc.

I was kind of dreading this task, expecting it to be truly awkward, but in actual fact it was a piece of cake.

Two major steps:

1. Update the web.config file for the service, replacing the binding details with the new structure detailing the binary binding, and changing the endpoint. For example:

The original binding had:

<basicHttpBinding>
    <binding name="Application.Binding">
        <security mode="Transport">
            <transport clientCredentialType="None" proxyCredentialType="None" realm="" />
        </security>
    </binding>
</basicHttpBinding>

With the endpoint defined:

<endpoint address="" binding="basicHttpBinding" contract="Application.IApplication" bindingConfiguration="Application.Binding">
    <identity>
        <dns value="localhost"/>
    </identity>
</endpoint>

To switch this to binary binding, simply add:

<customBinding>
    <binding name="Application.BinaryBinding">
        <binaryMessageEncoding />
        <httpsTransport />
    </binding>
</customBinding>

And use this new binding as follows

<endpoint address="" binding="customBinding" contract="Application.IApplication" bindingConfiguration="Application.BinaryBinding">
</endpoint>

Note that both of these binding definitions are running on SSL; if you wanted to run the binary binding on http, simply drop the “s” from the line <httpsTransport />.

2. Refresh the service references in Visual Studio.

Thats it!