Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
<ProductDependencies>
</ProductDependencies>
<ToolsetDependencies>
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19351.4">
<Dependency Name="Microsoft.DotNet.Arcade.Sdk" Version="1.0.0-beta.19352.7">
<Uri>https://github.com/dotnet/arcade</Uri>
<Sha>1fb1e240c889cd7f6e10cb1eacd129efa3ddb4b4</Sha>
<Sha>b8c190d95371e658d95a5731f4778bd3da2fa42d</Sha>
</Dependency>
</ToolsetDependencies>
</Dependencies>
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19351.4",
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19352.7",
"Microsoft.DotNet.Helix.Sdk": "2.0.0-beta.19069.2"
}
}
13 changes: 12 additions & 1 deletion src/fsharp/service/Reactor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type Reactor() =

// We need to store the culture for the VS thread that is executing now,
// so that when the reactor picks up a thread from the threadpool we can set the culture
let culture = new CultureInfo(CultureInfo.CurrentUICulture.Name)
let mutable culture = CultureInfo(CultureInfo.CurrentUICulture.Name)

let mutable bgOpCts = new CancellationTokenSource()
/// Mailbox dispatch function.
Expand Down Expand Up @@ -131,6 +131,17 @@ type Reactor() =
Debug.Assert(false, String.Format("unexpected failure in reactor loop {0}, restarting", e))
}

member __.SetPreferredUILang(preferredUiLang: string option) =
match preferredUiLang with
| Some s ->
culture <- CultureInfo s
#if FX_RESHAPED_GLOBALIZATION
CultureInfo.CurrentUICulture <- culture
#else
Thread.CurrentThread.CurrentUICulture <- culture
#endif
| None -> ()

// [Foreground Mailbox Accessors] -----------------------------------------------------------
member r.SetBackgroundOp(bgOpOpt) =
Trace.TraceInformation("Reactor: {0:n3} enqueue start background, length {1}", DateTime.Now.TimeOfDay.TotalSeconds, builder.CurrentQueueLength)
Expand Down
3 changes: 3 additions & 0 deletions src/fsharp/service/Reactor.fsi
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ type internal IReactorOperations =
[<Sealed>]
type internal Reactor =

/// Allows to specify the language for error messages
member SetPreferredUILang : string option -> unit

/// Set the background building function, which is called repeatedly
/// until it returns 'false'. If None then no background operation is used.
member SetBackgroundOp : ( (* userOpName:*) string * (* opName: *) string * (* opArg: *) string * (CompilationThreadToken -> CancellationToken -> bool)) option -> unit
Expand Down
2 changes: 2 additions & 0 deletions src/fsharp/service/service.fs
Original file line number Diff line number Diff line change
Expand Up @@ -519,6 +519,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC
keepAssemblyContents,
suggestNamesForErrors)
let parsingOptions = FSharpParsingOptions.FromTcConfig(tcPrior.TcConfig, Array.ofList builder.SourceFiles, options.UseScriptResolutionRules)
reactor.SetPreferredUILang tcPrior.TcConfig.preferredUiLang
bc.RecordTypeCheckFileInProjectResults(fileName, options, parsingOptions, parseResults, fileVersion, tcPrior.TimeStamp, Some checkAnswer, sourceText.GetHashCode())
return checkAnswer
finally
Expand Down Expand Up @@ -636,6 +637,7 @@ type BackgroundCompiler(legacyReferenceResolver, projectCacheSize, keepAssemblyC

// Do the parsing.
let parsingOptions = FSharpParsingOptions.FromTcConfig(builder.TcConfig, Array.ofList (builder.SourceFiles), options.UseScriptResolutionRules)
reactor.SetPreferredUILang tcPrior.TcConfig.preferredUiLang
let parseErrors, parseTreeOpt, anyErrors = ParseAndCheckFile.parseFile (sourceText, filename, parsingOptions, userOpName, suggestNamesForErrors)
let parseResults = FSharpParseFileResults(parseErrors, parseTreeOpt, anyErrors, builder.AllDependenciesDeprecated)
let! checkResults = bc.CheckOneFileImpl(parseResults, sourceText, filename, options, textSnapshotInfo, fileVersion, builder, tcPrior, creationErrors, userOpName)
Expand Down
5 changes: 2 additions & 3 deletions tests/fsharp/Compiler/CompilerAssert.fs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module CompilerAssert =
ProjectId = None
SourceFiles = [|"test.fs"|]
#if !NETCOREAPP
OtherOptions = [||]
OtherOptions = [|"--preferreduilang:en-US";|]
#else
OtherOptions =
// Hack: Currently a hack to get the runtime assemblies for netcore in order to compile.
Expand All @@ -36,8 +36,7 @@ module CompilerAssert =
|> Seq.toArray
|> Array.filter (fun x -> x.ToLowerInvariant().Contains("system.") || x.ToLowerInvariant().EndsWith("netstandard.dll"))
|> Array.map (fun x -> sprintf "-r:%s" x)
Array.append [|"--targetprofile:netcore"; "--noframework"|] assemblies

Array.append [|"--preferreduilang:en-US"; "--targetprofile:netcore"; "--noframework"|] assemblies
#endif
ReferencedProjects = [||]
IsIncompleteTypeCheckEnvironment = false
Expand Down