fix: remove unused SQLite native asset warning in TodoApp.BlazorWasm.Client#560
Merged
Merged
Conversation
…Client CommunityToolkit.Datasync.Client depends unconditionally on Microsoft.EntityFrameworkCore.Sqlite, which transitively adds a browser-wasm NativeFileReference for SourceGear.sqlite3's e_sqlite3.a via SQLitePCLRaw.bundle_e_sqlite3 (pinned in this project only to resolve NU1903, see CommunityToolkit#492). This client never uses SQLite/ OfflineDbContext (verified: no references to DbContext, Sqlite, or OfflineTable anywhere in the project), so the native asset is dead weight and trips a benign, code-less warning from the SDK's WorkloadManifest.targets: warning : @(NativeFileReference) is not empty, but the native references won't be linked in, because neither $(WasmBuildNative), nor $(RunAOTCompilation) are 'true'. Root cause traced to SourceGear.sqlite3's buildTransitive targets, which unconditionally add the native asset whenever $(RuntimeIdentifier) == 'browser-wasm', independent of which SQLitePCLRaw.bundle_e_sqlite3 version resolves. Since the warning has no diagnostic code it can't be suppressed via NoWarn, so instead remove the specific unused NativeFileReference item before the SDK's _CheckBrowserWorkloadNeededButNotAvailable target runs. Verified locally (dotnet restore + build samples/todoapp-blazor-wasm/TodoApp.BlazorWasm.sln, matching build-samples-todoapp-blazor-wasm.yml): warning present twice in a clean build before this change, zero occurrences after, with an otherwise identical Debug build (0 Warning(s), 0 Error(s)). Also verified the root Datasync.Toolkit.sln still restores/builds clean and CommunityToolkit.Datasync.Client.Test passes 1432/1432 (unaffected by this samples-only change, but confirms no regression). Fixes CommunityToolkit#523
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
samples/todoapp-blazor-wasm/TodoApp.BlazorWasm.Clientproduced a benign, code-less MSBuild warning during a plaindotnet build:Root cause
CommunityToolkit.Datasync.Clientdepends unconditionally onMicrosoft.EntityFrameworkCore.Sqlite(confirmed by inspectingsrc/CommunityToolkit.Datasync.Client/CommunityToolkit.Datasync.Client.csproj), which transitively resolves toSourceGear.sqlite3viaSQLitePCLRaw.bundle_e_sqlite3(the version pinned in this project only to resolve NU1903 - see #492).SourceGear.sqlite3's ownbuildTransitive/net9.0/SourceGear.sqlite3.targetsunconditionally adds aNativeFileReferencefore_sqlite3.awhenever$(RuntimeIdentifier) == 'browser-wasm'- independent of whichSQLitePCLRaw.bundle_e_sqlite3version resolves, so pinning a narrower package wouldn't avoid it.TodoApp.BlazorWasm.Clientnever uses SQLite/OfflineDbContext(verified: no references toDbContext,Sqlite, orOfflineTableanywhere in the project) - it only usesCommunityToolkit.Datasync.Clientfor online HTTP access - so this native asset is genuinely unused. The warning itself comes from the .NET SDK's own_CheckBrowserWorkloadNeededButNotAvailabletarget inWorkloadManifest.targets, which has no diagnostic code and therefore can't be suppressed viaNoWarn.Fix
Remove the specific unused
e_sqlite3.aNativeFileReferenceitem fromTodoApp.BlazorWasm.Client.csprojbefore the SDK's browser-workload check target runs:This fixes the root cause (an asset that's provably never used) rather than just suppressing the symptom, and is scoped to this single sample project - no change to
CommunityToolkit.Datasync.Clientor any other sample.Testing
dotnet restore+dotnet build samples/todoapp-blazor-wasm/TodoApp.BlazorWasm.sln --configuration Debug(matchesbuild-samples-todoapp-blazor-wasm.ymlexactly): negative control confirmed the warning appears twice on a clean build without this change, and zero times with it -0 Warning(s), 0 Error(s).dotnet restore+dotnet build Datasync.Toolkit.sln: clean,0 Warning(s), 0 Error(s).dotnet test tests/CommunityToolkit.Datasync.Client.Test: 1432/1432 passed (unaffected by this samples-only change, confirms no regression).Build SamplesGitHub Actions workflow on this branch in my fork: all 18 jobs succeeded, includingtodoapp-blazor-wasm / buildand theAll samples builtaggregation job - https://github.com/adrianhall/CommunityToolkit-Datasync/actions/runs/29146333208Fixes #523