I just noticed that when you try to generate a method stub on code where there are more { than }, the method stub gets generated incorrectly.
For instance:
static void Main(string[] args) {
myMethod();
}
creating a method stub for myMethod() expands correctly into:
static void Main(string[] args) {
myMethod();
}
private static void myMethod() {
throw new NotImplementedException();
}
However! If I now continue and add:
{
newMethod();
And try to generate a method stub for newMethod(), I get this:
static void Main(string[] args) {
myMethod();
{
newMethod();
}
private
private static void newMethod()
{
throw new NotImplementedException();
} static void myMethod() {
throw new NotImplementedException();
}
}
Can I configure Visual Studio somehow as to do it correctly? Or is this something that would have to be reported to someone?
I think this is a case of garbage in, garbage out.
If your code is written in such a way that it’s impossible for the auto-generation tools to tell where one code block ends and another begins then I wouldn’t expect it to be able to produce meaningful results.