Skip to content

Fix empty catch blocks — add handling or explanatory comments #5449

Description

@liliankasem

Summary

There are at least 3 instances of empty or near-empty catch blocks that swallow exceptions without explanation. Per our coding standards, silently swallowing exceptions is only acceptable for genuine best-effort cleanup paths, and the catch block must include a comment explaining why losing the exception is acceptable.

Instances

  1. src/Templates.DotNet/ItemTemplateHiveProvisioner.cs — empty catch
  2. src/Templates.DotNet/DefaultDotnetTemplateRunner.cs — empty catch
  3. src/Func/Quickstart/ManifestCache.cs — empty catch without explanatory comment

Proposed Fix

For each instance:

  • If the catch is intentional (best-effort cleanup), add an explanatory comment per coding standards
  • If the catch is hiding bugs, add proper error handling (log, rethrow, or wrap in domain exception)

Acceptance Criteria

  • No empty catch blocks without explanatory comments
  • Any catches that were hiding real errors are fixed with proper handling
  • Build and tests pass

Metadata

Metadata

Assignees

Labels

GARequired for v5 GA / stable releasev5

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions