Skip to content

Commit

Permalink
Fix issue10550 Gesktop FSI accessing System.Configuration (dotnet#10572)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRansom authored and laenas committed Dec 1, 2020
1 parent 8ed3886 commit 023c7af
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/fsharp/DotNetFrameworkDependencies.fs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies
yield "System.Data"
yield "System.Drawing"
yield "System.Core"
yield "System.Configuration"

yield getFSharpCoreLibraryName
if useFsiAuxLib then yield getFsiLibraryName
Expand Down Expand Up @@ -378,6 +379,7 @@ module internal FSharp.Compiler.DotNetFrameworkDependencies
yield "System.Xml"
yield "System.Runtime.Remoting"
yield "System.Runtime.Serialization.Formatters.Soap"
yield "System.Configuration"
yield "System.Data"
yield "System.Deployment"
yield "System.Design"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ stacktype.Name = "Stack"
| Ok(_) -> Assert.False(true, "expected a failure")
| Error(ex) -> Assert.IsAssignableFrom(typeof<FsiCompilationException>, ex)


[<Fact>]
member _.``Script using System.Configuration succeeds``() =
use script = new FSharpScript()
let result, errors = script.Eval("""
#r "nuget:System.Configuration.ConfigurationManager,5.0.0"
open System.Configuration
System.Configuration.ConfigurationManager.AppSettings.Item "Environment" <- "LOCAL" """)
Assert.Empty(errors)
match result with
| Ok(_) -> ()
| Error(ex) -> Assert.True(true, "expected no failures")

[<Theory>]
[<InlineData("""#i""", "input.fsx (1,1)-(1,3) interactive warning Invalid directive '#i '")>] // No argument
[<InlineData("""#i "" """, "input.fsx (1,1)-(1,6) interactive error #i is not supported by the registered PackageManagers")>] // empty argument
Expand Down

0 comments on commit 023c7af

Please sign in to comment.