Using Reflector to debug a .Net app in Visual Studio without the original source code

Tools, Visual Stutio No Comments »

Many .Net developers use to say “if you’re a serious developer, then you MUST Reflector”.

I would like to add another statement: “if you want to have an insight and powerful look at how things works internally, use Reflector Professional”.

Last Wednesday, RedGate released a new version of Reflector. You’re probably going to download it soon or later because your actual version is going to expire. When you’ll download the free version, you’ll automatically get a trial (14 days) of the professional edition. Nice, but what’s so special about this edition ?

Let’s see a demonstration of what can be done using Reflector Pro. The following is not an ad for RedGate, I’m just totally amazed by their new feature :-)

1. Reflector is now integrated into Visual Studio (2005, 2008 and 2010 RC):

2. Select the “Choose Assemblie to Debug…” option to select .Net assemblies for which you don’t have the source code. In this example, I’m using one of the Blend3’s assemblies:

3. Once the process is completed, select the “Explore Decompiled Assemblies” option:

4. Browse to your target assembly and select an interesting type:

5. Put a breakpoint in the code, like you do every day when you debug an app:

6. Run the executable

7. Debug Blend3’s source code ! Use breakpoints, step into methods, inspect variables…

And that’s it. With Reflector Professional, you can:

  • Decompile third-party assemblies from within Visual Studio
  • Step through decompiled assemblies and use all the debugging techniques you would use on your own code. This is incredibly powerful as we saw by debugging Blend3″s source code !

Reflector Professional is available for about 195$ on RedGate website

Review of 2009 blog posts

General No Comments »

In the past year, I’ve posted more than 30 articles on my blog. Here is a summary of those posts (link in bold are those which got the most traffic during the year). Obviously, MVVM was a very hot topic during 2009 :-)

January

February

March

April

May

July

August

September

October

November

Using Snoop to take a look at VS2010 !

.Net, Visual Stutio 5 Comments »

If like me you’re curious about how big WPF applications are made, you probably tried to use Snoop to inspect the visual tree of Visual Studio 2010 Beta2. And you probably had a problem because Snoop wasn’t able to detect the devenv process of VS2010:

I wasn’t sure about the cause of this problem, but I grab the source of Snoop and took a look at the code that list the available window:

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
public void Refresh() {
	this.windows.Clear();
 
	foreach (IntPtr windowHandle in NativeMethods.ToplevelWindows) {
		WindowInfo window = new WindowInfo(windowHandle, this);
		if (window.IsValidProcess && !this.HasProcess(window.OwningProcess))
			this.windows.Add(window);
	}
 
	if (this.windows.Count > 0)
		this.windowsView.MoveCurrentTo(this.windows[0]);
}

I setup a breakpoint to find out what was wrong and discover that the window.IsValidProcess failed with the VS2010 process. Because I just wanted to check if it was the only reason why Snoop wasn’t able to inspect it, I hack the code to remove this test:

?View Code CSHARP
1
2
3
4
5
6
7
8
9
10
11
12
public void Refresh() {
	this.windows.Clear();
 
	foreach (IntPtr windowHandle in NativeMethods.ToplevelWindows) {
		WindowInfo window = new WindowInfo(windowHandle, this);
		if (/*window.IsValidProcess &&*/ !this.HasProcess(window.OwningProcess))
			this.windows.Add(window);
	}
 
	if (this.windows.Count > 0)
		this.windowsView.MoveCurrentTo(this.windows[0]);
}

And it’s working:

vs2010-snoop

Happy exploration with Snoop :-)

Visual Studio 2010: Beta1 available with .Net4 and WPF4 included

Visual Stutio 2 Comments »

In case you missed it, Beta1 of Visual Studio 2010 has been announced yesterday.

vs2010

Since monday it is available to all MSDN subscribers, and will be avaible to the rest of the world on wednesday. Documentation has also been updated to show the new features of this release.

The download is on its way and I’ll try to post feedback as soon as I can, stay tuned !

Browse your codebase like a pro with ReSharper

Tools, Visual Stutio No Comments »

I’ve already blogged about R# a couple of times. There is no doubt: it’s a must have for any serious .Net developper. A few weeks ago I learned and setup new shortcuts to improve my navigation skills in Visual Studio.

Here are the results… If I want:

  • to find a Type I hit Ctrl+T
  • to find a File I hit Ctrl+Shift+T
  • to find a Member (in a file) I hit Ctrl+Alt+T (Note: I setup this one on my own using Tools/Options/Keyboard)

A search box opens and I can start searching instantaneously.

resharpernavigation1

Here are the basic scenarios :

  • I want to open the ViewModelBase class, I hit Ctrl+T and then VMB (R# is able to search using capital letters)
  • I want to go to the OnPropertyChanged, I hit Ctrl+Alt+T and then OPC (same as previous example)
  • Finally, to open the file in the Solution Explorer I hit Shift+Alt+L

It’s simply amazing the time we can save using those simple shorcuts. Of course, you need to be quite familiar with your codebase (if you just arrive on a project it will be harder :p)

The future of WPF at Mix09

Events 1 Comment »

mix09

MIX09 is now over and the good news is that we can watch all sessions that have been recorded online !

I didn’t have time yet to watch all sessions I’m interested in, but I already saw “What”s new in WPF 4″ video (available here).

Here are the important points of this session regarding the future of WPF:

  • Lot of new things are coming in WPF4: Text clarity improved, Multi-touch, Windows7 integration, Ribbon control, Focus management improvements, Visual State Manager, Client profile, Themes, Chart controls and a lot of bug fixes
  • WPF4 will come together with .Net4 which brings its own set of cool new stuff: Dynamic Language, MEF, F#, parallel library
  • WPF will be the best choise for RAD under Windows7: Multi-touch, Taskbar integration, Ribbon, Common dialogs, File explorer customization…
  • Multi-touch support: UIElement changes to manage touch related events, touch support is added for some controls (ScrollViewer)
  • New composition API: developers can control graphical elements cached in video memory
  • Controls that are currently available in the WPF toolkit will be integrated into the platform (DataGrid, DatePicker…) – moreover an update of the toolkit has just been released
  • Developers tools are improved: VS2010 and Blend3 helps the usage of WPF (databinding support…)
  • .Net4 will come with a new XAML parser: faster, extensible, public API to manage BAML format
  • .Net4 XAML language has new XAML features: support for generics, better references by name

I hope will see a CTP soon so that we’ll start playing with those new features :-)

VS2010 UI

Visual Stutio 1 Comment »

I’ve been very busy the last few weeks and I don’t have lot of time to write new articles…

Anyway, new informations are available about VS2010 UI (which will use WPF !), more details here: http://blogs.msdn.com/jasonz/archive/2009/02/20/a-new-look-for-visual-studio-2010.aspx

I can’t wait to play with a new beta :-)

Visual Studio 2010 CTP

Visual Stutio 1 Comment »

As you may already now, a CTP (Community Technology Preview) of the next version of Visual Studio is available to download. I took some time yesterday evening to try it and here is the result of my first hour using Visual Studio 2010.

Read the rest of this entry »

Historical debugger in Visual Studio 10

General No Comments »

As you may already know, last week, Microsoft reveals the next version of Visual Studio : Visual Studio 2010.

To give more details about the new features, a “Visual Studio 10″ week was set up on Channel9, and every day new features were described. You can find a list of the available screencast here.

I didn’t have time to watch all the videos, but I take a look at the historical debugger video and I must admit I was really impress by this new tool. Basically, using the historical debugger feature we will be able to “record” a debug session, and then, as using a “time machine” we will be able to step back in time through the debugger and find out what goes wrong.

I think this is a very cool feature and we can hope to improve the time we need to fix a bug (no more need to set multiple breakpoints to get closer to the bug iteration after iteration). I’m looking forward to play with it !

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in