Open risto-slice opened 1 week ago
Tagging subscribers to 'arch-wasm': @lewing See info in area-owners.md if you want to be subscribed.
The custom-attr.c:2001 warning is here:
The assertion is here:
It looks like we're trying to get the list of InternalsVisibleTo
attributes - we do it by trying to load all the [assembly:]
custom attributes and to load the MonoMethod for all of them. That ends up failing become some attribute's definition doesn't get loaded properly.
It seems like there might be a trimmer problem - some custom attribute constructor was trimmed away but the [assembly:xyz]
attribute was left in place.
Possibly mono should be more lax here. mono_custom_attrs_from_assembly_checked
has an ignore_missing
argument that gets propoagated down to mono_custom_attrs_from_index_checked
but at this call site it is FALSE
which makes us assert.
Tagging subscribers to this area: See info in area-owners.md if you want to be subscribed.
I managed to create a repo with minimal steps to reproduce this: https://github.com/risto-slice/BlazorApp.HttpClientTest/tree/master
I deleted a lot of code from my existing library that I use and left out a piece of it that causes this error. When you launch the Blazor app, it will fail with that error. However, if you remove the reference to the library and comment out the few lines of code that come from the reference, it will work again. So something from that library is causing the entire app to malfunction.
Hope that helps @lambdageek. Let me know if I can help anyhow, or if you can see a potential workaround for this problem.
Is there an existing issue for this?
Describe the bug
I am getting an Exception when my code is trying to access
HttpClient
methods. For example, I have the following code:I left out the commented code, because that one actually works. No exception is thrown when accessing it like that. My implementation for the service is the following:
And I register it like this:
Interestingly, I tried the exact same code in a brand new project, but it works there. For some reason it does not work here. It's somehow connected to
HttpClient
, because when I comment out this particular line in my service:var x = (await _httpClient.GetAsync("todos")).Content.ReadAsStringAsync();
everything works just fine.The
HttpClient
injected is fine, the instance is notnull
, the base address is set correctly and I can't find anything wrong with it. But when I have code to callGetAsync
, it does NOT enter the method at all, it throws the exception before it makes the call to the method somehow. Never enters it.Expected Behavior
The application should work when I try to access
GetAsync
(or any other method onHttpClient
) without throwing any exceptions.Steps To Reproduce
This is a rather large project and I am not sure how to reproduce the error. I tried on a brand new project and I did not get the same problem. But I am hoping that I could get some ideas how to find the root issue here. I would post the project, but I am not allowed to because it's private and medium-level large (has ~25 pages). Ideally if possible I would like to get better errors that might get me closer to finding the root cause.
Exceptions (if any)
.NET Version
8.0.400
Anything else?
.NET 8 (Blazor WebAssembly) Visual Studio 2022
dotnet --info: .NET SDK: Version: 8.0.400 Commit: 36fe6dda56 Workload version: 8.0.400-manifests.56cd0383 MSBuild version: 17.11.3+0c8610977
Runtime Environment: OS Name: Windows OS Version: 10.0.22631 OS Platform: Windows RID: win-x64 Base Path: C:\Program Files\dotnet\sdk\8.0.400\
.NET workloads installed: Configured to use loose manifests when installing new manifests. [aspire] Installation Source: VS 17.11.35208.52, VS 17.11.35208.52 Manifest Version: 8.1.0/8.0.100 Manifest Path: C:\Program Files\dotnet\sdk-manifests\8.0.100\microsoft.net.sdk.aspire\8.1.0\WorkloadManifest.json Install Type: FileBased
Host: Version: 8.0.8 Architecture: x64 Commit: 08338fcaa5
.NET SDKs installed: 8.0.400 [C:\Program Files\dotnet\sdk]
.NET runtimes installed: Microsoft.AspNetCore.All 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.All] Microsoft.AspNetCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.AspNetCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App] Microsoft.NETCore.App 2.1.30 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.NETCore.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App] Microsoft.WindowsDesktop.App 3.1.32 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 5.0.17 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 6.0.33 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 7.0.20 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App] Microsoft.WindowsDesktop.App 8.0.8 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
Other architectures found: x86 [C:\Program Files (x86)\dotnet] registered at [HKLM\SOFTWARE\dotnet\Setup\InstalledVersions\x86\InstallLocation]
Environment variables: Not set
global.json file: Not found
Learn more: https://aka.ms/dotnet/info
Download .NET: https://aka.ms/dotnet/download