This appears to only be a problem for VB, in C# it behaves correctly.
Consider the following code:
Visual BasicPublic Function Test() As String
Dim astring = "123"
Dim cstring = "blah"
Return astring
End Function
On the return line, select astring then press the c key on your keyboard (eg, to change it to return cstring). Instead of the selection being replaced with the letter 'c', the try catch embedding is triggered:
Visual BasicPublic Function Test() As String
Dim astring = "123"
Dim cstring = "blah"
Try
Return astring
Catch ex As Exception
End Try
End Function
In C# this is only triggered if the entire line is selected, so it looks like the scope is broken. The same sort of thing happens with 'n', 'f', etc. This is really irritating, so I'd welcome a quick fix for it. Not sure why, but I've only noticed it in the last day or so, despite not updating coderush or visual studio recently. Only extension that has changed was an update to the MS reporting services project extension.
Hi Kevin,
Thank you for contacting us and providing the code samples.
I tried to reproduce this issue on my side but without success - everything works as expected.
To help us research this issue, please provide us with additional information:
- CodeRush settings (they can be obtained here: %AppData%\CodeRush\Settings.xml);
- CodeRush log files (they can be obtained here: %LocalAppData%\CodeRush\Logs).
We are looking forward to your response.
I don't seem to have a Settings.xml at that location, only a settings folder - I have zipped and attached the folder
And here are the logs
Thank you for providing additional information, Kevin.
I managed to reproduce this issue now.
We will research it and let you know as soon as we make progress.
Cheers. Hopefully just an issue with my settings then. Strange, as I'm not aware of any recent changes there either. It's hit me about a dozen times today, though, and nothing prior to this bunch of occurences
Hi Kevin,
We have fixed this issue and prepared a build with hotfix: CodeRush.Roslyn-17.2.6.18053.exe.
Please install it and let us know how it works.
Thanks Pavel. I've installed that and it seems to have done the trick. Are you able to say what caused it? I'm not aware of any changes to my environment (other than the reporting services extension I mentioned) that might have triggered it, but I had so many occurrences yesterday with none before that, that it's hard to believe it had been a problem for a while
Thank you for the update, Kevin. We are happy to hear that the issue is resolved.
It was exactly the CodeRush issue that we introduced in the latest release and it is not related to your environment.
The next release will contain a hotfix.