Insidious ByRef Legacy Code Issue

April 24, 2012

The ByRef in the title should give you a hint that this is about legacy VB.NET code.

One of my duties at my new job is to maintain our legacy VB.NET codebase until we deploy our WPF software. When I use the term legacy it should not be taken in a negative manner. Our legacy code runs our company everyday and does it very well.

If you don’t know, VB.NET has a powerful but insidious property on Microsoft.VisualBasic.DateAndTime module called Today. Well, this little beast is a read-write property to the system date.

Yesterday I got a report of an exception that we have never seen before, System.Security.SecurityException; user does not have permission to change the system date.

Over the last few weeks we have been moving from Windows XP to Windows 7 with UAC set at the Default level (as it should be.) We are running in a different, more secure computing environment. The user that reported the issue was upgraded yesterday morning.

After researching the problem it turns out that we had several method calls within our legacy application that were passing Today ByRef. Yes, you guessed it; this caused a call to update the system date each time these methods were executed and returned. In reality no real damage was done; however under Windows 7 with UAC turned on, it caused the above security exception.


I found every instance of Today in the code and changed it to, Date.Today which is the read-only syntax.  You can also use Today.Date.

If you are maintaining legacy code that you didn’t write and have an unexplained issue, looking at method calls that are passed ByRef might help. 

If you have Today in your VB.NET code, take a look and make sure it’s not being passed ByRef and make sure you code is not mutating it.

Have a great day,

Just a grain of sand on the worlds beaches.

Mole v 1.3 for Visual Studio 2010 Released

June 20, 2011

Mole 2010 v1.3 contains a lot of enhancements made in response to customer feedback. These range from simple bug fixes to making existing features more powerful.

Developers leveraging Prism will be happy to find enhanced support for exploring objects from the Prism and Unity frameworks.

Several fixes will make our large user base in Germany quite happy, including the ability to use a list separator, other than a comma, in exported CSV files.

Mole v1.3 Enhancements

  • Fixed bug where Mole would not close properly when computer has a touch-enabled screen (worked around a WPF issue).
  • Enabled viewing and drilling into more collection types. Mole 2010 now supports drilling into any IEnumerable object.
  • Both the Key and Value properties of a DictionaryEntry object are now shown in the MoloScope’s Value column.
  • Collection items for NameValueCollection now show the keys and values in the MoloScope.
  • Improved support for working with Prism and Unity applications (support for drilling into the RegionManager and Unity container collections).
  • Enabled drilling into objects with only non-public fields.
  • Exporting collection data to CSV now uses the list separator defined by your system locale, instead of always using a comma.
  • The Options dialog allows you to specify a list separator to use in the CSV files, if necessary.
  • MoloScope column widths are no longer set to incorrect large values when running on a system with the German locale.
  • Snapshot rendering of Windows Forms controls has been modified to properly handle some edge cases.

Current Registered Users

Current registered users of Mole can download this updated version and install the new version over old one.

Demo Version Available

If you are interested in trying out Mole 2010 before buying it, visit the Molosoft Demo page to get the latest release of the trial version. The trial version includes the new features and fixes listed on this page.

Learn About Mole

To learn about the Visual Studio 2010 Debugger Visualizer Mole and how this debugging tool can help you when debugging applications in Visual Studio 2010, please visit


We welcome and appreciate your feedback on Mole!

Have a great day,

Just a grain of sand on the worlds beaches.

New Book Available: Developer’s Guide to Microsoft Prism 4

March 25, 2011

Last fall patterns & practices shipped Prism 4.


Today we are announcing the availability of the “Developer’s Guide to Microsoft Prism 4” book.


This book is available from O’Reilly or Amazon.


The eBook will be available for download shortly.


The MSDN online content is available here.


What’s In The Book?

Prism helps you to design and build flexible and maintainable WPF and Silverlight applications by using design patterns that support important architectural design principles, such as separation of concerns and loose coupling.

This guide will show you how to use Prism to implement the Model-View-ViewModel (MVVM) pattern in your applications, and how to use it along with commands and interaction requests to encapsulate application logic and make it testable.

It will show you how to split an application into separate functional modules that can communicate through loosely coupled events, and how to integrate those modules into the overall application.

It will show you how to dynamically construct a flexible user interface by using regions, and how to implement rich navigation across a modular application.

Have a great day,

Just a grain of sand on the worlds beaches.

Mole 2010 Demo Released

March 6, 2011

Many developers have asked for a demo version of Mole 2010.  We have just released it at

Sorry it has taken an extra week to release.  I’ve been sick for the last 10 days and have not been able to work or attend the Boise or Dallas Code Camps I really wanted to attend.  I’m hoping I’m out of the woods.

In the mean time, Josh has posted two nice blog posts on using Mole 2010 here:

Have a great day,

Just a grain of sand on the worlds beaches.


Mole 2010 Released

February 22, 2011


A few years ago, some friends and I released Mole for Visual Studio 2008. Mole is a debugger visualizer that runs in Visual Studio while you are debugging .NET applications. Our goal was to make debugging easier, which Mole accomplishes because it provides a comprehensive view into all of your application’s data objects. Although the tool was created as a pet project to help us with our own work, it became quite popular, and has been downloaded more than 100,000 times (that we know about).

When Visual Studio 2010 was released, we had to make a decision. Either we could just upgrade the old Mole so that it works in Visual Studio 2010 (which some people have already done), or we could take the plunge and make Mole all that we knew it could be. We decided to take the plunge…

After a year of dedication and hard work, we are thrilled to announce that our new version of Mole is now available! Mole 2010 is the next generation of the Mole debugger visualizer, built to work in Visual Studio 2010. The new version of Mole makes the previous one look like a half-baked prototype.

Mole 2010 has many useful new features, bug fixes, and performance optimizations. Not only is it a more powerful tool, but it also looks much better and is easier to use. We rewrote the entire user interface in WPF, and even brought a professional Visual Designer onto the team to make sure that Mole looks as great as it works.

Our hard work resulted in a useful, powerful, and elegant debugging tool. We are extremely proud of Mole 2010.

We are selling Mole 2010 for $49.99 from our company Web site:

If you are a .NET developer using Visual Studio 2010, check it out!

Have a great day,

Just a grain of sand on the worlds beaches.

Prism 4.0 For Visual Studio 2010, .NET Framework 4.0, WPF & Silverlight 4

November 12, 2010


The Microsoft patterns & practices team is excited to announce the release of:

Prism 4

For Visual Studio 2010, .NET Framework 4.0, WPF & Silverlight 4

Prism provides guidance designed to help you more easily design and build rich, flexible, and easy to maintain Windows Presentation Foundation (WPF) desktop applications, Silverlight Rich Internet Applications (RIAs) and Windows Phone 7 applications. Using design patterns that embody important architectural design principles, such as separation of concerns and loose coupling, Prism helps you to design and build applications using loosely coupled components that can evolve independently but which can be easily and seamlessly integrated into the overall application. Such applications are known as often referred to as composite applications.



Prism is intended for software developers building WPF or Silverlight applications that typically feature multiple screens, rich user interaction and data visualization, and that embody significant presentation and business logic. These applications typically interact with a number of back-end systems and services and, using a layered architecture, may be physically deployed across multiple tiers. It is expected that the application will evolve significantly over its lifetime in response to new requirements and business opportunities. In short, these applications are “built to last” and “built for change.” Applications that do not demand these characteristics may not benefit from using Prism.

Key Benefits

  • Provides guidance and a re-usable library to help you develop flexible, easy to maintain WPF and Silverlight composite applications
  • Helps you to understand, implement and use key design patterns, such as MVVM and Dependency Injection
  • Supports the development of modular applications, allowing parts of your application to be fully developed and tested by separate teams
  • Helps you re-use application code and components across WPF and Silverlight, allowing you to create multi-targeted client experiences
  • Allows you to build a designer-friendly, dynamically composed user interface for your application
  • Includes reference implementations, quick-starts, hands-on-labs, as well as a comprehensive developers guide to get you up to speed quickly
  • Includes full source code to support code re-use or customization or for reference and education

In this Release

  • Prism Library for WPF, Silverlight and Windows Phone 7
    • Signed binary assemblies
    • Full source code
  • Example Applications and Hands-on-Lab Source Code
    • Reference Implementations (2)
    • QuickStarts (12)
    • Hands on Labs (2)
  • Documentation
    • Comprehensive developers guide showing how to use Prism within your application
    • A printable PDF of the developers guide – available on CodePlex

About patterns & practices

The Microsoft patterns & practices team provides a wide range of guidance to help customers save time and reduce risk on their software development projects by incorporating proven patterns and practices.  This applied engineering guidance includes both production quality source code and in-depth documentation.

The guidance is designed to help software development teams:

  • Make critical design and technology selection decisions by highlighting the appropriate solution architectures, technologies, and Microsoft products for common scenarios
  • Understand the most important concepts needed for success by explaining the relevant patterns and prescribing the important practices
  • Get started with a proven code base by providing thoroughly tested software and source code that embodies the recommendations

For more information:

In the Box – MVVM Training

November 7, 2010

Updated 12 Nov 2010


What is In the Box?

In the Box is a high quality, multi-media training that is consumed within Visual Studio 2010.  Content is navigated and delivered using a next generation computer based training (CBT) experience, the Visual Studio 2010 Feature Extension.

In the Box, is a brand name for a series of CBT Feature Extensions I’ll release that are listed in the Visual Studio 2010 Add New Project dialog; see below image.  This release is MVVM Training, the next will be Prism Training.

In the Box features:

  • Visual Studio 2010 Feature Extension
  • Content delivered as text, code, images, diagrams, video, or hyperlinks to the Internet
  • Hierarchical navigation tool window for content navigation
  • Content is viewed inside Visual Studio 2010 tool windows
  • No additional downloads or dependencies; all content is in the box.  (except online videos)
  • Installed and updated from the Visual Studio Gallery
  • Managed (disabled or uninstalled) using Visual Studio Extensions Manager (see bottom of this page)
  • Authored using Microsoft Word and the Instant Feature Builder

What is in this release of In the Box?

Please watch this video as it will answer most of your questions.

This installment of In the Box contains in-depth MVVM Training that includes an eleven assembly example solution with projects targeting developers at different levels of experience

Who is the target audience?

  • If you have never used MVVM before, this training is for you. 
  • If you have been using MVVM for a while and want to learn more, this training is for you. 
  • If you are an expert, you will enjoy the MVVM Technical Description and MVVM Scenarios content.

What are the requirements to install In the Box?

Visual Studio 2010 Professional, Premium, or Ultimate.

Expression Blend 4 WPF SDK – Free download (see below comment on SDK) (Note: this is installed with Blend also)

For those developers using Visual Studio 2010 Express or Visual Studio 2008, you can use the links in the below download section to download a .mht version of the content along with the sample solution source.  The .mht file can be viewed in your browser by double clicking the file in Windows Explorer.

Please note: I have not tested this solution with the Express version.

Windows XP and Windows Server 2003 Users

In order to run Feature Builder on either XP or Server 2003 you must create an environment variable named LocalAppData (set by default on Windows Vista and Windows 7).

How to Add LOCALAPPDATA variable in Windows XP:

  • Right-click on the My Computer icon and choose Properties
  • Click Advanced
  • Click Environment Variables
  • Under User variables section, click New
  • In the Variable name: field, type LOCALAPPDATA
  • In the Variable value: field, type %USERPROFILE%\Local Settings\Application Data

How do I install In the Box?

Click on this Visual Studio Gallery Link and install from there.

After I install it, how do I get started?

Open Visual Studio 2010; File, New Project, Visual C#, In the Box, MVVMTraining.



In the Box – MVVM Training Introduction video

You can view the above video using the web browser plug in, or you can download and watch an HD version of the video.  To download the HD version of the video, locate the, “About this video” section (lower right side of web page) and join Vimeo; it’s free and very quick to join.



In the Box – MVVM Training on the Visual Studio Gallery

Visual Studio Express and Visual Studio 2008 Developers download the written content and sample application from my:

SkyDrive click here to download.

Note the link is to a folder; you will want to download both .zip files in the folder.

Expression Blend 4 SDK Requirement

I received a report from a developer having a problem with two references to the Expression Blend 4 SDK in two of the included projects.

I thought for awhile about including just these two DLL’s, but thought that would be a disservice, only providing two DLL’s.  I have opted to add the Expression Blend 4 SDK as a requirement because a high percentage of developers already have the SDK installed by Blend or by downloading it.

Have a great day,

Just a grain of sand on the worlds beaches.


Get every new post delivered to your Inbox.

Join 255 other followers