-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Handle potential null in ALC.ResolveSatelliteAssembly #40817
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
Conversation
I would expect these to return "" for |
|
Do we need a test for this? This should be testable for all targets platforms. |
|
Sorry, it does return "", got mixed up there. The Mono behavior for that is correct, and I'll edit the description. This seems somewhat annoying to test on non-wasm since I don't know how to actually run a test suite from the root of a file system. I'm not sure how I'd go about it and would like to get this fix to the aspnetcore team asap, but if you can offer some direction on how to actually test this in practice I'm happy to add it. |
This was found on wasm, where assemblies are primarily loaded from a bundle rather than on the filesystem itself and return "" for Assembly.Location. This bug should affect desktop too if you have an assembly in the root of the file system (for whatever reason).
d8aa358 to
6005198
Compare
Can the problem be triggered by resolving satellite assembly for a user assembly with empty Location? |
|
I think it'll only crash with the corlib resource assembly? Normally we would just swallow the error and keep moving with the loading algorithm, but the recursive lookup is what's causing problems. I guess I could load an assembly from memory and then call |
|
I guess the alternative for testing is to just create a single-file project on desktop (probably with a Mono bundle) and test with that, which seems more useful but again somewhat difficult to fit into our current testing scheme. I'm not opposed to that route, but I'd rather open an issue and get this PR in without since I think it would be fairly involved. |
|
If the problem can be hit for CoreLib only, then I agree it is too difficult to add a test for it, not worth it. |
|
Looks good to merge. |
This was found on wasm, where assemblies are primarily loaded from a bundle rather than on the filesystem itself and return "" for Assembly.Location. This bug should affect desktop too if you have System.Private.CoreLib in the root of the file system (for whatever reason).
This manifested oddly in dotnet/aspnetcore#24773 because we threw an exception while trying to look up the corlib satellite assembly, which in turn triggered another load on that same resource due to the exception text, the usual recursive problem. The solution is to not throw the exception in the first place.