在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
Should "Go To Definition" from a VB Web Application display C# code in a referenced C# code library project? I created a VB Web application that calls both a VB Code Project Library and a C# Code Project Library. When attempting to select “Go To Definition” of the VB method 'GetTestData()' I am able to view the VB class code. However selecting “Go To Definition” on the C# method 'GetTestData()' sends me to the object browser. Is this normal for C#? To test against C#, I created a Test C# Web App, and both the VB and C# (F12) are sent to the code. Am I seeing the correct behavior, or is there a way for the VB application to drill down to C# Code? I should note the C# code does debug fine. It will be able to maintain a large C# Code Library we are using in our Web Application unless I find a workaround for this issue. Thanks. ---------------------- This is the reason i got from product team This issue is by design given our current architecture and has always existed in the product. The reason this occurs is because a different compiler is used for each type of project (the C# one for C# projects and the VB one for VB projects) and they each populate a separate symbol table. This symbol table is not shared in a live way across the two types of projects – symbol sharing occurs once an assembly has been flushed to disk. The project-to-project reference between a C# and VB project is treated like a file assembly reference where all symbols are treated as if coming from metadata. ---------------------- from: http://forums.asp.net/p/1260157/3482953.aspx#3482953
F12 - Go To DefinitionA few months ago when Bill Gates was on the Daily Show, Jon Stewart asked him a particularly insightful software question: "So...what does the F12 button do? Does it do anything? Is it a joke button". To which Bill replied jokingly - "I'd stay away from it if I were you." If you use Visual Studio though - I recommend you ignore Bill's advice here. F12 is a quite useful keyboard shortcut. Go To DefinitionF12 itself invokes the "Go To Definition" (GTD) command. This works on types, members, locals, range variables, etc. It uses all the compiler's internal understanding of the code to make sure it takes you to the right member - even when there are many overloads or if your code is using a lot of type inference. Metadata As SourceOne of the additions to "Go To Definition" support in Visual Studio 2005 was something we call "Metadata as Source". If you go to definition on a type which is defined in a referenced assembly - you will be presented with a "header file"-style view of the corresponding type and it's members. This keeps you in the editor - and gives a convenient view of the type. You can continue to navigate other members/types directly from the Metadata As Source view by using GTD again on those tokens. Backward and Forward navigationIf you use GTD a lot, you'll probably find yourself wanting to go "back" to where you invoked "go to definition" from. It turns out there is a keybinding for this:
Code Definition WindowThe Code Definition Window is toolwindow which shows a live GTD of whatever symbol is currently under the cursor in the editor. If you find yourself using GTD a lot, you may want to pop up the Code Definition Window with ctrl-w-d. BTW - If you are looking for more useful keyboard shortcuts using the C# Profile in Visual Studio - take a look at the C# keybinding posters Karen blogged about a little while ago. From: http://blogs.msdn.com/lukeh/archive/2007/06/04/f12-go-to-definition.aspx |
请发表评论