Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_options_set_logger'
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
- Compile a Blazor project with AoT enabled (Repro from #3263 should work)
- 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.
@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.
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.
Closing as this issue seems to have been resolved now. Please feel free to reopen if you believe otherwise.
Which version is supposed to fix this issue? We're running 5.14.1 but we still get a lot of WASM warnings.
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_new_object' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_new_object' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_new_null' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_new_null' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_new_string' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_new_string' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_new_breadcrumb' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_new_breadcrumb' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_set_by_key' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_set_by_key' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_is_null' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_is_null' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_as_int32' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_as_int32' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_as_string' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_as_string' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_get_length' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_get_length' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_get_by_index' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_get_by_index' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_get_by_key' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_get_by_key' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_add_breadcrumb' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_add_breadcrumb' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_set_user' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_set_user' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_set_extra' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_set_extra' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_get_modules_list' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_get_modules_list' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: Could not get pinvoke, or callbacks for method 'Sentry.Native.C::sentry_value_decref' because 'System.NotSupportedException: Unsupported parameter type in method 'Sentry.Native.C.sentry_value_decref' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.<CollectPInvokes>g__CollectPInvokesForMethod|6_0(MethodInfo method, <>c__DisplayClass6_0&) [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
13:11:23 [WRN] /root/.dotnet/packs/Microsoft.NET.Runtime.WebAssembly.Sdk/9.0.9/Sdk/WasmApp.Common.targets(793,5): warning WASM0001: at PInvokeCollector.CollectPInvokes(List`1 pinvokes, List`1 callbacks, HashSet`1 signatures, Type type)' [/builds/acodia-care/acodia-care/src/Web/Web.Blazor/Web.Blazor.csproj]
I wonder if this is a larger (not just Blazor WebAssembly) issue with our sentry-native functions.
Perhaps we should consider using the Source-Generated variant via LibraryImportAttribute on NET7_0_OR_GREATER.