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

Could not load file or assembly System.Configuration.ConfigurationManager even when in BeautyExcludes #48

Closed
mightyPolo108 opened this issue Feb 27, 2023 · 8 comments

Comments

@mightyPolo108
Copy link

Hi.
Iam having issues with assembly System.Configuration.ConfigurationManager on net6/Windows10.

I tried to use BeautyExcludes System.;Microsoft. but to no avail.

The error message is
Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=7.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'. Could not find or load a specific file. (0x80131621)

I can see the file is present in output folder, but somehow its not seen by the nbloader?

I tried sharedmode / excludes nothing worked.

Is there something special about this assembly?
How can I work around this?

My Config
<BeautySharedRuntimeMode>False</BeautySharedRuntimeMode> <!-- beauty into sub-directory, default is libs, quote with "" if contains space --> <BeautyLibsDir Condition="$(BeautySharedRuntimeMode) == 'True'">../libraries</BeautyLibsDir> <BeautyLibsDir Condition="$(BeautySharedRuntimeMode) != 'True'">./libraries</BeautyLibsDir> <!-- dlls that you don't want to be moved or can not be moved --> <BeautyExcludes>System.*.dll;Microsoft.*.dll</BeautyExcludes> <!-- dlls that end users never needed, so hide them --> <!-- <BeautyHiddens>hostfxr;hostpolicy;*.deps.json;*.runtimeconfig*.json</BeautyHiddens> --> <!-- set to True if you want to disable --> <DisableBeauty>False</DisableBeauty> <!-- set to False if you want to beauty on build --> <BeautyOnPublishOnly>False</BeautyOnPublishOnly> <!-- set to True if you want to allow 3rd debuggers(like dnSpy) debugs the app --> <BeautyEnableDebugging>False</BeautyEnableDebugging> <!-- the patch can reduce the file count --> <!-- set to False if you want to disable --> <!-- SCD Mode Feature Only --> <BeautyUsePatch>False</BeautyUsePatch> <!-- <BeautyAfterTasks></BeautyAfterTasks> --> <!-- valid values: Error|Detail|Info --> <BeautyLogLevel>Info</BeautyLogLevel> <!-- set to a repo mirror if you have troble in connecting github --> <!-- <BeautyGitCDN>https://gitee.com/liesauer/HostFXRPatcher</BeautyGitCDN> --> <!-- <BeautyGitTree>master</BeautyGitTree> -->

Thanks.

@liesauer
Copy link
Member

your config is fine, this should be a bug. can you share a testcase?

@mightyPolo108
Copy link
Author

I am building a small project in which I hope will be able to demonstrate the problem.
Apparently its connected with Winforms Settings.Designer files.
I will post more, later.

@liesauer
Copy link
Member

liesauer commented Mar 1, 2023

actually the System.Configuration.ConfigurationManager location is fine no matter excludes or not. it looks like is the dependencies problem. if use AssemblyLoadContext.LoadFromAssemblyPath to load the assembly, it just failed.

still finding out what makes System.Configuration.ConfigurationManager behaves specially.

@liesauer
Copy link
Member

liesauer commented Mar 1, 2023

@liesauer
Copy link
Member

liesauer commented Mar 1, 2023

@mightyPolo108
Copy link
Author

mightyPolo108 commented Mar 1, 2023

Thank you.
I failed to create a simple program that would demonstrate the problem.
You are right, that the problem is with ConfigurationManager and packages, that uses it as dependency.
For now, I was able to circumvent the problem by striping my project of these packages

System.Configuration.ConfigurationManager
System.DirectoryServices.AccountManagement
Microsoft.Extensions.DependencyInjection
Microsoft.Windows.Compatibility

I will test behaviour on another project whitch heavily relies on DI and let you know.
Thanks.

@mightyPolo108
Copy link
Author

I am closing this issue, because I was able to circumvent this issue and I did not came across in another project, which heavily relies on DI.
Thanks for links and support.

@liesauer
Copy link
Member

liesauer commented May 5, 2023

fixed in v2.1.3.0-beta.1

liesauer added a commit that referenced this issue May 26, 2023
liesauer added a commit that referenced this issue May 29, 2023
liesauer added a commit that referenced this issue May 29, 2023
liesauer added a commit that referenced this issue Mar 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants