fix: suppress WASM0001 sqlite3_config/db_config varargs warnings on TodoApp.Uno browserwasm#567
Merged
Merged
Conversation
…odoApp.Uno browserwasm The browserwasm head emits a WASM0001 warning for every fixed-arity P/Invoke overload SQLitePCLRaw.provider.e_sqlite3 ships to work around sqlite3_config/sqlite3_db_config being variadic (varargs) native functions. This sample's actual SQLite usage (in-memory EF Core CRUD via AppDbContext) never calls those functions directly, so the warning is diagnostic-only noise from the WebAssembly SDK's build-time native-interop check. WASM0001 is a standard MSBuild task warning code (emitted via TaskLoggingHelper.LogWarning in dotnet/runtime's WasmAppBuilder), so it honors NoWarn like any other build warning - the same suppression already documented for Blazor WASM in docs/in-depth/client/advanced/blazor-wasm.md. Suppress it, scoped to the browserwasm TFM only, following the existing GetTargetPlatformIdentifier-conditional pattern used for SuppressTrimAnalysisWarnings in the same file (see CommunityToolkit#521/CommunityToolkit#534). Also add a short note to the Uno Platform sample docs pointing at the Blazor WASM page for more detail on the warning and how to suppress it in a consumer's own project. Closes CommunityToolkit#543
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #543.
The
browserwasmhead ofTodoApp.Unoemits a block ofWASM0001warnings about unsupported native varargs functions in the bundled SQLite provider:CI run that surfaced this: https://github.com/CommunityToolkit/Datasync/actions/runs/29093946725 (
todoapp-uno / browserwasmjob)Root cause
e_sqlite3's nativesqlite3_config/sqlite3_db_configC functions are variadic (varargs), which the WebAssembly toolchain's managed-to-native interop cannot support.SQLitePCLRaw.provider.e_sqlite3ships several fixed-arity P/Invoke overloads (sqlite3_config_none,sqlite3_config_int,sqlite3_config_log, etc.) to work around this for the specific configuration calls SQLitePCLRaw itself needs — the WebAssembly SDK's build-time native-interop check flags all of them anyway as a blanket "any varargs-shaped native symbol is risky" warning, even though this sample's actual SQLite usage (AppDbContextconfigured withUseSqliteagainst an in-memory connection inApp.xaml.cs) never callssqlite3_config/sqlite3_db_configdirectly.Why suppress rather than fix the code
WASM0001is emitted viaTaskLoggingHelper.LogWarning(..., warningCode: "WASM0001", ...)indotnet/runtime'sWasmAppBuilder(PInvokeTableGenerator.cs→LogAdapter.Warning) — the standard MSBuild task-warning overload, which honors$(NoWarn)/warnings-as-errors filtering like any other build warning (CS*,NETSDK*, etc.). This repo already documents and uses exactly this suppression for the same warning on the Blazor WASM sample, indocs/in-depth/client/advanced/blazor-wasm.md(added in #394):Unlike the Blazor WASM sample — which never actually uses SQLite and instead removes the unused native asset before the workload check runs (see #523) —
TodoApp.Unogenuinely configures EF Core with the SQLite provider on every head, includingbrowserwasm, so that trick doesn't apply here. Suppression is the correct fix, matching the issue's own root-cause analysis.Changes
samples/todoapp/TodoApp.Uno/TodoApp.Uno/TodoApp.Uno.csproj— added<NoWarn Condition="...GetTargetPlatformIdentifier(...) == 'browserwasm'">$(NoWarn);WASM0001</NoWarn>, scoped to thebrowserwasmTFM only (the only head that runs the WebAssembly SDK's native-interop check), following the sameGetTargetPlatformIdentifier-conditional pattern already used in this file forSuppressTrimAnalysisWarnings(see IL2026/IL2104 trim analysis warnings on TodoApp.Avalonia.iOS build #521/TodoApp.Uno: trim analysis warnings (IL2026/IL2104/IL2121) on browserwasm/ios/maccatalyst heads #534).docs/samples/todoapp/unoplatform.md— added a short callout about theWASM0001warning on thebrowserwasmhead, pointing readers at the more detailedblazor-wasm.mdexplanation for why it occurs and how to suppress it in their own projects.Testing
dotnet restore/dotnet build --configuration DebugonDatasync.Toolkit.sln— succeeded, 0 warnings / 0 errors. (This solution doesn't include the edited sample project, confirming no impact on the core library.)dotnet test Datasync.Toolkit.sln --no-build --configuration Debug—CommunityToolkit.Datasync.Client.Test: 1432/1432 passed, plus all non-container-dependent server test suites passed 100%.Server.Test/Server.MongoDB.Test/Server.EntityFrameworkCore.Testhad pre-existing, environment-only failures (no local Docker daemon; those suites depend on TestContainers) — unrelated to this change, matching the precedent noted in fix: suppress IL2026/IL2104 trim analysis warnings on mobile TodoApp samples #531.build-samples.ymlon this branch viaworkflow_dispatch: run 29150192782 — all jobs succeeded, includingtodoapp-uno / browserwasm, which now reports0 Warning(s)(previously the block ofWASM0001warnings shown above), and theall-samples-builtaggregation gate.Related
WASM0001suppression pattern this PR reuses, for the Blazor WASM sample.SQLitePCLRaw/native-asset handling this warning builds on.