It's not really SP1, it is a hotfix rollup that addresses a number of issues in Visual Studio 2008. It can be downloaded from here.

Check the installation instructions, particularly if you are running on Vista with UAC enabled, here.

The issues addressed in this hotfix include:

HTML Source view performance

  • Source editor freezes for a few seconds when typing in a page with a custom control that has more than two levels of sub-properties.
  • “View Code” right-click context menu command takes a long time to appear with web application projects.
  • Visual Studio has very slow behavior when opening large HTML documents.
  • Visual Studio has responsiveness issues when working with big HTML files with certain markup.
  • The Tab/Shift-Tab (Indent/Un-indent) operation is slow with large HTML selections.

Design view performance

  • Slow typing in design view with certain page markup configurations.

HTML editing

  • Quotes are not inserted after Class or CssClass attribute even when the option is enabled.
  • Visual Studio crashes when ServiceReference element points back to the current web page.

JavaScript editing

  • When opening a JavaScript file, colonization of the client script is sometimes delayed several seconds.
  • JavaScript Intellisense does not work if an empty string property is encountered before the current line of editing.

Web Site build performance

  • Build is very slow when Bin folder contains large number of assemblies and .refresh files with web-site projects.

Cheers,

Robert Porter


 
Categories: .NET | Visual Studio


If you get this error trying to set and hit a breakpoint, there are a couple of things to look for to resolve it. Typically what this error means is that the compiler cannot find debug information for the file you are trying to set a breakpoint in.

The first thing to check is that you have compiled the assembly in debug mode.

image

If you build the assembly in Release mode it will not generate the necessary debug information. Also be aware that there are two modes the compiler can use to generate the necessary program database (pdb) file for debugging, but only one of them actually enables incremental linking of the debug info.

/debug:full or /debug:pdbonly. Building with /debug:full generates debuggable code. Building with /debug:pdbonly generates PDBs but does not generate the DebuggableAttribute that tells the JIT compiler that debug information is available.

Depending on how you are building your solution you either need to look at the msbuild file or if you are building from within Visual Studio you can right click the project file and select properties. Then select the Build tab, and then the Advanced button. You will get the following dialog (VS2008, 2005 may look slightly different.)

image

Notice under Output the line for Debug Info, make sure this is set to full. The other values available are none, and pdb-only. Neither of the latter two values will result in debuggable code.

The next most common cause is that the [assemblyname].pdb file is not being copied or updated correctly to the bin folder of the startup project in a multi project solution.

You can manually copy the assembly file and the pdb file from the bin folder of the assembly you want to debug into the bin folder of the startup or calling project. Or into the web application bin folder if you are calling the assembly from a web application.

Thanks to Adam McKee of Ironworks who recently reminded me of the fix for this problem. I have put the information here to hopefully help the next person.

Cheers,

Robert Porter


 
Categories: .NET | C# | Debugging | Programming | VB.NET | Visual Studio


May 10, 2008
@ 07:04 PM

There are a number of add-on's for Fiddler, and every time I have to install Fiddler on a new machine I am always surprised when I go to use an inspector only to find out it is not there.

The best source of information for Fiddler Add-On's is the Fiddler Web Site itself. There is an Add-On link from the home page.

My favorites are:

The Syntax View Inspector

syntaxview

This add-on shows you syntax colored views of the captured session traffic.

 

The Web View Inspector

WebView

This inspector shows you the session data as it would be rendered via IE's rendering engine.

These are only two of the many available add-on's for Fiddler. But they give you a feel for what is available, and of course if there is a feature you want or need that is not already available, you can always write your own inspector!

Step by step instructions on building your own inspector are available here. Fiddler can be extended with .NET code or by using it's own built in Fiddler Script engine.

Cheers,

Robert Porter


 

I can never remember what features exist in each of the many versions of Visual Studio. And 2008 added many new editions.

Luckily Microsoft has published a comparison matrix for our reference, it can be found here.

Click the plus sign in the boxes next to each category in order to see the feature comparisons in tabular form.

Cheers,

Robert Porter


 
Categories: .NET | Misc | Visual Studio


My first project at Ironworks also involves my first experience with Commerce Server from Microsoft. I had not previously worked with Commerce Server so it has been a bit of a learning curve.

I expect to blog about my experiences with this product as I reach a point where I have something significant to say about it. For now I am very much in learning mode.

The other technology areas this project involves are ASP.NET, Plumtree Portal, Javascript, and some BizTalk integration. With the exception of Plumtree I am familiar with the remaining technologies. May or may not post about Plumtree, as I have to say I am less than impressed. I think Sharepoint does a better job than what I have seen of Plumtree but will reserver final judgment for later.

Cheers,

Robert Porter


 
Categories: .NET | ASP.NET | Javascript | Programming | Commerce Server | C#


February 12, 2008
@ 10:58 AM

 

I have stumbled on, been emailed about, or otherwise notified of several interesting new resources of interest primarily for Microsoft Developers. So I thought I would share them here.

MSDN Code Gallery

The newest addition to the ever growing collection of MSDN resources is the MSDN Code Gallery. The code gallery contains code of course, along with video tutorials, sample applications and lots of other resources. It supports user uploads as well, so count on the gallery growing over time. From a rather quick look see on my part it does seem to contain some worthwhile resources.

MSDN Reader

If you have used or seen the New York Times reader then you will instantly recognize the new MSDN Reader. It is a WPF based application that allows you to read MSDN Magazine online. It appears that you do not have to have a subscription to use this, however I am unsure if that will remain true. But it is certainly worth a look.

MSDN Windows Vista Developer Center

This site has recently been overhauled significantly and (to me) seems easier to navigate and find information on. The Windows Vista Developer Center is full of resources related to developing applications that run on Vista and take advantage of features available in Vista as well as the recently launched Windows Server 2008. Of interest on this site was the announcement that SP1 for Vista has been released to manufacturing. Most folks don't consider an operating system or application as truly viable until at least the first service pack. So if you have been waiting for SP1 to look at Vista, your wait is over.

Hopefully one or more of these resources will prove useful to you!

Cheers,

Robert Porter


 
Categories: .NET | Ajax | ASP.NET | Programming | Reviews | Tools and Toys | VB.NET | Visual Studio


 

I had need to be able to play a video file (both mpg and wmv) in a WinForms application recently. I thought it would be rather straightforward, and for the most part it was. However there were a few gotcha's I ran into so I thought I would document them here in case anyone else runs into the issue. Also, if anyone knows a better way please let me know.

One of the conditions I had to meet was that the video file had to play in a loop continuously, as the application is designed as a Kiosk application. Another condition was that I did not want to display any of the UI controls, just the video itself to avoid users stopping or otherwise altering the video playback.

I decided to use the ActiveX (COM) version of the control for simplicity, so I right clicked the Toolbox and selected the Choose Items option and on the resulting dialog box I selected COM Components, scroll down and select Windows Media Player: (Click on the image to see it full size.)

image

Once that is done we drop the control onto the form, and set it's properties as needed. Some of the properties that I set at design time are shown below:

image

Notably, I set FullScreen to false, and uiMode to none which means that there will be no visible interface, Play, Stop etc will not be displayed to the user allowing me to have more control over the end user experience.

It is important to note that uiMode is not a drop down in the designer, the relevant values for this property are:

  • invisible - Windows Media Player is embedded without any visible user interface (controls, video or visualization window).
  • none - Windows Media Player is embedded without controls, and with only the video or visualization window displayed.
  • mini - Windows Media Player is embedded with the status window, play/pause, stop, mute, and volume controls shown in addition to the video or visualization window.
  • full - Default. Windows Media Player is embedded with the status window, seek bar, play/pause, stop, mute, next, previous, fast forward, fast reverse, and volume controls in addition to the video or visualization window.
  • custom - Windows Media Player is embedded with a custom user interface. Can only be used in C++ programs.

I chose none because I wanted to preserve the option of allowing the interface to be shown for administrative users without messing up the visual layout, none reserves the space necessary to display the UI controls.

With the design time properties set I then wrote the following code to load and play a video file:

   1:          wmpMain.URL = mConfig.VideoFile
   2:          wmpMain.settings.setMode("loop", True)
   3:          wmpMain.settings.autoStart = True
   4:          wmpMain.Ctlcontrols.play()
 

mConfig.VideoFile is a string property that contains a fully qualified path and filename and is used to set the file to be loaded. The second line of code was the tricky part for me, searching for various combinations of .NET and play video in a loop etc resulted in lots of examples of embedding the player in a web page with an attribute called "loop" set to true, but I could not figure out how to implement that in a WinForms version.

Eventually I stumbled on the setMode reference which is rather vague when it comes to intellisense. The available setMode settings are:

Syntax: player.settings.setMode(modeName, state)

    Parameters

    modeName (one of the following)

  • autoRewind - Mode indicating whether the tracks are rewound to the beginning after playing to the end. Default state is true.
  • loop - Mode indicating whether the sequence of tracks repeats itself. Default state is false.
  • showFrame - Mode indicating whether the nearest video key frame is displayed at the current position when not playing. Default state is false. Has no effect on audio tracks.
  • shuffle - Mode indicating whether the tracks are played in random order. Default state is false.
  • state - Boolean specifying whether the new specified mode is active or not.

So in a nutshell that is the basics of getting a video (or audio) file to play in a loop in a WinForms application. There is a lot more you can do with the player, you can programmatically create playlists, react to events the player raises etc. But this illustrates the basics.

Cheers,

Bob Porter


 
Categories: .NET | Programming | VB.NET | Visual Studio


Microsoft has released a number of exciting new tools and technologies that certainly bear some watching! These are preview releases so the usual caveats apply about installing these on a production system.

The "home" page for Microsoft's Data Platform is here and it contains the most up to date information about the various shiny new pieces.

The main bits are ADO.NET Entity Framework Beta 3, ADO.NET Data Services CTP1, and ADO.NET Entity Framework Tools CTP2.

So what exactly is the Entity Framework? It's a toolset and framework that enables a developer to visually design and model data driven applications, both forms based and web based.

Collectively these technologies are part of the ASP.NET 3.5 Extensions which are in preview mode at the moment. Combined these technologies allow a developer to expose data from their applications in well known formats, some of which are not Microsoft specific such as JSON and REST and also in standards based formats such as XML.

There are a number of QuickStarts that the ASP.NET team has made available. Also as part of this release the ASP.NET MVC framework is available.

Go check it out!

 


 
Categories: .NET | ADO.NET | Ajax | ASP.NET | Programming | SQL | Visual Studio


Ray Ozzie proposed his concept of Simple Sharing Extensions back in 2005, and then more or less went silent. Until now!

Another Live Labs technology preview release arrived this week. It's called FeedSync and it is the current incarnation of the concept Ozzie developed to allow data sharing over web protocols like RSS.

The initial specification is available as version 1.0 at the time of this writing. It extends both the Atom and RSS specifications to incorporate item sharing which Microsoft defines as "bi-directional, asynchronous synchronization of new and changed items amongst two or more cross-subscribed feeds".

(Hmmm, calendar sharing anyone?)

The samples in the specification deal with a fictional task list example. Here is the code (emphasis added) for the sample RSS feed.

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:sx="http://feedsync.org/2007/feedsync">
 <channel>
  <title>To Do List</title>
  <description>A list of items to do</description>
  <link> http://example.com/partial.xml </link>
  <sx:sharing since="2005-02-13T18:30:02Z"
    until="2005-05-23T18:30:02Z" >
   <sx:related link="http://example.com/all.xml" type="complete" />
   <sx:related link="http://example.com/B.xml" type="aggregated" 
    title="To Do List (Jacks Copy)" />
  </sx:sharing>
  <item>
   <title>Buy groceries</title>
   <description>Get milk, eggs, butter and bread</description>
   <sx:sync id="item_1_myapp_2005-05-21T11:43:33Z" updates="3">
    <sx:history sequence="3" when="2005-05-21T11:43:33Z" by="JEO2000"/>
    <sx:history sequence="2" when="2005-05-21T10:43:33Z" by="REO1750"/>
    <sx:history sequence="1" when="2005-05-21T09:43:33Z" by="REO1750"/>
   </sx:sync>
  </item>
 </channel>
</rss>

Notice the namespace reference sx=http://feedsync.org/2007/feedsync the "sx" prefix is the one designated in the spec.

FeedSync supports multi-master topologies which means it can be used to send and receive data to multiple clients. An example topology is shown below, (image from Microsoft's web site.), as you can see clients can be bi-directional or pull only.

feedsyncdiagram

The possibilities are many, I am already thinking about using this technology to allow calendar syncing between Google Calendar, and Outlook. Another thought that jumped to mind would be to allow sharing appointment data for a centralized calendar among a group of subscribers on a project I am working on.

Best of all, the technology has been released and licensed under a Creative Commons license which means the technology is likely to be extended.

The best place to start looking for developers is the FeedSync For Developers page.

Have fun! Share with me your observations and ideas!

Cheers,

Robert Porter


 
Categories: .NET | Mobile | Programming | Reviews | Tools and Toys | Visual Studio | XML


December 7, 2007
@ 10:01 AM

Microsoft has released a Live Lab's (Microsoft Research and Live Services) preview technology package called Volta.

Volta is a framework that allows a developer to potentially build a multi tier application initially as an client application, and then use a technique called "declarative tier-splitting" to identify which pieces of the application run on a server and which pieces run on the client.

This is accomplished by using and XML like declarative markup within the code. With this approach a developer can focus on getting the application designed and functional and then let Volta split the tiers and create the communications "glue" that lets the applications tiers work together.

How this is accomplished is rather interesting, Microsoft decided to go with an MSIL based approach, mostly accomplished in the post compilation area. MSIL code is rewritten to run in Javascript for the client, and ASP.NET for the server side, typically as a web service.

Since Volta works it's magic at the MSIL level, any CLR targeted language is supported, C#, VB.NET, IronPython and others. Visual Studio 2008 is required at this stage, 2005 is not supported and it is unclear if it will ever be.

So show me some code already!

The code shown below is from the Volta Recipe's page. It shows the [RunAtOrigin] custom attribute in use.

namespace VEMashup.Weather
{
    [RunAtOrigin]
    public class WeatherSvcProxy
    {
        public string GetJsonWeatherInfoFor(double lat, double lng)
        {
            var baseUri = @"http://ws.geonames.org/weatherIcaoJSON";
            var uri = baseUri + "?lat=" + lat.ToString() + "&lng=" + lng.ToString();
            var xhr = new Microsoft.LiveLabs.Volta.Xml.XMLHttpRequest();
            xhr.Open("GET", uri);
            xhr.Send();
            if (xhr.Status == 200)
                return xhr.ResponseText;
            else
                return null;
        }  
    }
}

 

This is an example of "tier splitting" via markup. This tells the Volta framework that this code is destined to run on the server. Code not marked will continue to run on the client. This means that as a developer you can postpone deciding how and where to partition your application until the last minute.

The agile developer in me seriously enjoys this particular aspect! Volta technology is seriously early in the life cycle however, so bear in mind that this will change before it gets released.

There is a handy list of known issues you should review before you start playing with the framework.

You could think of Volta as architecture refactoring on steroids. As shown below Microsoft has designed it explicitly with that in mind. (Image from Volta Web Site.)

image001

Bear in mind that you are not limited to 2 tiers, you can retarget portions of your application to as many tiers as you want!

All in all I think this bears some watching!

Cheers,

Robert Porter


 
Categories: .NET | Agile | ASP.NET | Javascript | Programming | Reviews | TDD | Tools and Toys | VB.NET | Visual Studio | XML


By now everyone knows that Visual Studio 2008 has launched, along with the .NET Framework 3.5. This version, previously known as 'Orcas', brings some significant new capabilities with it.

But first things first, installation and out of the box impressions.

I installed 2008 on a system that was clean in the sense that it had never had any of the pre-release versions of Orcas installed on it. I used the Virtual Machines that Microsoft provided to play with the pre-release versions. Wonderful idea judging by all the recent blog posts on how to uninstall the beta's before installing the final release.

If you do need help uninstalling the beta's in order to get the final production version installed, ScottGu has an excellent post on the topic.

Microsoft's official 2008 site has a great deal of good information, tutorials and other examples to peruse, I strongly recommend you check it out.

Anyway, I installed, from a DVD image I burned from the ISO file I downloaded from MSDN. I installed the Professional edition as I do not have access to a Team Foundation Server.

Installation was NOT smooth, the install kept crashing trying to install the .NET Framework 3.5 which was one of the very first steps. So I tried downloading and installing the Framework directly, which also failed.

Looking at the log files I was surprised to see that it was complaining that the 3.0 Framework SP1 was not present and that 3.5 considered that a pre-requisite for installation. Since I was running Vista which came with 3.0 pre-installed I was surprised as I check Microsoft Update weekly and I was sure the SP1 patch had already been installed.

I finally rebooted and logged in as Administrator and re-installed the standalone version of 3.5 again, this time it worked fine. Then I installed 2008 still logged in as Administrator and again everything went fine. The install, including the new MSDN library took slightly over 2 hours.

Once everything was installed I fired up the IDE which took another 10 minutes to configure itself based on my environment selections. Once it was finally up I was able to begin playing around a bit.

The IDE is very similar in appearance to 2005, in fact it is identical, at least initially. The first time I noticed a significant difference was when I opened a project. Visual Studio now uses the native file dialogs as opposed to it's own custom versions. (This is true on XP as well.)

image This is a welcome change especially on Vista as it allows all the functionality of the file dialogs that Windows provides.

There are numerous changes under the hood of course, and many many changes and new features in the languages and Framework which I hope to touch on in a future post.

One other thing I noticed was the fact that Visual Studio now seemed to be a lot faster to load. This is of course a welcome change!

One of those buried features is very welcome and much talked about, multi-targeting! As you can see from the screen shot below this allows you to target an imageapplication at the following frameworks:

2.0, 3.0 or 3.5

This means you can continue working on your 2.0 or 3.0 projects using the newer IDE. Rick Strahl has a great post on moving projects between 2005 and 2008 and back. Basically the project format has NOT changed, and the Solution file changes are minor. This means that you can work on 2.0 targeted applications in either 2005 or 2008 with no particular problems.

I was able to open several 2005 projects, work on them, compile them, run and debug them with no issues. I opened WinForms, ASP and Class library projects with no issues.

One annoyance I did notice was that the help library was much slower to open and seems prone to hanging. The MSDN library is fine when launched standalone, but when launched from within the IDE it is slow to actually show up.

More to come in the next post! Stay tuned.

Cheers,

Robert Porter


 
Categories: .NET | Reviews | VB.NET | Visual Studio


November 16, 2007
@ 04:00 PM

I just came across this site and the resources contained for the first time today! Thanks to post by Robert C. Cain better know (at least by me) as Arcane Code.

Take a peek at the .Net University web site and materials, it is well worth the visit!

The available courseware is freely downloadable and they allow it to be "re-delivered" to technical audiences.

Their mission statement gives a pretty good idea what they are all about:

Welcome to .NET University! Our mission is very simple. We want to give you a good developer-oriented overview of new and emerging Microsoft technologies.

This site has been added to the bookmarks!

Cheers,

Robert Porter


 
Categories: .NET | Programming | Rave | Reviews | User Group | Visual Studio


I was recently refactoring some code in a Web Service that is called by numerous external consumers as well as internal clients. As we all know when you publish an interface you are more or less signing a contract not to change that interface. This becomes even more of an issue when clients outside of your organization are calling your code.

Or perhaps you have written and distributed an SDK or API that is used by others to access functionality in your application. Either way, you change such public facing interfaces at your peril! It's why you often see method names like the following in public SDK's:

ShinyMethod
ShinyMethod2
ShinyMethod3
NewShinyMethod

This results from having realized, after the fact, that your public interfaces were unable to do something you want/need them to. Or perhaps something you are calling changed and now you need more information or different parameters than before. Whatever the reason since you signed the contract, you had to implement different methods leaving the old ones intact so that you don't break every caller instantly during your next update.

This is a legitimate response to a common problem. Now don't start screaming at me about better design, overloading methods etc. I know there are dozens of ways to tackle issues like these. I am using this as an example about how to notify your callers that you are about to "renegotiate" your contract in a gentle kind manner!

So, let's say you have a method, called MyShinyMethod that takes two integers and a string as parameters. For 6 months or so that method has sufficed to handle it's intended function. Then one day you get a call from accounting telling you that now you need to handle two integers, 1 string and a double! Ah, you say, no problem and add an overload to your method.

Then, sometime later accounting and marketing call, now the calling programs need to be able to pass 2 doubles, 3 strings, and a boolean and return an XML file.

Ok, you see where this is going, you really can't continue to handle this with overloads, and what you really want to do is change your public interface. But you can't do that, at least not immediately. So we need a way to tell all our callers that we are going to change our interface. In comes the "Obsolete" attribute.

You build a new version of you service, with the existing public methods you had, and you add a new even shinier method called MyNewShineyMethod that is designed to take just about anything and return even more!

Now we need a way to notify existing clients that there is a new method in town, and that the old method will soon be leaving!

Your old method would look something like this:

Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
     'do something cool here
     Return True
End Function

 So now you add your new method, and need a way to tell your callers that they should start to use the new method, and get ready to stop using the old one:
 <Obsolete("This method is not so shiny anymore, start using: MyNewShinyMethod")> _ 
Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
'do something cool here
Return True
End Function
Public Function MyNewShinyMethod(ByVal params As Collection) As String 
'do something cooler here
Return ""
End Function

Now when users compile their applications that call your service, they will get a warning error if they are using the old version with the text you supplied with the Obsolete attribute. They can still compile run and call the method, but they will begin to see the "error of their ways" in the form of compiler warnings.

Now, eventually you want to be able to "retire" the not so shiny method. Change the attribute as shown below, and instead of warnings, the caller will get Errors!

 <Obsolete("This method is no longer available, use: MyNewShinyMethod instead.", True)> _ 
Public Function MyShinyMethod(ByVal int1 As Integer, ByVal int2 As Integer, ByVal str1 As String) As Boolean
'do something cool here
Return True
End Function
Public Function MyNewShinyMethod(ByVal params As Collection) As String 
'do something cooler here
Return ""
End Function

By adding the "true" parameter we are telling the IDE in the calling applications to flag this as an error and not allow compilation. But the error message shows the caller what to use instead!

Hope this helps!

Cheers,

Robert Porter


 
Categories: .NET | Agile | Programming | Visual Studio


October 25, 2007
@ 10:38 AM

Ever been stepping through code using F10 and F11 and forget to step over something that you did not want to step into? Like a whole series of Get/Set calls on a bunch of properties for a class that you know is fine?

You can control what the debugger steps into by using method attributes and decorations. Using these you can essentially make parts of your code invisible to the debugger.

The first one I want to discuss is the <DebuggerStepThroughAttribute>. Using this attribute will prevent the debugger from stepping into the code it is applied to.

VB.NET

Private ReadOnly Property LastName() as String
     <DebuggerStepThroughAttribute()> _
     Get
           LastName = m_LastName
     End Get
End Property

C#

private string LastName
{
    [DebuggerStepThroughAttribute()]
    get
    {
         LastName = m_LastName;
    }
}

With the above you can still set a breakpoint inside the methods and execution will stop when the breakpoint is reached. If you want to make the code completely invisible to the debugger including not being able to set breakpoints then use the second attribute.

<DebuggerHiddenAttribute>, This attribute will essentially hide the methods it is applied to from the debugger entirely. 

 

VB.NET

Private ReadOnly Property LastName() as String
     <DebuggerHiddenAttribute()> _
     Get
           LastName = m_LastName
     End Get
End Property

C#

private string LastName
{
    [DebuggerHiddenAttribute()]
    get
    {
         LastName = m_LastName;
    }
}

Note that in order to get the debugger to honor these attributes you need to turn off the "Just my Code" option in Tools|Options|Debugging Options.

Oh, and finally you need to import the System.Diagnostics namespace for this to work at all.

Hope this helps, I know I use it a lot, once I knew it existed.

Cheers,

Robert Porter


 
Categories: .NET | Programming | Visual Studio


Scott Hanselman and ScottGu did a recent public presentation on the new Model View Controller Framework implementation that Microsoft is developing.

Scott has a post with some links to videos of the presentations as well as some great background information.

Roy Osherove has a post about this as well, it can be found here. While MVC has been around for quite awhile now, this is the first time Microsoft has officially supported the concept as opposed to their own Frameworks. I think it is worth reading up on, especially if you are a web developer.

Cheers,

Robert Porter


 
Categories: .NET | ASP.NET | Programming | Visual Studio


September 25, 2007
@ 12:10 PM

Matt Blodgett posted an very timely (for me) on an issue with debugging web applications on Windows Vista. Read the full article on his site, but if you are having issues where VS2005 mysteriously leaves debug mode while you are sitting on a line of code this is your answer!

Cheers,

Robert Porter


 
Categories: .NET | ASP.NET | Programming | Visual Studio


September 23, 2007
@ 10:39 AM

I would have to say that I have become a convert to TDD concepts. I have used NUnit, and mbUnit testing frameworks to varying degrees for some time. Now I use them daily and am working to increase my coverage in all my projects.

Since I primarily develop in the .NET Framework I have particular interest in the unit testing frameworks available in that environment. As I mentioned in a previous post I have currently settled on mbUnit as my unit testing framework.

xUnit is a new framework developed by, among others, James Newkirk and Brad Wilson. James was one of the original authors of NUnit and is now a Microsoft employee. Brad Wilson also works for Microsoft. Together they have created what looks to be a very well thought out testing framework.

xUnit is currently being hosted on CodePlex and is distributed under Microsofts Permissive License (The borgs version of Open Source).

The framework has already been integrated with TestDriven.NET, and has it's own console runner, but no GUI runner yet.

Roy Osherove has a series of posts about his view on xUnit, and both James and Brad have blogged about it as well. The first post of interest to me was this one, then check this one.

After reading all the various points of view on this topic here is what my take away is so far. xUnit is a conscious choice to re-invent a testing framework that is not just another port and extension of JUnit. It features design changes to bring it more in line with where the .NET Framework is, and is heading. Examples of this are the use of Generics and Anonymous Delegates in Asserts.

They have also removed a great number of what they consider extraneous attributes see the quote from James post below:

    • [TestFixture] was removed entirely, so tests can be anywhere.
    • [Ignore] is expressed using the Skip= parameter on [Test].
    • [SetUp] and [TearDown] are removed.
    • [ExpectedException] was replaced with Assert.Throws.
    • [TestFixtureSetup] and [TestFixtureTearDown] are instead expressed as implementations of an interface (ITestFixture).
    • Support for IDisposable was added for tests.

This kind of thinking and approach is long overdue in my own opinion. It will be interesting to watch as the project matures. I have begun playing with it myself and so far I find it a lot more intuitive than any of the JUnit derivatives I have used in the past.

While I like mbUnit I have always had to think harder than I feel I should in order to use it. I get results that are often exactly opposite what I was expecting, which means that I am obviously not understanding something. It is also difficult to get help with mbUnit, while it is not abandonware it does not have a very active community, posts to their list server often go unanswered for long periods of time. And the Google Group discussion forums are none to active either.

Time will tell if xUnit suffers from the same lack of community or not, but so far it looks promising! 

Cheers,

Robert Porter


 
Categories: .NET | Agile | Programming | Reviews | TDD


Microsoft has released the latest version of their Power Pack for Visual Basic 2005. Get your copy while it's still spinning!

Microsoft Visual Basic 2005 Power Packs 2.0 - Download

 

Microsoft Visual Basic 2005 Power Packs 2.0 - Information

 

Powerpack2

 

Cheers,

Robert Porter


 
Categories: .NET | Tools and Toys | VB.NET


I recently rebuilt my system, something not unusual for developers. In my case it is at least once every quarter. There is even an industry buzzword for it, re-paving, and it is appropriate as you are in essence taking a work surface that has become potholed and rough, and laying a brand new surface (your OS and applications over top of it).

But in my case the real pain started after I was done. During setup I happened to install SQL Server 2005 first this time, before Visual Studio. Apparently as a result of this a number of strange things happened to Visual Studio's default settings. For one thing, my help collection defaulted to SQL Server, for another I never got the Visual Studio "What kind of developer are you dialog" during install.

But most frustrating of all was the anemic looking New Project Dialog box that now appeared. (Click on the image for a larger version. Notice that there are almost no options, especially as applies to where you want to save a project or if you want a solution created, or if you want to add the project to SourceSafe!!!

Auugghhh! I searched high and low in the various options dialogs and on the web. I found all kinds of information on creating custom templates and repairing damaged templates. But nothing that would indicate how to restore the now missing functionality for the New Project template. However while I was searching for this information I stumbled on to the blog entry on Eric Hammersley's blog, called Missing an item template in Visual Studio 2005? Try this... buried in the comments was an answer to my other mystery, why was my help being pre-filtered for SQL Server?

The comment suggested that you go to Tools | Import and Export Settings | Reset all settings.

Then select your preferred developer type. In my case I selected General Development Settings from the list and Oy! All was right in my world again!

I once again had a full fledged New Project Dialog!! And my help was restored to the correct standard collections!

Ah, life was again good! Here is a shot of the IMHO "good" New project dialog box, again click the image for a larger copy. As you can see it shows the options that were missing.

Some experimentation yielded the fact that the Visual Basic Developer settings generated the anemic dialog. I guess Microsoft thinks VB developers can't handle the real stuff? Anyway, I am back to where I wanted to be. I hope this helps someone else.

Cheers,

Robert Porter


 
Categories: .NET | Programming | VB.NET | Visual Studio


February 15, 2007
@ 01:44 PM

Well, as I mentioned in an earlier post Vista, Typed Datasets and Other Stuff, I was hesitant to adopt Vista due to known incompatibilities with some of the tools I use. Well that was before I had access to someone at Microsoft that had all the answers!

I am now happily running Vista Business Edition on my laptop and all of my development tools work just fine!  I took the rather extreme pre-caution of moving my previous laptop OS and all into a Virtual Machine first!

However my experience to date has been wonderful! I love the new Aero interface, and my system is actually more responsive then before I upgraded. Of course that's probably as much a function or essentially re-paving my laptop as anything inherently faster about Vista.

There are still some issues. Visual Studio 2003 is officially not supported, however Visual Studio 2005 and of all things Visual Basic 6.0 are supported! There is even a CTP release of a Visual Studio Service Pack specifically for Vista.

The release notes for the service pack are here and the service pack itself can be downloaded from here. This is meant to be applied after the standard SP1 has been applied to Visual Studio.

In order to be able to continue to work with Visual Studio 2003 and in order to avoid installing VB6 on my primary development system I created a new Virtual Machine using Microsoft Virtual PC 2007. This VM runs Windows XP with Service Pack 2 and is kept current with all Microsoft Service Packs and Updates and has it's own copy of Anti-virus and other tools and utilities. Additionally I installed Visual Studio 2003 and VB6 and all the associated add-ons and documentation and tools and utilities I normally use.

Now I have a complete fully functional (and peppy!) development environment in a box! Complete with Internet access, Source Control, and all the rest of the things we all take for granted in a development environment.

The result is I have two, segregated, development environments, one for legacy app's and support and one for all my current work! Each environment is cleaner and leaner than if I had everything installed on one system.

And the learning curve for Vista was not all that great I was pleased to discover, it actually is more intuitive in many ways, and things were where they "should" be. The only application I could not get working in Vista (but it is working fine in the XP based VM) was PGP Desktop.

In conclusion I am very happy with my system and the performance and stability of Vista in general. And the eye candy of Aero is just frosting on the cake!

Cheers,

Robert Porter


 
Categories: .NET | Programming | Reviews


In the last (and first) post of this series we discussed how to create a typed dataset. Now that we have our dataset we need to see how to use it.

But before we go into the details, I want to explain something that I stumbled upon in my research. There is a serious bug in the implementation of the dataset generator. It effects retrieving and manipulating childrows when you are dealing with related tables.

After a great deal of hair pulling, self doubt, and serious coffee consumption, I finally found a series of blog posts that ended up leading me here. The bug has been confirmed and will be released: “thanks again for reporting this. We fixed this problem and the fix will be available in the next Visual Studio release.”

Description
When you create a typed DataSet using the class-designer of VS.NET with a parent- and a child-table, a method is generated on the parentrow-class which should return the childrows. This method uses DataRow.GetChilds with the name of the relationship. This method returns a parentrow-array instead of a childrow-array. The generated method casts it to a childrow-array and thus causes a InvalidCastException.
This bug reduces some of the functionality of the typed dataset in production applications. There is a workaround, but it is a simple kludge, and the end result is that you cannot easily work with related data.
 
Ok, with that said, lets continue on with the series. Next post in this series will take us back into the thick of it. There is still a huge benefit to using typed datasets, just sad that this bug caused such an unfortunate loss of some of that functionality.
 
Cheers,
 
Robert Porter

 
Categories: .NET | ADO.NET | Programming | SQL | VB.NET | Visual Studio | XML


The following post is from Michael Swanson's blog, link below. 

Wow! it's been about 2 1/2 weeks since I last posted, and it seems like forever. In the meantime, I've upgraded my machines to Windows Vista RC2, and I'm not looking back. I had to do some work on my wife's computer the other day, and she's still running Windows XP. Well, not for long. :) Anyway...

Ever since my post about Converting Flash Shapes to WPF, I've been asked about the BitReader class that I mentioned. That class has since been replaced by a much more specialized class called SWFReader. As you can probably tell by the name, it's job is to make it easier to read Adobe/Macromedia Flash (SWF) files and their associated data types. If you're unfamiliar with the contents of a SWF file, you should check out A Concise Guide to the SWF File Format and Alexis' SWF Reference. Both are excellent resources.

To get going, first download my C# sample code: FlashTools.zip (10KB). This Visual Studio 2005 solution contains two projects:

  • The FlashTools project contains four classes: Rect.cs implements the Flash rectangle/RECT type, SWFFile.cs encapsulates logic to open a SWF file and read its contents, SWFReader.cs makes it easy to read common data types from a SWF file, and Tag.cs doesn't do much other than read and identify the various Flash tags.
  • The SWFInfo project is a very simple command-line client that routes tracing information to the console to display SWF header and tag information.

It's important to note that most modern Flash files use ZLIB compression (explained in RFCs 1950, 1951, and 1952). You could certainly implement your own "inflate" logic, but it's already been done by a number of folks. I chose to use the fully managed SharpZipLib. You'll need to download the assembly and add a reference to it from the FlashTools project to successfully compile my sample code.

To examine the contents of a SWF file in detail, the Dump Flash Decompiler is an invaluable tool. SWF Tools is another good one to check out (especially SWFDump). Both of these are useful for validating the data that you're reading from the SWF file.

Last, this is sample code, so swim at your own risk. There's no error checking, unit tests, performance optimizations, or guarantees. If you're going to build a more robust solution, this code will only give you enough guidance to get going. If you have any questions, feel free to contact me directly. Otherwise, party on!

Source: