Archive for the 'Visual Studio' Category

27
Dec
08

How to Debug Crashes and Hangs

How to Debug Crashes and Hangs article by Kirill Osenkov [MSFT] summarizes useful things about debugging in Visual Studio.

12
Nov
08

VS2008 SP1 WPF Designer Hotfix

Microsoft released a hotfix for Visual Studio 2008 SP1 WPF Designer. Following issues have been fixed:

  • When a resource in an external resource dictionary is updated, Visual Studio 2008 crashes.
  • WPF Designer cannot load read-only attached properties, such as the VisualStateManager. VisualStateGroups property.
  • If users or codes set a data binding locally, and then the users or codes clear the data binding, WPF designer reports the following error message: ‘System.Windows.Data.Binding’ is not a valid value for property.
  • If a Win32 project is set as the startup project, WPF Designer cannot load solutions in Visual Studio 2008 or in Visual Studio 2008 Service Pack 1.
  • When you set and then delete the Source property of a WPF WebBrowser control, Visual Studio crashes.
  • When you move a control that uses the MultiTrigger class or the DataTrigger class in the Style class, WPF Designer may generate an InvalidCastException exception.

The package can be dowloaded directly from the MSDN Code Gallery. This hotfix is not needed and you must not install it if you have Silverlight Tools for Visual Studio 2008 SP1 (or plan to install it).

09
Nov
08

Visual Studio Productivity

It is impossible to use Visual C++ 2008’s IDE, as nothing really works there – no IntelliSence, no refactorings, nothing. The same sad story can be told about the Visual Studio’s XAML editor – it just sucks (by the way, you get much better experience by using Visual Studio’s XML editor to edit XAML files). So, finally I got really tired of this, and decided to do something.

I went through quite many packages, and settled down on two – Visual Assist X for Visual Studio by Whole Tomato ($249 retail) and ReSharper by Jetbrains ($349 retail, although Euro price is 315€, weird).

Visual Assist X is super-great for C++. In fact, it is “Visual C++ IDE made right” kind of tool – fixes all problems existing in VS and adding a lot of nice extra goodies that can really improve your productivity: working IntelliSense, refactorings, code outlining and browsing, searching for symbols, code coloring, etc. etc. etc. Some of the abovementioned features are available for C# and VB.NET as well.

ReSharper is doing similar things for C#, VB.NET and XAML, as well as for ASP.NET, XML, MS Build scripts and NAnt. Finally you can browse XAML files and have the ability to quickly jump to referenced resources!

So far so good. These tools can work together on one Visual Studio 2008 setup seemingly without major issues. The only bad thing I have noticed is their “competition” for IntelliSense in C# – both are showing their pop-ups and it is a bit annoying. This problem is not seen in XAML, as VAX is not supporting XAML, and in C++, as ReSharper is not supporting C++. So far I couldn’t resolve this issue, as I do not see any configuration settings that would allow me to switch off IntelliSense for C# in one tool or another. In the end of the day, it is not major issue and I should say these tools work very well together.

I do not understand, why Microsoft cannot do something similar to what these tools are doing straight out of the box? If Microsoft’s team cannot do this on its own (because they are busy developing one more piece of useless fancy marketing crappy feature), then I do not get why they cannot buy e.g. Whole Tomato? If they were ready to waste billions on Yahoo (which would give them what advantage? and please, do not tell me about advertisement business – I do not understand why Microsoft being software house should go to Internet business “just because”), then they should rather spending miniscule fraction of that cost and get real boost for all the developers that use their unfinished tools and technologies (WPF, VS2008, Blend, you name it). Just my 2 cents…

UPDATE The abovementioned issue with conflicting IntelliSense pop-ups can be partially resolved by switching off IntelliSense support in ReSharper (Options… and then Environment > IntelliSense > General page).

14
Oct
08

Problem with C++/CLI + ATL Combo

Exactly… Wanted to use ATL (for CComPtr class and some other things) in my C++/CLI project (VS2008 with or without SP1) and… got nice assert on _CrtIsValidHeapPointer(pUserData) in dbgheap.c. Cool! Exactly that was missing to make my day better!

Some investigation, and I had answer to my problem. Actually two answers. Both pretty simple:

  1. As I had /NOENTRY specified in the No Entry Point item in the Linker/Advanced section of the project settings, I could add __DllMainCRTStartup@12 to the Force Symbol References item in the Linker/Input section of the project settings
  2. Alternatively, I could set No Entry Point item in the Linker/Advanced section of the project settings to No (as I said, I had /NOENTRY there)

I have tried both solutions, and both worked; I settled on the latter as more intuitive and clean. Always live, always learn…

09
Sep
08

Monitoring Last Error Code in Visual Studio

Found this trick in the Jeffrey Richter’s Windows via C/C++ book (in Chapter 1). Visual Studio debugger has a very useful feature – it can monitor the thread’s last error code. You can display this error code together with its text description in the Watch window by typing $err,hr. In case some API call fails, the Watch window will show the error code (the one that would be returned by the GetLastError function). Thanks to the ,hr qualifier, the Watch window shows the error description as well (the string mentioned in the WinError.h header file for the occured error code).

03
Sep
08

Clone Detective for Visual Studio

Clone Detective for Visual Studio allows you to analyze C# projects for source code that is duplicated somewhere else. I have not tried the tool myself yet, but the idea is really nice. One thing I do not like so far – it needs Java (yes, right, the J-word!) to run.

The tool currently supports only C#, but C++ and VB are promised too, although it is not clear when they will come. Support for these (and some other) languages is already available in the ConQAT toolkit that is used by the Clone Detective, so it might not take very long time.

20
Aug
08

PowerCommands for Visual Studio 2008

PowerCommands for Visual Studio 2008 is a set of useful extensions for the Visual Studio 2008 adding additional functionality to various areas of the IDE. Examples of commands: Format document on save, Remove and Sort Usings on save, Remove and Sort Usings, and many more.

11
Aug
08

VS2008 SP1 and .NET 3.5 SP1 are Here!

The long awaited SP1 for .NET 3.5 and Visual Studio 2008 are finally here! ISO is available here and EXE – here. Before installing you need to run Visual Studio 2008 Service Pack Preparation Tool in case you had SP1 beta or some hotfixes installed earlier.

There are also Visual Studio 2008 Service Pack 1 Remote Debugger and Visual Studio 2008 Service Pack 1 Stand-Alone Profiler.

And, of course, here is the .NET Framework 3.5 Service Pack 1 itself, either as a bootstrapper or as a full package. Note, that you do not need these if you are installing VS2008 SP1 – .NET 3.5 SP1 is already included with it.

13
May
08

.NET 3.5 and VS2008 SP1 Betas

Microsoft released SP1 Betas of .NET 3.5 and VS2008. More info is available from Tim Sneath, Scott Guthrie, and, related info about shaders from Greg Schechter.