Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.IO.FileLoadException: Undefined resource string ID:0x80131621 #101581

Open
Zhiyuan-Amos opened this issue Apr 26, 2024 · 1 comment
Open
Labels
area-System.Net.Http untriaged New issue has not been triaged by the area owner

Comments

@Zhiyuan-Amos
Copy link

Description

Observe that client.GetAsync errors out with the following error message: System.IO.FileLoadException: Undefined resource string ID:0x80131621. This issue only occurs when both conditions are true:

  1. Using a HttpClient created with a custom HttpClientHandler overriding SendAsync (even though the overriding method merely calls the base method and so it should technically be equivalent to not overriding the method).

  2. Specifying <InternalsVisibleTo> in the .csproj file, where the Include property has a value with at least 1 / e.g. ../ProjectMoreThanOnePathAway.

Reproduction Steps

// Program.cs
var client = new HttpClient(new CustomHttpClientHandler());
await client.GetAsync("https://www.google.com");

class CustomHttpClientHandler : HttpClientHandler
{
    protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) 
        => base.SendAsync(request, cancellationToken);
}

// .csproj
<InternalsVisibleTo Include="../ProjectMoreThanOnePathAway" />

I've created a minimal codebase to reproduce this issue: https://github.com/Zhiyuan-Amos/FileNotFoundError

Expected behavior

HTTP Request completes successfully.

Actual behavior

Http Request errors out with System.IO.FileLoadException: Undefined resource string ID:0x80131621.

Regression?

This error did not occur in .NET 6.

Known Workarounds

Make the Program class public using a partial class declaration (see dn for Integration Tests).

Configuration

.NET Version: 8
OS & Architecture: MacOS M1, Linux x64

Other information

No response

@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Apr 26, 2024
Copy link
Contributor

Tagging subscribers to this area: @dotnet/ncl
See info in area-owners.md if you want to be subscribed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-System.Net.Http untriaged New issue has not been triaged by the area owner
Projects
None yet
Development

No branches or pull requests

1 participant