Skip to content

Fix DAP037 for scalar enum query results - #230

Open
dajiaohuang wants to merge 1 commit into
DapperLib:mainfrom
dajiaohuang:fix/enum-result-dap037-20261016
Open

dajiaohuang wants to merge 1 commit into
DapperLib:mainfrom
dajiaohuang:fix/enum-result-dap037-20261016

Conversation

@dajiaohuang

Copy link
Copy Markdown

Problem

Query<MyEnum>(...) is a supported scalar query, but the analyzer treats the enum as a user-defined record and reports DAP037 because it has no writable fields or properties. This prevents an otherwise working query from compiling.

Change

Classify enum results alongside the existing special-case scalar result types. Add analyzer regression coverage for enum and nullable-enum query results; existing tests continue to cover genuinely non-materializable record and array results. The generator/runtime are unchanged.

Fixes #228.

Validation

  • New analyzer test fails on the base with DAP037 and passes with the change.
  • .NET 10: 246 selected analyzer, interceptor-golden, API-surface, SQLite and related diagnostic/conversion tests passed.
  • .NET Framework 4.8: both DAP037 tests passed.
  • A separate .NET 10 consumer using the rebuilt generator/runtime executed an in-memory Microsoft.Data.Sqlite query returning enum values from integer and text rows; it also exercised anonymous parameters and named-tuple mapping. The equivalent shipped 1.1.0 consumer fails compilation with DAP037.

Local SDK was 10.0.100 (the repository's 10.0.203 pin was temporarily overridden for local commands only, not changed in this PR). Existing build/restore warnings remain. No NativeAOT publish or external database/provider-matrix validation is claimed.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAP037 error when return type is an enum

1 participant