resharper

Resharper: Implicitly captured closure: this

☆樱花仙子☆ 提交于 2019-11-27 13:22:56
问题 I am getting this warning ("Implicity captured closure: this") from Resharper: does this mean that somehow this code is capturing the entire enclosing object? internal Timer Timeout = new Timer { Enabled = false, AutoReset = false }; public Task<Response> ResponseTask { get { var tcs = new TaskCompletionSource<Response>(); Timeout.Elapsed += (e, a) => tcs.SetException(new TimeoutException("Timeout at " + a.SignalTime)); if (_response != null) tcs.SetResult(_response); else ResponseHandler +=

Visual Studio not showing IntelliSense descriptions anymore

我的梦境 提交于 2019-11-27 13:08:26
问题 Since a month ago, my VS doesn't seem to want to display the summary info in tooltips for any system methods or classes when I hover them with my mouse. I had ReSharper installed and started noticing this problem. I assumed that ReSharper disabled the default method descriptions, so I wasn't thinking much further about it, only considering it a mere annoyance. After removing ReSharper though, the problem persisted. VS now only shows descriptions for my own methods which I've added a <summary>

ReSharper (or something like it) for Visual C++? [closed]

£可爱£侵袭症+ 提交于 2019-11-27 12:59:25
问题 I've seen ReSharper recommended a lot Unfortunately, it doesn't support C++ in Visual Studio. Is there anything out there you can recommend? I already use Visual Assist, and it does its job very well, but it's quite limited in comparison with ReSharper. Any suggestions? 回答1: Refactor Pro is available for Visual C++, this will give you some functionality. Also check out CodeRush, I think it also supports C++. 回答2: IMHO - Visual Assist X is best but expensive code completion/refactoring tool

Code editor appears blank

有些话、适合烂在心里 提交于 2019-11-27 12:44:49
问题 I was using ReSharper with visual studio 2015 and my pc got really slow because of ReSharper and i had to uninstall it. After uninstallation completed when i opened up my project the only thing i saw was a blank screen like this. I know that uninstalling ReSharper caused it and i looked and tried to fix it by changing Text Editor options but nothing worked so far. I've also searched about this issue and nothing came across yet. Thanks 回答1: This error is caused by a corrupted Visual Studio

String Interpolation vs String.Format

旧时模样 提交于 2019-11-27 12:15:51
Is there a noticable performance difference between using string interpolation: myString += $"{x:x2}"; vs String.Format()? myString += String.Format("{0:x2}", x); I am only asking because Resharper is prompting the fix, and I have been fooled before. Jeroen Vannevel Noticable is relative. However: string interpolation is turned into string.Format() at compile-time so they should end up with the same result. There are subtle differences though: as we can tell from this question, string concatenation in the format specifier results in an additional string.Concat() call. string interpolation is

autoformat code from command line

五迷三道 提交于 2019-11-27 12:14:14
问题 Is it possible to run auto-format code for all or for specific file in solution, like (Ctrl+K, Ctrl+D) formatting in Visual Studio but from it`s command line? Or use Resharper's cleanup also from command line for solution files? 回答1: To format net core c# source, use https://github.com/dotnet/format Install the tool as per the project readme. I had a need to format some code files I was generating from Razor templates. I created a shell .CSProj file in the root of my output folder, using

Advantages of using const instead of variables inside methods

对着背影说爱祢 提交于 2019-11-27 11:59:54
Whenever I have local variables in a method, ReSharper suggests to convert them to constants: // instead of this: var s = "some string"; var flags = BindingFlags.Public | BindingFlags.Instance; // ReSharper suggest to use this: const string s = "some string"; const BindingFlags flags = BindingFlags.Public | BindingFlags.Instance; Given that these are really constant values (and not variables) I understand that ReSharper suggest to change them to const. But apart from that, is there any other advantage when using const (e.g. better performance) which justifies using const BindingFlags instead

Resharper's example code for explaining “Possible multiple enumeration of IEnumerable”

两盒软妹~` 提交于 2019-11-27 11:45:19
Sometimes Resharper warns about: Possible multiple enumeration of IEnumerable There's an SO question on how to handle this issue , and the ReSharper site also explains things here . It has some sample code that tells you to do this instead: IEnumerable<string> names = GetNames().ToList(); My question is about this specific suggestion: won't this still result in enumerating through the collection twice in the 2 for-each loops? CodeCaster GetNames() returns an IEnumerable . So if you store that result: IEnumerable foo = GetNames(); Then every time you enumerate foo , the GetNames() method is

Disable C# 6.0 Support in ReSharper

社会主义新天地 提交于 2019-11-27 11:44:20
While using ReSharper, it suggested "Enable C# 6.0 support for this project". I foolishly clicked on it, and now as advertised it's giving me suggestions for C# 6.0 - which then give me errors as I am not using C# 6.0 in this project. How can I disable C# 6.0 support, returning it to how it was before? (Preferably without having to individually ignore specific suggestions) Click the project node in the Solution Explorer. Then look in the Property Grid (F4). You'll see a property named "C# Language Level". Set that to "Default" or your desired language level. TO disable it at once across the

Could string comparisons really differ based on culture when the string is guaranteed not to change?

大城市里の小女人 提交于 2019-11-27 11:25:33
问题 I'm reading encrypted credentials/connection strings from a config file. Resharper tells me, "String.IndexOf(string) is culture-specific here" on this line: if (line.Contains("host=")) { _host = line.Substring(line.IndexOf( "host=") + "host=".Length, line.Length - "host=".Length); ...and so wants to change it to: if (line.Contains("host=")) { _host = line.Substring(line.IndexOf("host=", System.StringComparison.Ordinal) + "host=".Length, line.Length - "host=".Length); The value I'm reading