getsentry / sentry-dotnet

Sentry SDK for .NET
https://docs.sentry.io/platforms/dotnet
MIT License
598 stars 206 forks source link

Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_options_set_logger' #3369

Open klemmchr opened 6 months ago

klemmchr commented 6 months ago

Package

Sentry

.NET Flavor

.NET

.NET Version

8.0.5

OS

Any (not platform specific)

SDK Version

4.6.2

Self-Hosted Sentry Version

No response

Steps to Reproduce

  1. Compile a Blazor project with AoT enabled (Repro from #3263 should work)
  2. Observe warning in build

Expected Result

No warning

Actual Result

During AoT the following warning is emitted

[WRN] /usr/share/dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/8.0.5/Sdk/WasmApp.Native.targets(338,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_options_set_logger' because 'Parsing function pointer types in signatures is not supported.' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]

The app itself works fine, I don't observe any errors in console or during build.

bitsandfoxes commented 6 months ago

@vaind do you think we can disable the warning now that we're guarding and not initializing sentry-native on Blazor? It does sound like a potential foot gun down the road tho.

vaind commented 6 months ago

I don't think we can do anything else than disable the warning. There's only a runtime check for us to use: https://github.com/dotnet/aspnetcore/issues/38667#issuecomment-981099588 thus we cannot get rid of the warning by not including the code at all.