Repository navigation
Closed as not planned
Closed as not planned
Copy link
Labels
Area-SetupAndDeliverySetup, packages, templates, SDK, delivery channelsBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Milestone
Description
Any transitive or direct usage of System.Configuration.ConfigurationManager with a version >=5 results in an error in FSI.
Repro steps
This can be reproduced by evaluating this in FSI:
#r "nuget: System.Configuration.ConfigurationManager, 6.0"
typeof<System.Configuration.ConfigurationManager>Expected behavior
The correct type of ConfigurationManager should be available.
Actual behavior
A Could not load file or assembly 'System.Configuration.ConfigurationManager... error is raised. This is the complete FSI output:
Welcome to F# Interactive for .NET Core in Visual Studio. To execute code, either
1. Use 'Send to Interactive' (Alt-Enter or right-click) from an F# script. The F# Interactive process will
use any global.json settings associated with that script.
2. Press 'Enter' to start. The F# Interactive process will use default settings.
>
Microsoft (R) F# Interactive, Version 12.0.0.0 für F# 6.0
Copyright (C) Microsoft Corporation. Alle Rechte vorbehalten.
Um Hilfe zu erhalten, geben Sie "#help;;" ein.
> [Loading C:\Users\ronal\AppData\Local\Temp\nuget\12404--36dd1648-705f-4ba7-a0e9-5ccf88db4578\Project.fsproj.fsx]
namespace FSI_0002.Project
Binding session to 'C:/Users/xxx/.nuget/packages/system.configuration.configurationmanager/6.0.0/lib/net6.0/System.Configuration.ConfigurationManager.dll'...
>
error FS0193: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51'.
error FS0193: Could not load file or assembly 'System.Configuration.ConfigurationManager, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL'. Das System kann die angegebene Datei nicht finden.
Known workarounds
In this related issue and post, renaming C:\Program Files\dotnet\sdk\6.0.101\FSharp\System.Configuration.ConfigurationManager.dll to System.Configuration.ConfigurationManager.bak.dll solved the issue.
Further technical details
OS: WIndows 11
dotnet: 6.0.101
Microsoft Visual Studio Community 2022 (64-bit), Version 17.0.4
Metadata
Metadata
Assignees
Labels
Area-SetupAndDeliverySetup, packages, templates, SDK, delivery channelsBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.
Type
Projects
- StatusShow more project fieldsDone
Activity
SchlenkR commentedon Feb 6, 2022
Related to: dotnet/SqlClient#1397
moinessim commentedon Feb 24, 2022
Same problem with System.Security.Cryptography.Xml:
Output:
dotnet --info:dsyme commentedon Feb 24, 2022
This needs the update to .NET 6 for
dotnet fsie.g. #12734dsyme commentedon Mar 3, 2022
@KevinRansom This is still a problem
isaacabraham commentedon Apr 26, 2022
Any ideas on this? Just stung me again with MS.Data.SqlClient.
ashenwolf commentedon Jun 14, 2022
Same here. Wanted to play around with
Microsoft.Data.SqlClientin fsi on Linux, but stuck withSystem.Configuration.ConfigurationManagererror.Maybe there is at least a temporary workaround available?
wavewizard commentedon Jun 16, 2022
I hit the same problem while playing with System.Runtime.Caching.MemoryCache.
System.Runtime.Caching uses the ConfigurationManager to get configuration for the system.runtime.caching/memoryCache section. So any library using dotnet`s memory caching will not run in fsi.
temporary work around is adding #r "nuget:System.Configuration.ConfigurationManager, 4.7.0"
What is the reason ConfigurationManager not playing nice with fsi??
vzarytovskii commentedon May 15, 2024
I can load it currently:
It was likely happening because fsi ships with msbuild and transitive dependencies (System.Dom, System.Configuration.ConfigurationManager, etc) and when trying to load some specific version, it was failing due to inability to load it properly alongside existing one.
I will close it for now. If it is happening with any of the other assemblies, please open a new one. In this case we will need to rethink how should we load assemblies, specifically for the dependency manager...probably use separate ALC for it. Or an external process.