-
Notifications
You must be signed in to change notification settings - Fork 97
Open
Labels
Frameworkanalyzersissues regarding the Roslyn analysersissues regarding the Roslyn analysersenhancement
Description
A couple of users were dealing with this unintuitive behavior - when they perform a redirect or returning a file, they wrap it in a try/catch block, and catch all exceptions. However, DotVVM throws DotvvmInterruptRequestExecutionException which needs to be rethrown.
public async Task OnDownloadFile()
{
try
{
...
await Context.ReturnFileAsync(bytes, "file.csv", "application/octet-stream");
}
catch (System.Exception ex)
{
...
}
}We already have Roslyn analyzers in the project. We should detect this pattern when ReturnFile* or Redirect* is called on IDotvvmRequestContext, and if it is inside try/catch block, ensure there is a special case for DotvvmInterruptRequestExecutionException where the exception is rethrown as such:
catch (DotvvmInterruptRequestExecutionException)
{
throw;
}
Copilot
Metadata
Metadata
Assignees
Labels
Frameworkanalyzersissues regarding the Roslyn analysersissues regarding the Roslyn analysersenhancement