fix: clear the last two build warnings (C# CA2255, WASM license files) (#304)

- C#: the [ModuleInitializer] that registers the DllImport resolver is the
  one legitimate library use of the attribute (a static ctor would run too
  late), so suppress CA2255 with a documented justification — the dotnet
  build is now warning-clean.
- WASM: add LICENSE-MIT + LICENSE-APACHE to bindings/wasm so wasm-pack stops
  warning about missing license files and the published npm package ships
  its license texts.

Full warnings audit: Rust, C, C++, Go, Java, Node, Python, C#, WASM all
build clean; R installs clean.
This commit is contained in:
kingchenc
2026-06-15 05:26:06 +02:00
committed by GitHub
parent 120b6ac265
commit ce792cf8b8
3 changed files with 229 additions and 0 deletions
+7
View File
@@ -23,6 +23,13 @@ internal static class WickraNative
// Any exported symbol works as a fingerprint; sma_new exists in every build.
private const string SentinelSymbol = "wickra_sma_new";
// CA2255 warns against [ModuleInitializer] in libraries, but registering the
// native-library resolver before any P/Invoke runs is exactly the advanced
// scenario the attribute exists for: a static constructor would run too late
// (only on first access to this type), letting the default resolver fail first.
[System.Diagnostics.CodeAnalysis.SuppressMessage(
"Usage", "CA2255:The 'ModuleInitializer' attribute should not be used in libraries",
Justification = "The DllImport resolver must be registered before the first P/Invoke; a static constructor would run too late.")]
[ModuleInitializer]
internal static void Register()
{