This repository was archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Make ResourceManager use Assembly instead of RuntimeAssembly internally. #21979
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
12f9f0f
Make ResourceManager use Assembly instead of RuntimeAssembly internally.
filipnavara 8d2b63e
Fix exception name.
filipnavara a5a1fc2
Fix method qualifiers.
filipnavara 4f6f30a
Add generic implementation of GetNeutralResourcesLanguageAttribute.
filipnavara a343b92
PR feedback (removed SimpleName optimization, added back restriction …
filipnavara dba3e80
Move function accidentally added to shared partition.
filipnavara File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -335,7 +335,7 @@ internal static RuntimeAssembly InternalLoadAssemblyName( | |
| bool throwOnFileNotFound, | ||
| IntPtr ptrLoadContextBinder = default) | ||
| { | ||
| return InternalLoadAssemblyName(assemblyRef, reqAssembly, ref stackMark, IntPtr.Zero, true /*throwOnError*/, ptrLoadContextBinder); | ||
| return InternalLoadAssemblyName(assemblyRef, reqAssembly, ref stackMark, IntPtr.Zero, throwOnFileNotFound, ptrLoadContextBinder); | ||
| } | ||
|
|
||
| internal static RuntimeAssembly InternalLoadAssemblyName( | ||
|
|
@@ -646,15 +646,13 @@ public override Assembly GetSatelliteAssembly(CultureInfo culture, Version versi | |
| if (culture == null) | ||
| throw new ArgumentNullException(nameof(culture)); | ||
|
|
||
| string name = GetSimpleName() + ".resources"; | ||
| return InternalGetSatelliteAssembly(name, culture, version, true); | ||
| return InternalGetSatelliteAssembly(culture, version, true); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved the name generation to |
||
| } | ||
|
|
||
| [System.Security.DynamicSecurityMethod] // Methods containing StackCrawlMark local var has to be marked DynamicSecurityMethod | ||
| internal RuntimeAssembly InternalGetSatelliteAssembly(string name, | ||
| CultureInfo culture, | ||
| Version version, | ||
| bool throwOnFileNotFound) | ||
| internal Assembly InternalGetSatelliteAssembly(CultureInfo culture, | ||
| Version version, | ||
| bool throwOnFileNotFound) | ||
| { | ||
| // This stack crawl mark is never used because the requesting assembly is explicitly specified, | ||
| // so the value could be anything. | ||
|
|
@@ -670,13 +668,18 @@ internal RuntimeAssembly InternalGetSatelliteAssembly(string name, | |
| an.Version = version; | ||
|
|
||
| an.CultureInfo = culture; | ||
| an.Name = name; | ||
| an.Name = GetSimpleName() + ".resources"; | ||
|
|
||
| RuntimeAssembly retAssembly = nLoad(an, null, this, ref stackMark, | ||
| IntPtr.Zero, | ||
| throwOnFileNotFound); | ||
|
|
||
| if (retAssembly == this || (retAssembly == null && throwOnFileNotFound)) | ||
| if (retAssembly == this) | ||
| { | ||
| retAssembly = null; | ||
| } | ||
|
|
||
| if (retAssembly == null && throwOnFileNotFound) | ||
| { | ||
| throw new FileNotFoundException(string.Format(culture, SR.IO_FileNotFound_FileName, an.Name)); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not directly related to the PR, but it should be fixed nevertheless. The method takes the
throwOnFileNotFoundparameter, but it didn't actually use it.