The Visual Studio debugger will not load characters into files that have `(backtick) in the file name. Can someone explain this?

I was debugging some code in Visual Studio 2005 when I noticed that the IDE did not hit breakpoints in a specific generic class. I could manually go into the class, but the tooltips shown when hovering over links contained nothing but memory addresses, instead of the usual friendly hints.

It turns out the problem is caused by the file name (!). In particular, when the file name contains the character `(backtick, backquote), the debugger will not load characters for this file. The workaround is to rename the file.

First of all, I used a backlink to represent a general type of power:

  • Foo.cs contains a non-generic type (e.g. Foo)
  • Foo`1.cs contains a generic type with a parameter of the same type (for example, Foo <T>)
  • Foo`2.cs contains a common parameter with two type parameters (for example, Foo <T, U>)

This error (is it?) Also occurs in Visual Studio 2008.

Can anyone explain this behavior?

+4
source share
1 answer

I got the impression that behind the scenes the generated types are compiled into types that have inverse images in their names. Say you had List<int> and List<string> , you would have two classes behind the scenes. One of them will be System.Collections.Generic.List'1 , and the other System.Collections.Generic.List'2 . These classes can be generated and stored in files with the same name (with the extension .cs).

I assume that if you insert backlinks in your file name, you will mess with this mechanism.

I reflect here because I have not researched it, but could it be something for you? :)

Good luck.

EDIT - use apostrophes instead of backticks, as they are reserved in this editor :)

+5
source

All Articles