dotnet / dotnet/wpf

FileNotFoundException occurs

Open
#9,155 4 comments 1 reaction 0 assignees View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

### Description

**Description**:

1. When we try to get the Satellite Assembly from the instance of the assembly. It throws the exception. Kindly refer the code snippet to replicate it.

`Assembly lookupAssembly = Assembly.GetEntryAssembly();
lookupAssembly = lookupAssembly.GetSatelliteAssembly(CultureInfo.CurrentUICulture);`

Stack Trace:

mscorlib.dll!System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(string name, System.Globalization.CultureInfo culture, System.Version version, bool throwOnFileNotFound, ref System.Threading.StackCrawlMark stackMark) Unknown
mscorlib.dll!System.Reflection.RuntimeAssembly.InternalGetSatelliteAssembly(System.Globalization.CultureInfo culture, System.Version version, ref System.Threading.StackCrawlMark stackMark) Unknown
mscorlib.dll!System.Reflection.RuntimeAssembly.GetSatelliteAssembly(System.Globalization.CultureInfo culture) Unknown
> WpfCustomCtrl.dll!WpfCustomCtrl.LocalizationResourceAccessor.GetLocalizedResourceManager(System.Reflection.Assembly lookupassembly, string nameSpace) Line 126 C#
WpfCustomCtrl.dll!WpfCustomCtrl.LocalizationResourceAccessor.LocalizationResourceAccessor() Line 40 C#
WpfCustomCtrl.dll!WpfCustomCtrl.SharedLocalizationResourceAccessor.SharedLocalizationResourceAccessor() Unknown
WpfCustomCtrl.dll!WpfCustomCtrl.SharedLocalizationResourceAccessor.SharedLocalizationResourceAccessor() Line 15 C#
[Native to Managed Transition]
[Managed to Native Transition]
[Native to Managed Transition]
ExceptionCustom.exe!ExceptionCustom.App.Main() Unknown

Sample:
[WpfCustomCtrl.zip](https://github.com/dotnet/wpf/files/15418512/WpfCustomCtrl.zip)
[ExceptionCustom.zip](https://github.com/dotnet/wpf/files/15418545/ExceptionCustom.zip)

### Reproduction Steps

Just run the sample with the code snippet

### Expected behavior

![image](https://github.com/dotnet/wpf/assets/93642597/144665b7-e8f2-4ee8-98fc-d7fc90e93971)

### Actual behavior

Need to run properly

### Regression?

It works properly in .NetCore.

### Known Workarounds

_No response_

### Impact

_No response_

### Configuration

- .Net Framework 4.8
- Windows 10 21H2
- AnyCPU

### Other information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.