Bug 37269 - formatting document (c# file) strips 'when' clause of try/catch construct (alpha track)
Summary: formatting document (c# file) strips 'when' clause of try/catch construct (al...
Status: RESOLVED ANSWERED
Alias: None
Product: Xamarin Studio
Classification: Desktop
Component: Text Editor ()
Version: 5.10 (C6SR3)
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: master
Assignee: Mike Krüger
URL:
Depends on:
Blocks:
 
Reported: 2015-12-23 18:31 UTC by Frederic Rudman
Modified: 2015-12-23 18:58 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and 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 Links.

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.

Related Links:
Status:
RESOLVED ANSWERED

Description Frederic Rudman 2015-12-23 18:31:58 UTC
Description of Problem: formatting documents strips 'when' clause of try/catch construct


Steps to reproduce the problem:
1. create a try/catch statement with the new 'when (..condition...)' clause
2. format document (whole document but probably same problem if fmt selection)


Actual Results:

public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your fragment here

            try {
                var d = new object();
                var xc = d?.Equals(null) ?? false;
                var x = $"ddd{d}";
            }
            catch (Exception ex) { //when (ex is OperationApplicationException) {
            }

        }

Expected Results:
public override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your fragment here

            try {
                var d = new object();
                var xc = d?.Equals(null) ?? false;
                var x = $"ddd{d}";
            }
            catch (Exception ex) when (ex is OperationApplicationException) { //when (ex is OperationApplicationException) {
            }

        }


How often does this happen? 
every single time

Additional Information: happens on ALPHA track of studio. (Will try on beta, then on regular to see if it's better or not)
Comment 1 Mike Krüger 2015-12-23 18:58:57 UTC
Will work in 6.0