Skip to content

Fix duplicate errors for undefined types on resources#19273

Open
brendandburns wants to merge 7 commits intoAzure:mainfrom
brendandburns:duplicate
Open

Fix duplicate errors for undefined types on resources#19273
brendandburns wants to merge 7 commits intoAzure:mainfrom
brendandburns:duplicate

Conversation

@brendandburns
Copy link
Copy Markdown
Member

@brendandburns brendandburns commented Mar 26, 2026

Summary

  • fix #5025 by short-circuiting resource type analysis when the resource type syntax is skipped
  • prevent emitting a secondary generic resource-type diagnostic in that scenario
  • add unit test coverage for the desired behavior:
    • Missing_resource_type_in_resource_declaration_emits_only_first_type_diagnostic
  • include formatter-driven whitespace updates in touched C# files
  • include related lockfile updates

Issue

Fixes #5025

Key Changes

  • src/Bicep.Core/TypeSystem/DeclaredTypeManager.cs
    • early return in GetDeclaredResourceType(ResourceDeclarationSyntax resource) when resource.Type.IsSkipped
  • src/Bicep.Core.UnitTests/Semantics/ResourceDeclarationDiagnosticTests.cs
    • adds regression test asserting only BCP068 is emitted for resource trailingSpace

Validation

  • dotnet test src/Bicep.Core.UnitTests/Bicep.Core.UnitTests.csproj --filter "FullyQualifiedName~ResourceDeclarationDiagnosticTests"
  • dotnet format --verify-no-changes
  • dotnet format style --diagnostics IDE0005 --severity info --verify-no-changes
Microsoft Reviewers: Open in CodeFlow

@brendandburns brendandburns changed the title Apply formatter fixes and lockfile updates Fix duplicate errors for undefined types on resources Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Duplicated diagnostics on resource without type string

1 participant