Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix issue10550 Desktop FSI accessing System.Configuration #10572

Merged
merged 1 commit into from
Dec 1, 2020

Conversation

KevinRansom
Copy link
Member

@KevinRansom KevinRansom commented Nov 30, 2020

Fixes #10550 : Error accessing System.Configuration.ConfigurationManager in F# Script and F# Interactive on Visual Studio 16.8.0

On the desktop FSI did not pre-load : System.Configuration which meant that when using types from that assembly they couldn't be found. On the coreclr build of fsi, all framework assemblies are pre-loaded, which allowed it to work.

This PR adds System.Configuration to the list of identified framework assemblies for pre-load and to identify core framework types.

And it adds a regression test.

@cartermp
Copy link
Contributor

Hmmm. It's not referenced by default in a desktop C# console app. Are there additional .dlls we pull in for desktop FSI by default that aren't the default in a console+desktop setup?

@KevinRansom
Copy link
Member Author

@cartermp yes ... tons.

    yield "mscorlib"
    yield "System"
    yield "System.Xml"
    yield "System.Runtime.Remoting"
    yield "System.Runtime.Serialization.Formatters.Soap"
    yield "System.Data"
    yield "System.Drawing"
    yield "System.Core"
    yield "System.Configuration"

    yield getFSharpCoreLibraryName
    if useFsiAuxLib then yield getFsiLibraryName

    // always include a default reference to System.ValueTuple.dll in scripts and out-of-project sources 
    match getDefaultSystemValueTupleReference () with
    | None -> ()
    | Some v -> yield v

    // These are the Portable-profile and .NET Standard 1.6 dependencies of FSharp.Core.dll.  These are needed
    // when an F# script references an F# profile 7, 78, 259 or .NET Standard 1.6 component which in turn refers 
    // to FSharp.Core for profile 7, 78, 259 or .NET Standard.
    yield "netstandard"
    yield "System.Runtime"          // lots of types
    yield "System.Linq"             // System.Linq.Expressions.Expression<T> 
    yield "System.Reflection"       // System.Reflection.ParameterInfo
    yield "System.Linq.Expressions" // System.Linq.IQueryable<T>
    yield "System.Threading.Tasks"  // valuetype [System.Threading.Tasks]System.Threading.CancellationToken
    yield "System.IO"               //  System.IO.TextWriter
    yield "System.Net.Requests"     //  System.Net.WebResponse etc.
    yield "System.Collections"      // System.Collections.Generic.List<T>
    yield "System.Runtime.Numerics" // BigInteger
    yield "System.Threading"        // OperationCanceledException
    yield "System.Web"
    yield "System.Web.Services"
    yield "System.Windows.Forms"
    yield "System.Numerics"

@KevinRansom
Copy link
Member Author

@cartermp I guess it was a scripting usability thing. To avoid developers having to write:
#r @"C:\Windows\Microsoft.NET\Framework\v4.0.30319\System.Numerics.dll"
in order to use bigint etc ...

Copy link
Contributor

@cartermp cartermp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@KevinRansom KevinRansom merged commit 0edf324 into dotnet:main Dec 1, 2020
laenas pushed a commit to laenas/fsharp that referenced this pull request Dec 1, 2020
laenas pushed a commit to laenas/fsharp that referenced this pull request Dec 1, 2020
nosami pushed a commit to xamarin/visualfsharp that referenced this pull request Feb 23, 2021
@KevinRansom KevinRansom deleted the issue10550 branch January 21, 2022 09:05
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
2 participants