[英]I got error when press F12 Go to definition in Visual Studio 2015 / C#
When I press F12 (Go To Definition) in Visual Studio 2015 I get this error message: 当我在Visual Studio 2015中按F12(转到定义)时,我收到此错误消息:
One or more errors occured
发生一个或多个错误
I already tried: 我已经尝试过:
.. but that didn't fix it. ..但这并没有解决。
Please help. 请帮忙。
This is an issue with C# and tabs instead of spaces when attempting to hit the metadata of an external assembly. 尝试访问外部程序集的元数据时,这是C#和制表符而不是空格的问题。 It may be related the inferred position of the insertion point.
可能与插入点的推断位置有关。
There are a couple of Connect tickets here and here and a Github issue on this. 这里和这里有几张Connect门票,以及与此相关的Github问题 。 There is also a discussion here .
还有一个讨论在这里 。
This issue is addressed in Update 1 so please install! 此问题已在更新1中解决,因此请安装!
The options dialog remembers the last page and remains there on subsequent opens. 选项对话框会记住最后一页,并在后续打开时保留在那里。 I have a keyboard shortcut to open the options pane quickly (Alt + o).
我有一个键盘快捷键可以快速打开选项窗格(Alt + o)。 I am temporarily changing to spaces, going to definition and then reverting to tabs before making any code changes.
我暂时更改为空格,转到定义,然后在更改任何代码之前恢复为制表符。 This workflow isn't pretty but neither were the 3.0 Nuget issues in VS2015 either (Nuget 3 has improved to date).
这个工作流程不是很漂亮,但是VS2015中的3.0 Nuget问题也没有(Nuget 3迄今为止已得到改进)。
VS 2015 Update 1 should fix this problem. VS 2015 Update 1应该可以解决此问题。
I have made an extension which simply enables/disables "Keep tabs" on each call of "GoToDefinition" command, and seems to work:
GoToDefinition Fix
我做了一个扩展,它仅在每次调用“ GoToDefinition”命令时启用/禁用“保持选项卡”,并且似乎可以正常工作:
GoToDefinition Fix
I found that; 我找到; if you set Keep Tab under Option -> Text Editor -> All Languages -> Tabs , and it's the same under C# , the F12 and Alt + F12 Works just fine.
如果在选项 -> 文本编辑器 -> 所有语言 -> 选项 卡下设置Keep Tab ,并且在C#下相同,则F12和Alt + F12可以正常工作。
This hack is no longer useful now that the Visual Studio bug is fixed. 现在,Visual Studio错误已修复,这种黑客攻击不再有用。 I'm leaving it here in case it's useful a sample for hacking around similar issues that come up.
我将其保留在此处,以防它对于破解即将出现的类似问题很有用。
AutoHotKey to the rescue! AutoHotKey来解救! Fighting tirelessly against the evils of bad keyboard UX.
与不良键盘UX的弊端进行不懈的斗争。
Here's how to set up a script that binds Ctrl+F12 to a key sequence that sets space indents, goes to the definition, and then restores tab indents. 以下是设置脚本的方法,该脚本将Ctrl + F12绑定到一个键序列,该键序列设置了空间缩进,进入了定义然后恢复了制表符缩进。 Use it instead of F12 to go to definitions outside your codebase:
使用它代替F12可以转到代码库之外的定义:
FixF12.ahk
. FixF12.ahk
类的地方创建一个新文件。 Paste into it the script below. shell:startup
into the Windows Explorer location bar. shell:startup
到达那里。 FixF12.ahk
into Startup
and create a shortcut. FixF12.ahk
拖动到“ Startup
然后创建一个快捷方式。 Script for FixF12.ahk
: FixF12.ahk
脚本:
#NoEnv
SendMode Input
^F12::
WinGetActiveTitle Title
IfInString Title, Microsoft Visual Studio
{
Send, ^QC{#} tabs{Enter}
Sleep, 300
Send, !p
Sleep, 300
Send, {Enter}
Send, {F12}
Send, !tO
Sleep, 300
Send, !k
Sleep, 300
Send, {Enter}
}
else
{
Send, {^F12}
}
The script is a hack, complete with flashing dialog boxes and a race condition, but it does the job. 该脚本是一个hack,具有闪烁的对话框和竞争条件,但可以完成任务。 Don't forget to upvote the bug report in Connect .
不要忘记在Connect中提高bug报告的质量 。 Hopefully Microsoft will release a fix before Update 1.
希望Microsoft将在Update 1之前发布修复程序。
Visual Studio 2015 Update 1解决了此问题!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.