resharper

Where do I mark a lambda expression async?

心已入冬 提交于 2019-11-27 17:45:39
I've got this code: private async void ContextMenuForGroupRightTapped(object sender, RightTappedRoutedEventArgs args) { CheckBox ckbx = null; if (sender is CheckBox) { ckbx = sender as CheckBox; } if (null == ckbx) { return; } string groupName = ckbx.Content.ToString(); var contextMenu = new PopupMenu(); // Add a command to edit the current Group contextMenu.Commands.Add(new UICommand("Edit this Group", (contextMenuCmd) => { Frame.Navigate(typeof(LocationGroupCreator), groupName); })); // Add a command to delete the current Group contextMenu.Commands.Add(new UICommand("Delete this Group",

Is there a resharper comment directive to disable code cleanup for a class?

巧了我就是萌 提交于 2019-11-27 17:40:12
问题 I have a class where FileHelpers is dependent on the field order in this class file. If the class file ever gets a code clean up run against it that will cause the fields to be sorted alphabetically and invisibly ruin my class. Since I would like to avoid this from ever accidentally occuring, is there a resharper comment directive to disable code cleanup for a class? 回答1: You can customize the default member layout XML file and specify a pattern you want to ignore during the "reorder members"

Test method is inconclusive: Test wasn't run. Error?

余生颓废 提交于 2019-11-27 17:32:57
I have a test class and below I have posted a sample test from the test class namespace AdminPortal.Tests.Controller_Test.Customer { [TestClass] public class BusinessUnitControllerTests { private IBusinessUnitRepository _mockBusinessUnitRepository; private BusinessUnitController _controller; [TestInitialize] public void TestInitialize() { _mockBusinessUnitRepository = MockRepository.GenerateMock<IBusinessUnitRepository>(); _controller = new BusinessUnitController(_mockBusinessUnitRepository); } [TestCleanup] public void TestCleanup() { _mockBusinessUnitRepository = null; _controller.Dispose();

How do I make my own method similar to String.Format using Composite Formatting in C#

冷暖自知 提交于 2019-11-27 17:15:43
问题 I like how String.Format uses arguments to inject variables in to the string it is formatting. This is called Composite Formating and is discussed by MSDN here. I want this functionality with my logging facade: string foo = "fancy"; string bar = "message"; log.Debug("My {0} log {1}.", foo, bar) My ILoggerFacade has the following method signature: void Debug<T>(T message, params Object[] args); And, I know I can implement this quite simply: ILog m_Log = \\some logging implementation public

Why does ReSharper tell me “implicitly captured closure”?

 ̄綄美尐妖づ 提交于 2019-11-27 16:50:35
I have the following code: public double CalculateDailyProjectPullForceMax(DateTime date, string start = null, string end = null) { Log("Calculating Daily Pull Force Max..."); var pullForceList = start == null ? _pullForce.Where((t, i) => _date[i] == date).ToList() // implicitly captured closure: end, start : _pullForce.Where( (t, i) => _date[i] == date && DateTime.Compare(_time[i], DateTime.Parse(start)) > 0 && DateTime.Compare(_time[i], DateTime.Parse(end)) < 0).ToList(); _pullForceDailyMax = Math.Round(pullForceList.Max(), 2, MidpointRounding.AwayFromZero); return _pullForceDailyMax; } Now,

Keyboard shortcuts are not active in Visual Studio with Resharper installed

时光毁灭记忆、已成空白 提交于 2019-11-27 16:48:41
I have Visual Studio 2012 + Resharper 7.1.1000.900 + StyleCop 4.7.44 installed. The problem is that no shortcuts are active since Resharper was installed. For example: I can rename via 'Refactor > Rename'. But shorcut Ctrl + R does nothing. I've set Resharper keyboard scheme to 'Visual Studio' in 'Resharper > Options > Environment > Keyboard & Menus' Is there any way to activate shortcuts? Thanks. I would first try resetting all Visual Studio settings ( Tools > Import and Export Settings > Reset all settings ), then go to the Resharper > Options > Keyboard & Menus and re-apply the keyboard

How to make ReSharper re-evaluate its assembly reference highlighting

我的未来我决定 提交于 2019-11-27 16:41:17
I am creating a Prism Project Template, and the template works great. But after I create a project with the template some of the files look like this: Despite appearances, everything is just fine. If I do a Rebuild All I see that the solution builds with no errors: But the rebuild all does not get rid of the "errors" that are showing in the editor window. (Note that the actual error window does not show any errors.) I can clean, rebuild, close and open files, and it will not fix the highlighting. However, if I close the solution and re-open it, all is well : My Question: Ideally there would be

Should these arguments be added or removed?

半腔热情 提交于 2019-11-27 16:08:55
When Resharper argues with itself, how does one know which persona to give more credence? I think I have found some code that does confuse Resharper (this is apparently a very unusual case - after using it for a day, I think Resharper is the bee's knees/the greatest thing since liquified bread, etc.). With this line of code: ICryptoTransform Encryptor = RijndaelCipher.CreateEncryptor(SecretKey.GetBytes(32), SecretKey.GetBytes(16)); Resharper tells me to "add argument name 'rgbkey'" and then "add argument name 'rgbIV'" So that the line is then: ICryptoTransform Encryptor = RijndaelCipher

Disable all Resharper warnings with a comment

三世轮回 提交于 2019-11-27 15:34:32
问题 Is there a way to disable all Resharper warnings for a file or section of code with a single comment? I'm trying to create some coding exercises for interviewing potential candidates, and the Resharper warnings give away the problem I want the candidate to spot :P Suppressing the specific warning still makes it obvious what the problem is. I still want to have Resharper available during the interview, I just want the candidate to spot this problem without Resharper spoiling the fun. edit :

How to extend IntelliSense items?

假装没事ソ 提交于 2019-11-27 14:40:58
I would like to manually extend the IntelliSense list by various items. I want to be responsible for the action triggered by the item (i.e. code completion and tooltip info). It doesn't matter what items. Is this possible with an VisualStudio add-in, ReSharper / DXCore or any otherg plugin? Background: Some of you may know FOP (feature-oriented programming). FOP would require various changes to intellisense and editor behavior. Edit: Another interesting post . This is definitely doable very easily by writing a ReSharper plugin . Start by implementing ICodeCompletionItemsProvider which will