Notice (2018-05-24): bugzilla.xamarin.com is now in
Please join us on
Visual Studio Developer Community and in the
Mono organizations on
GitHub to continue tracking issues. Bugzilla will remain
available for reference in read-only mode. We will continue to work
on open Bugzilla bugs, copy them to the new locations
as needed for follow-up, and add the new items under Related
Our sincere thanks to everyone who has contributed on this bug
tracker over the years. Thanks also for your understanding as we
make these adjustments and improvements for the future.
Please create a new report on
Developer Community or GitHub with
your current version information, steps to reproduce, and relevant error
messages or log files if you are hitting an issue that looks similar to
this resolved bug and you do not yet see a matching new report.
I'd like to see a refactor like I have available in DevExpress CodeRush (VS 2012) where I can select a class and refactor "Move Class to File" and a new file is created in the same folder as this file and the file name is that of the class name, and the code is moved into this class.
Some programmers put multiple classes into a single file which is sometimes not the best idea or good coding practice (one file, multiple classes) and as CodeRush does it suggests moving these to their own files. It would help us if Xam Studio could include this type of refactoring and start assisting with good programming practices as DevExprsss has a system in CodeRush called "Code Issues" that helps with this. Another thing it does is grays out unused methods so you know when you have a method no longer in use, if you want to consider that as well. Maybe you unwire an event subscription and the "Handles..." method becomes dead code.
Just a few ideas...
We already have that btw.
btw. we've a code issue system as well - you need to turn it on.
It's a bit hidden - search for 'Source Analysis' in the text editor options.
I think the move type to file refactoring is bound to this option as well ...
Found it, turned it on, works great! Thanks Mike
I hope we'll add more actions & issues in the future :)
I'm currenly adding a ton and we've 2 gsoc students writing issues and actions.
btw. if you find gaps in our code actions & code issues let me know.
Internally we've much more than on the 4.0.12 release - we got tons of new stuff the last month - but we need input & ideas.
I would suggest that if a class resides in a file and the class name and file name don't match, offer these options like CodeRush:
1) Rename file to match type
2) Rename type to match file
If there are multiple classes in a file and there is one that exists that matches the file name and others that do not, suggest that those others are moved to their own file.
Is there a way to find suggestions suppressed so they can be turned back on?
Another option is a "Code Analysis Window" that you open and it analyzes the entire project or solution and lists the issues in a window that you can see from a higher level view of the entire work as to what needs to be fixed.
I suggest a replacement like I suggested for "braces" but for asyncifying methods. For example a surround with "Task.Run". Help people transition to async.
If I think of anything else I'll let you know.
You can re-enable inspections using Preferences -> Source Code -> C# -> Code Inspections
There's no inspection for suggesting moving classes to their own files, there's only a context action to do the actual move.
There's a code analysis pad, though it's only enabled on master. We have a Summer of Code student working on it (these experimental source analysis features are side project for the core MD team, not official, so it's useful to have students working full time on them..).
I think there is a problem with the .StartsWith inspection. I have code that has something like:
I get a yellow underline telling me I'm supposed to be providing a StringComparison argument
It's not a bug - you should provide a string comparison argument :)
There are no overloads in this method. Look at the assembly browser on StartsWith in this use:
public bool StartsWith(string value)
if (value == null)
throw new ArgumentNullException("value");
return CultureInfo.CurrentCulture.CompareInfo.IsPrefix(this, value, CompareOptions.None);
I'll look at this code issue - seems it doesn't check the right method then.
(string.StartsWith () is the thing it should warn about)
Another one of my favorite features in Coderush is "tab to next reference". Click into a field or method name then everytime you tab it takes you to the next reference as if you did a find all references, tab takes you to each of those references.
SystemVersion is a string - therefore StartsWith is correct.
There are overloads that take a StringComparison argument.
btw the next/prev reference thing is cmd+shift up/down (but you need to enable highlight referenced items first in the options)