I have not used short cut keys all that extensively in the past, but of late I have become more and more addicted to them. The problem is there are so many of them, and unless you use them often it is easy to forget them.

Of course they are documented, but like everything that Microsoft puts on its web site, the location for that documentation moves frequently.

As of this writing the best documentation for them that I could find is here. You can also download a poster in either color or gray scale for 2005 here, and for 2008 here. These downloads are actually PDF's. I was able to read, barely, the text printed in landscape of an 8 1/2 X 11 page. Because these locations move frequently I have also attached the files to this post.

Another excellent reference for keyboard shortcuts is this post from  Gustavo Bonansea which is basically a link listing of numerous references for shortcuts for numerous aspects of Windows based programs. The initial paragraph in this post is not in English, but the links and descriptions are.

Sara Ford's Weblog is an excellent all around source for Tips, Tricks, Keyboard Shortcuts, and lots of just good information. I heartily recommend subscribing to her blog.

And finally I am sure there are VB.NET specific versions of each of these. Google for them as needed.

 

If any of you find other resources of interest for this kind of information, please leave a comment or drop me a line and I will update this post.

Cheers,

Robert Porter

 

 

Files PDF's in ZIP format.

 

2005 Keyboard Shortcuts 2005 Version
2008 Keyboard Shortcuts 2008 Version


 
Categories: C# | Visual Studio | VSTS


Beta versions of SP1 for both Visual Studio 2008 and the .NET 3.5 Framework are now available. Check ScottGu's Blog post here for more information.

For the record, I am holding off on installing these for a couple days, I will probably wait for the shipping versions, but if you are a bleeding edge type they are available!

Cheers,

Robert Porter


 
Categories: Programming | Visual Studio


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


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


April 10, 2008
@ 11:57 AM

I have recently had to do some script debugging, both client and server side and found some good resources on the topic I thought I would pass along. This is one of those things I have do remind myself of how to do from time to time. I typically use Firefox to debug Javascript, but there are times I have to do it with IE.

So below for my own reference as well as hopefully some one else's, are some useful links for debugging Javascript in IE.

Microsoft's Script Debugger can be downloaded from here.

Directions on using it are here.

Monica Rosculet wrote a great article about debugging script with Visual Studio here.

The source of most of this information came from an IEBlog entry that can be found here.

Hope this saves someone else some research time!

Cheers,

Robert Porter


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


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 26, 2007
@ 10:10 PM

I will be working in Kentucky this week, which means posting may be a bit light for awhile.

Going to be looking at VS2008 this week, and will try and come up with a couple of posts about my install experience and first impressions etc.

Also will be working with some interesting Vista related stability focused hotfixes that I have recently become aware of. As I get the chance to check these out I will post about them as well.

Meantime, going to see if I can introduce at least some agile practices at my new project. Am not going to hold my breath as I am not in a position with any significant influence, however I can try.

Currently, I am stuck in RDU airport waiting for the aircraft to be repaired. I was originally supposed to be in Kentucky by 9 AM, now looking like about 3:30 PM if there are no further delays. <sigh> Travel is often not according to plan, hope my luggage manages to find me!

UPDATE: It took all day to get to Kentucky, and my luggage is still a few hours behind me.

Cheers,

Robert Porter


 
Categories: Misc | Ramblings | 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


If you have used Visual Studio 2005 for any length of time, particularly if you have installed the .NET 3.0 bits in either Beta or Release form, you may have suddenly seen some or all of your project templates in the New Project dialog disappear!

I wrote about this and a related issue before but this time around the fix was not so simple. I had installed the WWF and WCF bits along with the .NET 3.0 SDK. Somewhere in the process I lost the Windows Application template for VB.NET.

This lead me to try a number of potential fixes outlined in this blog post on Eric Hammersley's blog. None of the fixes outlined there helped. Neither did uninstalling and reinstalling Visual Studio itself. I also uninstalled the 3.0 bits, all add-ins, etc.

So I started doing some digging, the way the templates, at least the stock ones, seem to work is that there is a series of directories in this folder: C:\Program Files\Microsoft Visual Studio 8\Common7\IDE

The ones of interest are: ProjectTemplates, ProjectTemplatesCache, ItemTemplates, ItemTemplatesCache.

The Templates directories contain the "Master" copies, the Cache versions of the folders contain the copies that are displayed in the New Project or Add Item dialog boxes. They are normally identical.

The command devenv /InstallVSTemplates run from a Visual Studio command prompt should sync the directories up. But this had not happened on my system. Repeated execution of the command resulted in no change.

Then I began to wonder, after all I am running Vista, even though I had made my account a member of the Administrators group to resolve this issue (not recommended by the way), I remembered that on Vista that was actually only making me an "almost" administrator.

So I logged in as the real administrator account, opened a Visual Studio Command Prompt and executed the devenv /InstallVSTemplates command and this time the hard drive lit up and there was a perceptible delay before the command prompt reappeared.

I logged out, logged back in as my own account and launched Visual Studio and the templates were back again!

Further spelunking in the Application event log showed that about two days before Visual Studio had started to complain that my cache directories were not in sync, and that several templates were missing their templatename.vstemplate files.

Templates are a basically zip files which include a vstemplate file that captures the references and directory structure of the template when it is expanded and created. Something had corrupted the cache copies and apparently I did not have enough rights to copy the originals over top of the cache copies.

More disturbing was that reinstalling Visual Studio did not fix the issue! But whatever the reason the files became damaged, logging in as administrator resolved the issue.

Hope this helps someone else!

Cheers,

Robert Porter

UPDATE: I forgot to mention, don't try just copying the directories from the master copies into the cache folders. There is more involved than a simple copy operation and if you just physically copy the files you will lose ALL of your templates. I know, I tried.


 
February 19, 2007
@ 12:33 PM

Upon some further investigation, the built in configuration options for managing all kinds of settings, environment options, shortcuts etc, are extensive and fairly easy to use.

From the Tools Menu select Import and Export Settings. In Visual Studio 2005 this brings up a dialog that allows you to:

  • Export your current settings (all or some of them) to a file.
  • Import predefined settings packages, or a previously saved set (all or some of them)
  • Reset all Settings. (Use this one to start over from one of the predefined packages.)

If you select Import selected environment settings, and then click next you get another dialog that gives you the opportunity to save your existing settings to a file, or just import new settings and overwrite your existing ones.

I selected the second option. This brings you to yet another dialog, this one containing the list of predefined sets of settings. The list available will vary depending on what edition you have and what server technologies you have installed, e.g. SQL Server.

Select one of those offered, and then hit next. (You can also browse for a saved package or file someone else sent you etc.)

On this next dialog, you will see a tree view control with three main nodes called:

  • General Settings
  • Help Filters and Favorites
  • Options

Clear all of them by selecting the All Settings node, then you can expand each of the nodes and subnodes in the tree view to see what is available for you to import. Watch out for the settings with the little Yellow Exclamation point symbol next to them. Changing these settings according to the explanatory text could "compromise" your development environment.

I imagine some of these settings are mutually exclusive or cross dependant on other settings. So be forewarned. However there is always the option to Reset All again!

Cheers,

Robert Porter


 
Categories: Programming | Visual Studio


In my previous post about the New Project Dialog box I mentioned that I had selected General Development as my answer to what kind of development environment did I want.

I wondered exactly what that did to my keyboard shortcuts and other environmental settings, other than the obvious of giving me back my full featured New Project Dialog box.

A little digging yielded the following link: Shortcut Keys which takes you to an MSDN page that

discusses the effects of all the various predefined key bindings. It also has some excellent information on creating your own bindings etc.

Still, I have not found the magic setting that lets me have the key bindings I want (VB) and have my New Project Dialog and other environment settings the way I like them, but I think this link is a good starting point.

Weigh in if you have any suggestions of further information.

Cheers,

Robert Porter


 
Categories: Programming | Visual Studio


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


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


Craig Nicholson : Visual Studio 2005 Beta 2 won't start workaround.

I recently ran into a problem where Visual Studio 2005 would launch, splash screen would show, then the CPU would peg at 100% and that was that. No IDE, nothing.

After messing around and not getting anywhere I ran into the blog entry above. In short you run the devenv.exe with the parameter /resetuserdata and wait for the devenv process to disappear from the task list.

Voila! Worked! I have my environment back.

Cheers,

Robert Porter


 
Categories: Visual Studio


December 1, 2006
@ 10:24 PM