Welcome to MSDN Blogs Sign in | Join | Help

Debugging WPF applications in Visual Studio 2010 using WPF Tracing

In an earlier blog, I described how to use the new WPF Visualizer to debug WPF applications in Visual Studio 2010. We've added another feature that further improves the debugging experience for WPF applications. The Visual Studio 2010 debugger can now automatically display tracing information from a WPF application. Let's walk through a simple example and discuss the details later.

In this example, I have a WPF application (Patient Monitoring) and I'm trying to debug a data binding problem. Here is a screen shot showing the Patient Monitoring application.

Patient Monitoring application

In order to view tracing information from a WPF application, the first step is to enable WPF tracing via Tools.Options.Debugging.Output Window. Once you have navigated to the Tools.Options dialog, select the Output Window node under the Debugging tab, as shown below.

WPF Trace Settings

In the screenshot above, you can see that there are a number of different tracing options for the WPF events, including Data Binding, Animation, Markup, etc. Since we are debugging a Data Binding failure, I'm going to enable the Data Binding option. Specifically, I'm going to set the Data Binding setting to "Error" meaning that I want the debugger to display WPF Data Binding events that have a tracing level of Critical or Error. Once this setting is enabled, you can press F5 to start the application under the debugger. While debugging your application, every time that there is a Data Binding failure, the debugger will log the error to the Output window, as shown here.

Output window

Each error contains a number followed by a description of the error. Using this information, I can now see that binding the XmlDataCollection to the LiveChartsListBox control is failing. It turns out that this happens every time that I click the patient details control, this failure happens. So now I can start debugging the problem from there.

One of the reasons why debugging a WPF application is more difficult than other application types is due to the fact that a lot of things happen behind the scenes. Take data binding for example which is an area where many developers struggle with when it comes to debugging. This is both a strength and a weakness of a declarative technology such as XAML which allows you to simply describe what you want to happen and the framework will figure out the how.

Habib Heydarian.

Visual Studio Team System 2010 Profiler and Virtual Machines: Error VSP1454 is no more!

Prior to Team System 2010, if you try to profile an application on a virtual machine (e.g. Virtual PC, Hyper-V, VMWare) using sampling mode, this is the error that you will see:

Error VSP1454 dialog

Unfortunately, if you want to use sampling mode, you're pretty much stuck! The only "workaround" is to profile your application using instrumentation mode instead of sampling mode.

I'm glad to report that in Team System 2010, we now support profiling applications in sampling mode! Our support extends to Virtual PC 2007, Hyper-V and VMWare. The reason why this is important is because increasingly, we are noticing that developers are using virtual machines as their main development environment.

Habib Heydarian.

New Visual Studio Debugger 2010 feature for C/C++ Developers: Using string functions in conditional breakpoints

This should make many C/C++ developers happy when Visual Studio 2010 becomes available (you can download Visual Studio 2010 Beta 1 right now). In previous versions of Visual Studio, one of the complains that we've received is that developers want to use string manipulation functions like strcmp() and strlen() in a conditional breakpoint and have the debugger break only when the condition becomes true.

Let's look at an example to make this more concrete. In the following code, I have a function that given a menu (CMenu) and a string (LPCTSTR), finds the ID for a menu item from the menu. Now, let's say that I want the debugger to break when menuString = "&Help". I could step through the for loop until I see that the value of str = "&Help". Alas, that can get tedious very quickly as my index finger becomes numb after pressing the F11 or F11 over & over.

int FindMenuItem(CMenu * menu, LPCTSTR menuString)
{
ENSURE(menu);
ENSURE(::IsMenu(menu->GetSafeHmenu()));

int count = menu->GetMenuItemCount();
for (int i = 0; i < count; ++i)
{
CString str;
if (menu->GetMenuString(i, str, MF_BYPOSITION)
&& (strcmp(str, menuString) == 0))
{
return i;
}
}

return -1;
}

With the Visual Studio 2010 debugger, this problem is now solved since we now provide the ability for the developer to set a conditional breakpoint where the condition contains one of a number of string manipulation functions. In the example above, I can now set a breakpoint with the expression strcmp(str, menuString) == 0 as the condition, shown below.

Breakpoint Condition

Now, when you run the application, the debugger will only break when menuString == "&Help". The Breakpoints window also clearly shows that the breakpoint will be when when the condition is true.

Breakpoints windows

One thing to remember is that we don't support all the string manipulation functions. Below is the list of functions that we support in Visual Studio 2010 Beta 1. This list may grow/shrink by the time we release the final product. In the mean time, if you have any feedback, e.g. you think we should add other functions, feel free to leave a comment.

  • strlen
  • wcslen
  • _tcslen
  • strnlen
  • wcsnlen
  • _tcsnlen
  • strcmp
  • wcscmp
  • _tcscmp
  • stricmp
  • wcsicmp
  • _tcsicmp
  • strncmp
  • wcsncmp
  • _tcsncmp
  • strnicmp
  • wcsnicmp
  • _tcsnicmp
  • _stricmp
  • _wcsicmp
  • _strnicmp
  • _wcsnicmp

Habib Heydarian.

Troubleshooting Team Foundation Server 2010 Beta 1 error TF255275

When installing Team Foundation Server 2010 Beta 1, you might run across the following error during the readiness check:

Error    [ Reporting ] TF255275: The following Web service for SQL Server Reporting Services could not be accessed: http://<machine_name>/ReportServer/ReportService2005.asmx.
Warning    [ Project Collection ] TF255331: The existence of the following folder on the report server could not be verified: The report server cannot open a connection to the report server database. A connection to the database is required for all requests and processing.. A network problem might have prevented communication, the report server might be offline, or your account might not have permissions on the report server. The team project collection could not be created. To complete this wizard, you must specify the option not to create a collection. As an alternative, you can close this wizard, correct the problem, and then restart the wizard.

What's interesting is that if you copy the URL above into a browser, the browser *can* find the the web service (ReportService2005.asmx) just fine. So, what's the issue? Typically, this problem happens if the machine name was changed since SQL Server Reporting Services was installed on that machine. When you try to install TFS 2010, it tries to contact the SQL Server Reporting Services via the old name of the machine which no longer exists. The workaround is to delete the databases for the Reporting Services and recreate them using the Reporting Services Configuration Manager.

First, open the SQL Server Management Studio and under the Database node, delete both the ReportServer and ReportServerTempDB databases, as shown below.

Delete RS dabases using SSMS

Next, start the Reporting Services Configuration Manager from the Start menu, shown here.

Start Menu showing RSCM

In the Reporting Services Configuration Manager, select the Database tab. On the Database tab, click the [Change Database] button, only here were are going to create the databases, instead of changing them.

Reporting Services Configuration Manager dialog

On the Change Database page, make sure the "Create a new report server database" option is selected. Click the [Next] button.

Create a new report server database

After clicking the [Next] button, enter the name of the computer where SQL Server is running, as shown below.

image

On the subsequent steps in the wizard, keep the default options and continue clicking the [Next] button. When finished, click the [Exit] button on the Reporting Services Configuration Manager dialog. Re-run the Team Foundation Administration Console and the error should no longer appear.

Habib Heydarian.

DinnerNow.net 3.0 for Visual Studio 2008 SP1 and .NET Framework 3.5 SP1 is here!

It's been a very long time coming but the next version of DinnerNow.net is finally here! In case you haven’t heard of DinnerNow, it is a fictitious marketplace where customers can order food from local restaurants for delivery to their home or office. DinnerNow is designed to demonstrate how you can develop a connected application using several new Microsoft technologies. It is an open source sample that you can download from codeplex.

You can download the new version of DinnerNow.net from here.

DinnerNow screenshots

What’s new in DinnerNow.net 3.0

The 3.0 release of DinnerNow.net is primarily about adding support for new Microsoft updates, bug fixes and some clean up work. Here is a summary of the changes. You can read about these changes in more detail in the following sections.

  • Support for new Microsoft updates and service packs
  • A single master solution that contains all of the DinnerNow files
  • Bug fixes

1) Support for new Microsoft updates and service packs

DinnerNow.net 3.0 supports the following updates from Microsoft.

  • Visual Studio 2008 Service Pack 1 and .NET Framework 3.5 Service Pack 1
  • Windows Vista Service Pack 2 (32-bit)
  • Windows Server 2008 Service Pack 2 (32-bit)
  • SQL Server 2005 Express Service Pack 3 (32-bit)
  • Internet Explorer 8 (32-bit)

2) A single master solution that contains all of the DinnerNow.net files

By far, the biggest change in this release is that there is now a single master solution that contains all of the DinnerNow projects and supporting files. DinnerNow is made up of 31 projects and all up, contains over 500 files. In the previous release of DinnerNow (version 2.5), there were eight separate solutions in different directories. This made navigation and searching difficult because you had to open the solutions separately. It was also difficult to get a sense of overall structure of the application, not to mention having to use command line builds. But what made things really cumbersome is that none of supporting files, i.e. the build scripts, SQL files, etc. were part of any solution. Therefore, the only way to view and edit those files was to go outside Visual Studio. The screenshot below shows what the structure of version 2.5 of DinnerNow looks like.

Windows Explorer showing the structure of DinnerNow 2.5

In DinnerNow.net 3.0, all projects and supporting files are in one solution which makes it significantly easier to navigate, search and build the solution. The interesting thing is that in order to combine all the existing solutions into one master solution, I didn’t have to change any of the existing solutions or projects. I took advantage of Solution Folders and Visual Studio's ability to add one solution to another. Note that you can still open the individual solutions separately. Read my previous blog on how to combine separate Visual Studio solutions into one master solution. The screenshot below shows the new solution structure in Solution Explorer.

 Solution Explorer showing the structure of DinnerNow 3.0

3) Bug fixes

DinnerNow 3.0 fixes the following bugs.

Reason Priority Title
Fixed 1 When opening the Kiosk app, the Order Map widget fails to display with the error: 'VEMap' is undefined
Fixed 1 Fix broken unit test: DinnerNow.Tests.TestOrderProcessWorkflow
Fixed 1 Fully qualify Microsoft.ManagementConsole.Action due to ambiguity with System.Action
Fixed 1 Error when running RunMe.bat: Cannot find type [Microsoft.SqlServer.Management.Smo.Wmi.ServerAlias]: make sure the assembly containing this type is loaded.
Fixed 1 Prevent code loss: In the Delivery project, move custom code out of files that were generated by NetCFSvcUtil.exe
Fixed 3 Rename "Start Here for DinnerNow" Desktop shortcut to "Configure DinnerNow.net 3.0"
Fixed 1 Error when running RunMe.bat - Start-Sleep : A parameter cannot be found that matches parameter name '?seconds

I hope you'll find version 3.0 of DinnerNow.net helpful. Looking forward to your feedback.

Habib Heydarian

Preventing SQL Injection Attacks with Visual Studio Team System 2010

There are numerous articles on the web that describe the perils of SQL Injection attacks and warn developers about the fact that "All Input is Evil!". If you are interested in reading more about what a SQL Injection attack is, Wikipedia has a pretty good introduction to the subject. There are a number of recommendations on how to prevent SQL Injection attacks including sanitizing all user input, securing the database, etc. However, the onus is still on the developer to find out if his application is susceptible to SQL Injection attacks.

With Visual Studio Team System 2010, we've introduced a new Code Analysis feature that detects and warns developers about SQL Injection attacks, thus relieving the developer from some of the burden. But more importantly, this feature helps developers write more secure code to begin with.

A SQL Injection example

For this example, I’m going to use the good old Northwind sample database and some ASP.NET code to walk through the scenario. In the method below, the SQL string strSQL is dynamically constructed to retrieve products from the Northwind database. Furthermore, the user can filter out products by typing in some text that is used as a filter (txtFilter). The reason why this method is susceptible to a SQL Injection attack is because strSQL is created by using values directly entered by the user which are not sanitized in any way.

private DataView CreateDataView()
{
string connString = ConfigurationManager.ConnectionStrings[0].ConnectionString;
string strSQL = "SELECT ProductId, ProductName, QuantityPerUnit, UnitPrice FROM Products";

if (txtFilter.Text.Length > 0)
{
strSQL += " WHERE ProductName LIKE '" + txtFilter.Text + "'";
}

SqlConnection connection = new SqlConnection(connString);
SqlDataAdapter adapter = new SqlDataAdapter(strSQL, connection);
DataTable dtProducts = new DataTable();

adapter.Fill(dtProducts);

return dtProducts.DefaultView;
}

Because SQL Server allows you to concatenate several SQL statements using a semicolon or space, I can append my own SQL statement to the query above by simply entering my statement in the txtFilter textbox, as shown below:

'; UPDATE Products SET UnitPrice = 0.01 WHERE ProductId = 1--

Using the attack above, I can set the UnitPrice for the product with ProductID = 1 to $0.01, purchase a few units of the product without anyone finding out (not for a while anyway). There are many other vectors of attack here but this example is a simple demonstration of how devastating a SQL Injection attack can be.

Luckily, with Team System 2010, you can prevent such attacks by using the Code Analysis security rules. In order to take advantage of this fetaure, the first step is to configure Code Analysis to check for SQL Injection vulnerabilities in your application. To do that, select the "Configure Code Analysis for <project>" command from the Analyze menu, as shown here.

Configure Code Analysis

Once you've selected the Configure command, the Project Properties window opens with the "Code Analysis" tab selected. Using the Rule Set drop down, select the Microsoft Security Rules. This will tell Visual Studio to run Code Analysis on your application, checking for security vulnerabilities. To see which vulnerabilities Code Analysis is checking for, click the [Open] button.

Microsoft Security Rules

After clicking the [Open] button, the Rule Set editor is opened. Other than security vulnerabilities, you can configure Code Analysis to detect many other issues in your application such as performance, correctness, reliability, etc. In the Rule Set editor window, expand the Microsoft.Security section and look for the rule where the ID is CA2100. This is the rule that Code Analysis uses to detect potential SQL Injection attacks in your code. What's also nice is that when you select the rule, the lower pane of the window shows you additional help on the rule, including sample code and some guidance.

Code Analysis Rule Set editor

The next step, after configuring Code Analysis, is to run it. From the Analyze menu, select the "Run Code Analysis on <project>" command. This command will run all the rules that have been enabled for your application and report any issues in the Error List.

Run Code Analysis

In the Error List, you can see that Code Analysis has detected the SQL Injection vulnerability in our code. Furthermore, you can double click the error to navigate to the section of your code which contains this vulnerability.

Error List showing SQL Injection attack

If you have any feedback on this feature, I would love to hear about it. In a future post, I will delve into how Code Analysis detects these types of vulnerabilities.

Habib Heydarian.

The quickest way to edit a Visual Studio project file

Even though you are not supposed to manually edit a Visual Studio project file, there are times when you really don't have a choice. For example, sometimes upgrading a project from a previous version of Visual Studio fails and the only way to fix the problem is to open the project file in something like Notepad, make a couple of tweaks and then reload the project in Visual Studio.

There is a quick and easy way of editing your Visual Studio project file. When a project is "unloaded", either because you explicitly chose to unload the project using the "Unload Project" command or Visual Studio failed to load the project for some reason (e.g. project upgrade failed), you can right click on the project in Solution Explorer and select the "Edit <project>" command, as shown below.

Edit project file

This will open the project file in Visual Studio where you can niceties like syntax highlighting and other editor features that you normally wouldn't if you were using Notepad to edit the project file.

Habib Heydarian.

Posted by habibh | 0 Comments
Filed under:

Walkthrough: Using the Tier Interaction Profiler in Visual Studio Team System 2010

In Visual Studio Team System 2010, we've made a huge number of improvements to the Profiler. In case you didn't know that Visual Studio Team System has a Profiler, see the documentation on MSDN. One of the major improvements that we have made to the Profiler is the ability to measure how long the interaction between the application layer and the database layer takes.

Let's say that you have a typical multi-tier application, made up of a presentation layer, an application server and a database at the backend. Let's further assume that you are seeing several reports form customers that some transactions are timing out or are taking too long to complete. How do you go about finding out the root cause of the problem?

Distributed multi-tier application

Before Visual Studio Team System 2010, you could use the Profiler to diagnose if the failure occurred in either the presentation or middle tier. However, if the performance bottleneck is between the middle tier and the database layer, you are out of luck. In this walkthrough, I'm going to demonstrate how to use the new "Tier Interaction" feature of the Profiler to diagnose failures between the application and data tier.

For this demo, I'm going to use the BeerHouse sample application. To start, select the "Launch Performance Wizard..." from the Analyze menu as shown below.

Analyze menu

Next, you should see the "Performance Wizard". On this dialog, select the "CPU Sampling" option and click Next.

Perfomance Wizard.

You should now land on the second page of the Performance Wizard. If the solution that you are planning to profile is already open, the wizard will automatically select it for you. Click the Next button to continue.

Select application to profile

The next step is important! On the last page of the wizard, the checkbox to "Launch profiling after the wizard finishes" is checked. Uncheck it and click the Finish button.

 Performance Wizard last page

After clicking the Finish button, Visual Studio will open the "Performance Explorer" window and displays the target application to be profiled under the "Targets" node. Right-click the target (in this case TBH_Web) and select Properties, as shown below.

Target properties context menu

In the Properties dialog, select the "Tier Interactions" tab and check the "Enable tier interaction profiling" checkbox. Press the OK button to dismiss the dialog.

 Target Property Pages

Next, click the "Launch with Profiling" toolbar button in the Performance Explorer window shown below to start the Profiler.

Start profiling

The application will now start. At this point, to reproduce the customer problem, walk through the scenario that the customer or tester reported. While you are going through your scenario, the Profiler is collecting performance data about the application. Once done, close the application. At this point, Visual Studio will display a summary of the performance data that was collected as you were using the application.

Profiler Summary page

In order to see the interaction between the application and the database, select the "Interactions" view from the "Current View" drop down.

image

And finally, here is the Tier Interactions view. There is a ton of very useful information on this page, including:

  • Which ASP.NET pages were requested, how many times and how long did it take to execute each page
  • For each ASP.NET request, which SQL Server stored procedures were called, how many times and how long did the calls take

Profiler Interactions view

The Tier Interaction Profiler is available in Visual Studio Team System Beta 1 right now. Feel free to download it and give it a try. If you have any feedback, send it my way.

Habib Heydarian.

Sticky DataTips: A new way to view variables in the Visual Studio 2010 debugger

There are numerous ways to view variables in the Visual Studio debugger. You can use the Autos window, Locals window, Quick Watch, four different Watch windows, etc. In Visual Studio 2010, we've made it even easier to see the value of variables.

Over the years, we've conducted countless usability studies, watching users debug applications. One thing that has become clear is that users like to stay in the editor as much as possible. We've heard comments like "Keep me in the code" and "Code is king". This got us thinking that if users want to stay in the editor when writing code, why not also help them stay in the editor when debugging code. Hence, the idea of "Sticky DataTips" was born.

What are DataTips anyway?

Before I introduce the Sticky DataTips feature, let me briefly describe what I mean when I say DataTips. A DataTip is the tooltip that appears when you hover your mouse over a variable or expression in the debugger. Some people also refer to them as "hover tips" or "hover values". Here is a screenshot of a DataTip in Visual Studio 2008.

DataTip in Visual Studio 2008

In Visual Studio 2005, we introduced the ability to expand DataTips. However, we noticed something interesting when we watched users in usability studies. Sometimes, a user would DataTip a variable, write down the value on a Post-It and then continue debugging. Then, the user would step through the application, DataTip the same variable again to compare the value with the value that he had written down. This got us thinking: why not introduce the Post-It metaphor in the debugger so you could "stick" the value of a DataTip in the editor and use it at a later time? Also, we noticed that Windows Vista has a feature called "Sticky Notes" that allows for quick note taking, a al the electronic version of a Post-It Note. Hence, the idea and name of Sticky DataTips were born!

Sticky Notes in Windows Vista

Sticky DataTips 101

So, what does a Sticky DataTip look like and how do you create one? The first step in creating a Sticky DataTip is to DataTip a variable or expression in the debugger (this is exactly as you would today in Visual Studio 2005 or 2008). Once the DataTip appears, you should see an icon that looks somewhat like a Post-It Note at the right end of the DataTip.

How to create a Sticky DataTip

Once you click the button, a small, yellow window will appear in the editor. One of the other benefits of Sticky DataTips is that they won't disappear when you move your mouse! This is another complaint from users of DataTips in Visual Studio 2005 or 2008.

Sticky DataTip

The great thing about Sticky DataTips is that you can treat them as a "Just in Time" Watch window, but the big advantage of Sticky DataTips is that they are right in the editor. You can do some really cool things with Sticky DataTips such as add your own notes, as shown below.

Sticky DataTip Notes

I'm going to cover Sticky DataTips in much more detail in my later blogs. For now, download Visual Studio 2010 Beta 1 and give Sticky DataTips a try. I would love to hear your feedback.

Habib Heydarian.

NetCFSvcUtil.exe and Windows 7

NetCFSvcUtil.exe is the analogous of Svcutil.exe but for devices. You can use it to generate a WCF client from a WCF service. You can then consume the generated client code in a Windows Mobile application . Unfortunately, the current version of NetCFSvcUtil.exe (3.5.7338.0) that is available from Power Toys for .NET Compact Framework 3.5 might not work on Windows 7. You might see the following error when running NetCFSvcUtil on Windows 7.

C:\Users\habibh\Desktop\ServiceAgents>"C:\Program Files\Microsoft.NET\SDK\CompactFramework\v3.5\bin\NetCFSvcUtil.exe" "http://localhost/DinnerNow/service/DeliveryService.svc"
Microsoft (R) .NET Compact Framework Service Model Metadata Tool [Microsoft (R) Windows (R) Communication Foundation, Version 3.5.0.0] Copyright (c) Microsoft Corporation.  All rights reserved.

Attempting to download metadata from 'http://localhost/DinnerNow/service/DeliveryService.svc' using WS-Metadata Exchange or DISCO.
Error: An error occurred in the tool.

Error: Error in the application.

You might also see a similar issue if you run NetCFSvcUtil.exe on Windows Vista SP2 or Windows Server 2008 SP2.

Currently, there are no fixes available for this issue. The only workaround is to run NetCFSvcUtil.exe on Windows Vista (SP1 or earlier) or Windows Server 2008 (SP1 or earlier) and then copy the generated client code to other machines.

Habib Heydarian.

Posted by habibh | 0 Comments
Filed under:

Moving code around in Visual Studio super fast [Video]

As a developer, one of the common tasks is move code around. In this video, I'll demonstrate how using the Outlining Expansion feature in Visual Studio makes it a whole lot easier to copy and paste entire methods or classes. The trick is using the CTRL+M, CTRL+M shortcut key to collapse bodies of code first. Enjoy the video!

Habib Heydarian.

Posted by habibh | 0 Comments
Filed under:

Walkthrough: Adding an existing Visual Studio solution to another solution

Often, developers partition their applications into separate Visual Studio solutions in order to make managing the complexity of the overall application easier. Sometimes, the reverse is true. That is, you may want to combine several existing solutions into one master solution. The reason for doing this may be to make it easier to navigate between the different files in different solutions or perhaps make the build process for the overall application more manageable.

One of the little known facts of Visual Studio is that you can add an existing solution to another solution, without impacting the existing solution. Let's assume for this exercise that you want to add the Engine solution to the Robot solution.

The first step is to create a "Solution Folder" in the the Robot solution. Give the Solution Folder the same name as the the solution that you're adding, in this case "Engine". The reason for crating a Solution Folder is that it acts as a container for all of the projects in the Engine solution. Otherwise, the projects in the Engine solution would be mixed with projects from the Robot solution.

Add New Solution Folder

Once you’ve created the "Engine" Solution Folder in the Robot solution, right-click the folder and select the Add –> Existing Project... command. In the Add Existing Project dialog, change the file type to "Solution (*.sln) to see the solution file, i.e. Engine.sln.

 Add Existing Project dialog

Once you’ve added the Engine solution, the Robot solution will now contain the projects from the Engine solution, as shown below. The nice thing about this approach is that not only are all the projects now in one solution but at any time, you can open the separate solutions without impacting the "master" solution and vice versa.

Solution Explorer showing the combined solutions

Below is a screenshot of a real world example after eight solutions have been combined into one. The "master" solution contains eight other solutions. You can see that "DinnerNow – Main" contains 31 project, even though these projects are part of other solutions.

Solution Explorer showing DinnerNow solution 

Habib Heydarian.

Posted by habibh | 1 Comments
Filed under:

Debug this! How a change in the cloud broke my application

For the first time, I experienced first hand one of the perils of making use of services in the cloud. One of the sample applications that I use here at Microsoft for designing and experimenting with new Visual Studio features is DinnerNow.net. DinnerNow has a client WPF application that among other things hosts a WebBrowser control that loads a HTML page. The HTML page runs some JScript to display a map of customer orders from Virtual Earth. See below for a screenshot.

image

A few days ago, when I started the WPF application (Kiosk), it starting displaying the script error: 'VEMap' is undefined and as a result, the Order Map was broken. Suffice to say that debugging this problem wasn't easy. Here you have a 1) WPF application that contains a 2) WebBrowser control that loads a 3) HTML page that runs 4) JScript which calls the 5) Virtual Earth Map Control APIs in the cloud! The problem could be anywhere in this stack of technologies. What makes it even more challenging is that the Visual Studio Debugger is literally unable to debug this scenario.

To cut the long story short, I ended up using Fiddler to figure out what was going on. Basically, the Virtual Earth Map Control SDK had been upgraded to the Bing Map Control SDK and the URL for the Map Control service was no longer valid. All I had to do was to point to the new URL and the application started working again.

From this experience, what really struck me is that in the future, there will be hundreds of thousands of applications relying on services in the cloud. How will these service providers guarantee their services? Also, the types of bugs of the future are going to be that much more difficult to diagnose as you have services consuming other services, e.g. a photo service consuming a storage service and the potential for failure along this chain increases dramatically. This was a good experience in terms of understanding what debugging tools Visual Studio needs to provide for these types of applications.

Habib Heydarian.

Posted by habibh | 0 Comments
Filed under:

Troubleshooting the dreaded "Unable to start program '%CSIDL_PROGRAM_FILES%\..." problem

If you have used Visual Studio to write Windows Mobile applications, you might have come across the following error message when you press F5 to start the debugger:

---------------------------
Microsoft Visual Studio
---------------------------
Unable to start program '%CSIDL_PROGRAM_FILES%\<target_path>'.
The system cannot find the file specified.
---------------------------
OK
---------------------------

Although the error message seems intuitive, the root cause is far from clear. In order to understand the root cause, it's important to remember that when you press F5 to debug a Windows Mobile application, three things happen:

  1. The project is built
  2. The application is deployed to the device
  3. The application is started on the device

Each of the steps above is a separate stage and can be configured independently. The reason for the error message above is that the step to deploy the application to the device, i.e. step #2 above did not happen. The most common reason for this is that the option to deploy the application to the device is turned off in the Configuration Manager.

To check whether this is the case, open the Configuration Manager (Build -> Configuration Manager...). In the Configuration Manager, verify that the Deploy option for the device project is enabled.

Configuration Manager

Habib Heydarian.

Posted by habibh | 0 Comments
Filed under:

Web Application Projects: No Help for you!

I always find these types of bugs amusing and somewhat ironic. The other day, I was doing some work with Web Application Projects. When I first tried to open the project, Visual Studio 2008 kindly warned me that in order to use IIS with my WAP, I need to run Visual Studio elevated. Wanting to learn more about this, I pressed the F1 key to get more information. It turns out that F1 doesn't work.

So now, I need help to find out why Help (F1) doesn't work! Should I start searching for why Help doesn't work or should I go back to investigating the original error message?

 Example 1: No Help for you!

Although I really don’t like running anything as elevated, I accepted what the dialog told me at face value and restarted Visual Studio as Administrator. Guess what happened next? Visual Studio gave me another helpful message about not having IIS installed. What's amusing is that the new error message suffers from exactly the same bug as the previous dialog. That is, Help (F1) does nothing!

Example 2: No Help for you!

Finally, I gave up and used bing to get some "real" help!

Habib Heydarian.

Posted by habibh | 0 Comments
Filed under:
More Posts Next page »
 
Page view tracker