dotnet / format

Home for the dotnet-format command
MIT License
1.92k stars 171 forks source link

Stop dotnet format from removing thrown exceptions #2061

Closed talbananaz closed 5 months ago

talbananaz commented 6 months ago

catch (Exception ex)
        {
            throw ex;
        } ``` 

        gets changed to 

      ```c#    catch (Exception ex)
        {
            throw;
        }```
sharwell commented 5 months ago

dotnet format is not responsible for this change. The project in question has enabled an analyzer (I am not sure which one) which includes a code fix to make this alteration. The configuration for invoking dotnet format and/or the configuration for this project would need to be updated to reflect the developer preferences in order for this change to not occur.