未验证 提交 e381e353 编写于 作者: K Kevin Ransom (msft) 提交者: GitHub

Ctrl+Break in VS on coreclr and desktop (#14218)

上级 8af363b4
......@@ -15,7 +15,6 @@ scripts/*.patch
/src/FSharp.Build/*.resx
/src/fsi/*.resx
/src/FSharp.Compiler.Interactive.Settings/*.resx
/src/FSharp.Compiler.Server.Shared/*.resx
/src/fsi/Fsi.sln
/src/FSharp.Build/*.resources
/src/Compiler/*.resx
......
......@@ -3,8 +3,6 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.1.32113.165
MinimumVisualStudioVersion = 10.0.40219.1
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Server.Shared", "src\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj", "{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Core", "src\FSharp.Core\FSharp.Core.fsproj", "{DED3BBD7-53F4-428A-8C9F-27968E768605}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{CFE3259A-2D30-4EB0-80D5-E8B5F3D01449}"
......@@ -98,9 +96,10 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiAnyCpu", "src\fsi\fsiAny
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "fsiArm64", "src\fsi\fsiArm64Project\fsiArm64.fsproj", "{209C7D37-8C01-413C-8698-EC25F4C86976}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{BEC6E796-7E53-4888-AAFC-B8FD55C425DF}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "HistoricalBenchmark", "tests\benchmarks\FCSBenchmarks\BenchmarkComparison\HistoricalBenchmark.fsproj", "{BEC6E796-7E53-4888-AAFC-B8FD55C425DF}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Benchmarks", "tests\benchmarks\FCSBenchmarks\CompilerServiceBenchmarks\FSharp.Compiler.Benchmarks.fsproj", "{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}"
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "FSharp.Compiler.Benchmarks", "tests\benchmarks\FCSBenchmarks\CompilerServiceBenchmarks\FSharp.Compiler.Benchmarks.fsproj", "{9C7523BA-7AB2-4604-A5FD-653E82C2BAD1}"
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{D58BFE8B-7C85-4D3B-B5F3-9A7BB90FF1EE}"
ProjectSection(SolutionItems) = preProject
src\Compiler\FSComp.txt = src\Compiler\FSComp.txt
......@@ -116,18 +115,6 @@ Global
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.ActiveCfg = Debug|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.Build.0 = Debug|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.ActiveCfg = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.Build.0 = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.ActiveCfg = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.Build.0 = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.Build.0 = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.ActiveCfg = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.Build.0 = Release|Any CPU
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|x86.ActiveCfg = Debug|Any CPU
......@@ -433,7 +420,6 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{DED3BBD7-53F4-428A-8C9F-27968E768605} = {3058BC79-8E79-4645-B05D-48CC182FA8A6}
{702A7979-BCF9-4C41-853E-3ADFC9897890} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{649FA588-F02E-457C-9FCF-87E46407481E} = {B8DDA694-7939-42E3-95E5-265C2217C142}
......
......@@ -33,8 +33,6 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.VS.FSI", "vsintegrat
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VisualFSharpFull", "vsintegration\Vsix\VisualFSharpFull\VisualFSharpFull.csproj", "{59ADCE46-9740-4079-834D-9A03A3494EBC}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Compiler.Server.Shared", "src\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj", "{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.Core", "src\FSharp.Core\FSharp.Core.fsproj", "{DED3BBD7-53F4-428A-8C9F-27968E768605}"
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "FSharp.LanguageService", "vsintegration\src\FSharp.LanguageService\FSharp.LanguageService.fsproj", "{EE85AAB7-CDA0-4C4E-BDA0-A64CCC413E3F}"
......@@ -193,7 +191,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FCSBenchmarks", "FCSBenchma
tests\benchmarks\FCSBenchmarks\SmokeTestAllBenchmarks.ps1 = tests\benchmarks\FCSBenchmarks\SmokeTestAllBenchmarks.ps1
EndProjectSection
EndProject
Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Fsharp.ProfilingStartpointProject", "tests\benchmarks\Fsharp.ProfilingStartpointProject\Fsharp.ProfilingStartpointProject.fsproj", "{FE23BB65-276A-4E41-8CC7-F7752241DEBA}"
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "Fsharp.ProfilingStartpointProject", "tests\benchmarks\Fsharp.ProfilingStartpointProject\Fsharp.ProfilingStartpointProject.fsproj", "{FE23BB65-276A-4E41-8CC7-F7752241DEBA}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
......@@ -229,18 +227,6 @@ Global
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|Any CPU.Build.0 = Release|Any CPU
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.ActiveCfg = Release|Any CPU
{59ADCE46-9740-4079-834D-9A03A3494EBC}.Release|x86.Build.0 = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.ActiveCfg = Debug|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Debug|x86.Build.0 = Debug|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.ActiveCfg = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|Any CPU.Build.0 = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.ActiveCfg = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Proto|x86.Build.0 = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|Any CPU.Build.0 = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.ActiveCfg = Release|Any CPU
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}.Release|x86.Build.0 = Release|Any CPU
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DED3BBD7-53F4-428A-8C9F-27968E768605}.Debug|x86.ActiveCfg = Debug|Any CPU
......@@ -1045,7 +1031,6 @@ Global
{CCAB6E50-34C6-42AF-A6B0-567C29FCD91B} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
{991DCF75-C2EB-42B6-9A0D-AA1D2409D519} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
{59ADCE46-9740-4079-834D-9A03A3494EBC} = {4C7B48D7-19AF-4AE7-9D1D-3BB289D5480D}
{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06} = {B8DDA694-7939-42E3-95E5-265C2217C142}
{DED3BBD7-53F4-428A-8C9F-27968E768605} = {3058BC79-8E79-4645-B05D-48CC182FA8A6}
{EE85AAB7-CDA0-4C4E-BDA0-A64CCC413E3F} = {CCAB6E50-34C6-42AF-A6B0-567C29FCD91B}
{1C5C163C-37EA-4A3C-8CCC-0D34B74BF8EF} = {CCAB6E50-34C6-42AF-A6B0-567C29FCD91B}
......
......@@ -13,7 +13,6 @@
<ProjectReference Include="$(FSharpSourcesRoot)\fsi\fsiArm64Project\fsiArm64.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Build\FSharp.Build.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\Compiler\FSharp.Compiler.Service.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Core\FSharp.Core.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.DependencyManager.Nuget\FSharp.DependencyManager.Nuget.fsproj" />
......@@ -108,7 +107,6 @@ folder "InstallDir:Common7\IDE\CommonExtensions\Microsoft\FSharp\Tools"
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Framework.dll"
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Tasks.Core.dll"
file source="$(BinariesFolder)fsc\$(Configuration)\$(TargetFramework)\Microsoft.Build.Utilities.Core.dll"
file source="$(BinariesFolder)FSharp.Compiler.Server.Shared\$(Configuration)\$(TargetFramework)\FSharp.Compiler.Server.Shared.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.dll" vs.file.ngen=yes vs.file.ngenArchitecture=All vs.file.ngenPriority=2
file source="$(BinariesFolder)FSharp.Core\$(Configuration)\netstandard2.0\FSharp.Core.xml"
file source="$(BinariesFolder)FSharp.Build\$(Configuration)\netstandard2.0\FSharp.Build.dll" vs.file.ngen=no vs.file.ngenArchitecture=All vs.file.ngenPriority=2
......
......@@ -18,7 +18,6 @@
<_Dependency Include="FSharp.Compiler.Interactive.Settings" Version="$(FSProductVersion)" />
<_Dependency Include="FSharp.Compiler.Service" Version="$(FSharpCompilerServiceVersion)" />
<_Dependency Include="FSharp.DependencyManager.Nuget" Version="$(FSProductVersion)" />
<_Dependency Include="FSharp.Compiler.Server.Shared" Version="$(FSProductVersion)" />
<_Dependency Include="FSharp.Core" Version="$(FSCoreVersion)" />
<_Dependency Include="FSharp.Editor" Version="$(VSAssemblyVersion)" />
<_Dependency Include="FSharp.LanguageService.Base" Version="$(VSAssemblyVersion)" />
......
......@@ -69,7 +69,6 @@
<InternalsVisibleTo Include="fsi" />
<InternalsVisibleTo Include="fsiAnyCpu" />
<InternalsVisibleTo Include="fsiArm64" />
<InternalsVisibleTo Include="FSharp.Compiler.Server.Shared" />
<InternalsVisibleTo Include="VisualFSharp.Salsa" />
<InternalsVisibleTo Include="VisualFSharp.UnitTests" />
<InternalsVisibleTo Include="FSharp.Compiler.UnitTests" />
......@@ -456,6 +455,8 @@
<Compile Include="Service\ServiceStructure.fs" />
<Compile Include="Service\ServiceAnalysis.fsi" />
<Compile Include="Service\ServiceAnalysis.fs" />
<Compile Include="Interactive\FSharpInteractiveServer.fsi" />
<Compile Include="Interactive\FSharpInteractiveServer.fs" />
<Compile Include="Interactive\ControlledExecution.fs" />
<Compile Include="Interactive\fsi.fsi" />
<Compile Include="Interactive\fsi.fs" />
......
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.Interactive
open System
open System.Text
open System.Diagnostics
open System.IO
open System.IO.Pipes
open System.Threading
module CtrlBreakHandlers =
let interuptCommand = "Interactive-CtrlCNotificationCommand-Interupt"
let lineInteruptCommand =
Encoding.UTF8.GetBytes(interuptCommand + Environment.NewLine)
let connectionTimeout = 1000
[<AbstractClass>]
type public CtrlBreakService(channelName: string) =
abstract Interrupt: unit -> unit
// Exceptions percolate to callsite, IO exceptions must be handled by caller
// Should be run on a new thread
member this.Run() : unit =
let service = new NamedPipeServerStream(channelName, PipeDirection.In)
// Wait for a client to connect
service.WaitForConnection()
use stream = new StreamReader(service)
try
while not (stream.EndOfStream) do
let line = stream.ReadLine()
if line = interuptCommand then
this.Interrupt()
finally
stream.Close()
service.Close()
type public CtrlBreakClient(channelName: string) =
let mutable service: NamedPipeClientStream option =
Some(new NamedPipeClientStream(".", channelName, PipeDirection.Out))
member this.Interrupt() =
match service with
| None -> ()
| Some client ->
try
if not (client.IsConnected) then
client.Connect(connectionTimeout)
with _ ->
()
client.Write(lineInteruptCommand, 0, lineInteruptCommand.Length)
client.Flush()
interface IDisposable with
member _.Dispose() =
match service with
| None -> ()
| Some client ->
client.Dispose()
service <- None
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace FSharp.Compiler.Interactive
open System
module CtrlBreakHandlers =
[<AbstractClass>]
type public CtrlBreakService =
new: channelName: string -> CtrlBreakService
abstract Interrupt: unit -> unit
member Run: unit -> unit
type public CtrlBreakClient =
new: channelName: string -> CtrlBreakClient
member Interrupt: unit -> unit
interface IDisposable
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
namespace Microsoft.FSharp
open System.Reflection
open System.Runtime.InteropServices
[<assembly: ComVisible(false)>]
do ()
<Project>
<PropertyGroup>
<UseFSharpProductVersion>true</UseFSharpProductVersion>
</PropertyGroup>
<Import Project="$([MSBuild]::GetPathOfFileAbove('Directory.Build.props', '$(MSBuildThisFileDirectory)../'))" />
</Project>
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information. -->
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<AssemblyName>FSharp.Compiler.Server.Shared</AssemblyName>
<UseFSharpProductVersion>true</UseFSharpProductVersion>
</PropertyGroup>
<!-- The FSharp.Core dll provides a referencable public interface -->
<PropertyGroup Condition="'$(Configuration)' != 'Proto'">
<CompressMetadata Condition="'$(CompressAllMetadata)' != 'true'">false</CompressMetadata>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="fsi" />
<InternalsVisibleTo Include="fsiAnyCpu" />
<InternalsVisibleTo Include="fsiArm64" />
<InternalsVisibleTo Include="FSharp.VS.FSI" />
</ItemGroup>
<ItemGroup>
<Compile Include="AssemblyInfo.fs" />
<Compile Include="FSharpInteractiveServer.fs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\FSharp.Core\FSharp.Core.fsproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System.Runtime.Remoting" />
</ItemGroup>
</Project>
// Copyright (c) Microsoft Corporation. All Rights Reserved. See License.txt in the project root for license information.
//[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>] // avoid calling the type "Shared" which is keyword in some languages
namespace FSharp.Compiler.Server.Shared
// For FSI VS plugin, require FSI to provide services:
// e.g.
// - interrupt
// - intellisense completion
//
// This is done via remoting.
// Here we define the service class.
// This dll is required for both client (fsi-vs plugin) and server (spawned fsi).
//[<assembly: System.Security.SecurityTransparent>]
[<assembly: System.Runtime.InteropServices.ComVisible(false)>]
[<assembly: System.CLSCompliant(true)>]
do ()
open System
open System.Diagnostics
open System.Runtime.Remoting.Channels
open System.Runtime.Remoting
open System.Runtime.Remoting.Lifetime
[<AbstractClass>]
type internal FSharpInteractiveServer() =
inherit System.MarshalByRefObject()
abstract Interrupt: unit -> unit
default x.Interrupt() = ()
static member StartServer(channelName: string, server: FSharpInteractiveServer) =
let chan = new Ipc.IpcChannel(channelName)
LifetimeServices.LeaseTime <- TimeSpan(7, 0, 0, 0) // days,hours,mins,secs
LifetimeServices.LeaseManagerPollTime <- TimeSpan(7, 0, 0, 0)
LifetimeServices.RenewOnCallTime <- TimeSpan(7, 0, 0, 0)
LifetimeServices.SponsorshipTimeout <- TimeSpan(7, 0, 0, 0)
ChannelServices.RegisterChannel(chan, false)
let objRef = RemotingServices.Marshal(server, "FSIServer")
()
static member StartClient(channelName) =
let T =
Activator.GetObject(typeof<FSharpInteractiveServer>, "ipc://" + channelName + "/FSIServer")
let x = T :?> FSharpInteractiveServer
x
......@@ -44,9 +44,6 @@
<ProjectReference Include="$(MSBuildThisFileDirectory)..\FSharp.Core\FSharp.Core.fsproj" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\Compiler\FSharp.Compiler.Service.fsproj" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\FSharp.Compiler.Interactive.Settings\FSharp.Compiler.Interactive.Settings.fsproj" />
<!-- only used when '$(TargetFramework)' == 'net472' -->
<ProjectReference Include="$(MSBuildThisFileDirectory)..\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj" Condition="'$(TargetFramework)' == 'net472'" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
......
......@@ -11,6 +11,7 @@
module internal Sample.FSharp.Compiler.Interactive.Main
open System
open System.Diagnostics
open System.Globalization
open System.IO
open System.Reflection
......@@ -22,6 +23,8 @@ open System.Windows.Forms
open FSharp.Compiler
open FSharp.Compiler.AbstractIL
open FSharp.Compiler.Interactive
open FSharp.Compiler.Interactive.CtrlBreakHandlers
open FSharp.Compiler.Interactive.Shell
open FSharp.Compiler.Interactive.Shell.Settings
open FSharp.Compiler.CodeAnalysis
......@@ -147,9 +150,9 @@ let internal TrySetUnhandledExceptionMode () =
/// Starts the remoting server to handle interrupt reuests from a host tool.
let StartServer (fsiSession: FsiEvaluationSession) (fsiServerName) =
#if FSI_SERVER
let server =
{ new Server.Shared.FSharpInteractiveServer() with
{ new CtrlBreakService(fsiServerName) with
member _.Interrupt() =
//printf "FSI-SERVER: received CTRL-C request...\n"
try
......@@ -160,10 +163,7 @@ let StartServer (fsiSession: FsiEvaluationSession) (fsiServerName) =
()
}
Server.Shared.FSharpInteractiveServer.StartServer(fsiServerName, server)
#else
ignore (fsiSession, fsiServerName)
#endif
server.Run()
//----------------------------------------------------------------------------
// GUI runCodeOnMainThread
......
......@@ -4151,6 +4151,14 @@ FSharp.Compiler.IO.StreamExtensions: System.String[] Stream.ReadAllLines(System.
FSharp.Compiler.IO.StreamExtensions: Void Stream.WriteAllLines(System.IO.Stream, System.Collections.Generic.IEnumerable`1[System.String], Microsoft.FSharp.Core.FSharpOption`1[System.Text.Encoding])
FSharp.Compiler.IO.StreamExtensions: Void Stream.WriteAllText(System.IO.Stream, System.String)
FSharp.Compiler.IO.StreamExtensions: Void Stream.Write[a](System.IO.Stream, a)
FSharp.Compiler.Interactive.CtrlBreakHandlers
FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient: Void .ctor(System.String)
FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient: Void Interrupt()
FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void .ctor(System.String)
FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void Interrupt()
FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService: Void Run()
FSharp.Compiler.Interactive.CtrlBreakHandlers: FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakClient
FSharp.Compiler.Interactive.CtrlBreakHandlers: FSharp.Compiler.Interactive.CtrlBreakHandlers+CtrlBreakService
FSharp.Compiler.Interactive.Shell
FSharp.Compiler.Interactive.Shell+CompilerInputStream: Boolean CanRead
FSharp.Compiler.Interactive.Shell+CompilerInputStream: Boolean CanSeek
......@@ -23,7 +23,6 @@
<Action Type="Ngen" Path="fsc.exe" />
<Action Type="Ngen" Path="FSharp.Compiler.Service.dll" />
<Action Type="Ngen" Path="FSharp.Compiler.Interactive.Settings.dll" />
<Action Type="Ngen" Path="FSharp.Compiler.Server.Shared.dll" />
<Action Type="Ngen" Path="FSharp.Core.dll" />
<Action Type="Ngen" Path="FSharp.DependencyManager.Nuget.dll" />
<Action Type="Ngen" Path="FSharp.Editor.dll" />
......@@ -49,7 +48,6 @@
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="FSharp.LanguageService.Base.pkgdef" />
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="FSharp.LanguageService.pkgdef" />
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="FSharp.Editor.pkgdef" />
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="File" Path="FSharp.Compiler.Server.Shared.pkgdef" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="FSharp.Editor" Path="|FSharp.Editor|" />
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="FSharp.Editor" Path="|FSharp.Editor|" />
......
......@@ -48,18 +48,6 @@
<AdditionalProperties>TargetFramework=netstandard2.0</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj">
<Project>{D5870CF0-ED51-4CBC-B3D7-6F56DA84AC06}</Project>
<Name>FSharp.Compiler.Server.Shared</Name>
<IncludeOutputGroupsInVSIX>BuiltProjectOutputGroup%3bGetCopyToOutputDirectoryItems%3b</IncludeOutputGroupsInVSIX>
<IncludeOutputGroupsInVSIXLocalOnly>DebugSymbolsProjectOutputGroup%3b</IncludeOutputGroupsInVSIXLocalOnly>
<Ngen>true</Ngen>
<NgenArchitecture>All</NgenArchitecture>
<NgenPriority>2</NgenPriority>
<Private>True</Private>
<AdditionalProperties>TargetFramework=$(DependencyTargetFramework)</AdditionalProperties>
</ProjectReference>
<ProjectReference Include="$(FSharpSourcesRoot)\Compiler\FSharp.Compiler.Service.fsproj">
<Project>{A59DB8AE-8044-41A5-848A-800A7FF31C93}</Project>
<Name>FSharp.Compiler.Service</Name>
......
......@@ -18,7 +18,6 @@
<InternalsVisibleTo Include="FSharp.ProjectSystem.FSharp" />
<InternalsVisibleTo Include="FSharp.ProjectSystem.PropertyPages" />
<InternalsVisibleTo Include="FSharp.Compiler.Interactive.Settings" />
<InternalsVisibleTo Include="FSharp.Compiler.Server.Shared" />
<InternalsVisibleTo Include="VisualFSharp.Salsa" />
<InternalsVisibleTo Include="VisualFSharp.UnitTests" />
<InternalsVisibleTo Include="FSharp.Editor" />
......
......@@ -71,11 +71,6 @@
<Version>$(FSharpCompilerServiceVersion)</Version>
<CodeBase>$PackageFolder$\FSharp.Compiler.Service.dll</CodeBase>
</AssemblyAttribute>
<AssemblyAttribute Include="Microsoft.VisualStudio.Shell.ProvideCodeBaseAttribute">
<AssemblyName>FSharp.Compiler.Server.Shared</AssemblyName>
<Version>$(FSProductVersion)</Version>
<CodeBase>$PackageFolder$\FSharp.Compiler.Server.Shared.dll</CodeBase>
</AssemblyAttribute>
<AssemblyAttribute Include="Microsoft.VisualStudio.Shell.ProvideCodeBaseAttribute">
<AssemblyName>FSharp.UIResources</AssemblyName>
<Version>$(VSAssemblyVersion)</Version>
......
......@@ -43,8 +43,7 @@
<ItemGroup>
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Core\FSharp.Core.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\Compiler\FSharp.Compiler.Service.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\FSharp.Compiler.Server.Shared\FSharp.Compiler.Server.Shared.fsproj" />
<ProjectReference Include="$(FSharpSourcesRoot)\Compiler\FSharp.Compiler.Service.fsproj" />
</ItemGroup>
<ItemGroup>
......
......@@ -15,6 +15,9 @@ open System.Threading
let mutable timeoutAppShowMessageOnTimeOut = true
open Microsoft.FSharp.Control
open FSharp.Compiler.Interactive
open FSharp.Compiler.Interactive.CtrlBreakHandlers
// Wrapper around ManualResetEvent which will ignore Sets on disposed object
type internal EventWrapper() =
let waitHandle = new ManualResetEvent(false)
......@@ -129,7 +132,7 @@ let catchAll trigger x =
try trigger x
with err -> System.Windows.Forms.MessageBox.Show(err.ToString()) |> ignore
let determineFsiPath () =
let determineFsiPath () =
if SessionsProperties.fsiUseNetCore then
let pf = Environment.GetEnvironmentVariable("ProgramW6432")
let pf = if String.IsNullOrEmpty(pf) then Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) else pf
......@@ -137,7 +140,7 @@ let determineFsiPath () =
let arg = "fsi"
if not (File.Exists exe) then
raise (SessionError (VFSIstrings.SR.couldNotFindFsiExe exe))
exe, arg, false, false
exe, arg, false
else
let fsiExeName () =
if SessionsProperties.useAnyCpuVersion then
......@@ -152,9 +155,9 @@ let determineFsiPath () =
let thisAssemblyDirectory = typeof<EventWrapper>.Assembly.Location |> Path.GetDirectoryName
Path.Combine(thisAssemblyDirectory,fsiExeName() )
// This path is relative to the location of "FSharp.Compiler.Interactive.Settings.dll"
// This path is relative to the location of "FSharp.Compiler.Service.dll"
let determineFsiRelativePath2 () =
let thisAssembly : System.Reflection.Assembly = typeof<FSharp.Compiler.Server.Shared.FSharpInteractiveServer>.Assembly
let thisAssembly : System.Reflection.Assembly = typeof<CtrlBreakClient>.Assembly
let thisAssemblyDirectory = thisAssembly.Location |> Path.GetDirectoryName
// Use the quick-development path if available
Path.Combine(thisAssemblyDirectory, "Tools", fsiExeName() )
......@@ -175,7 +178,7 @@ let determineFsiPath () =
// Otherwise give up
raise (SessionError (VFSIstrings.SR.couldNotFindFsiExe fsiRegistryPath))
fsiExe, "", true, true
fsiExe, "", true
let readOutputAsync (reader: StreamReader) trigger =
let buffer = StringBuilder(1024)
......@@ -234,7 +237,7 @@ let readOutputAsync (reader: StreamReader) trigger =
let fsiStartInfo channelName sourceFile =
let procInfo = new ProcessStartInfo()
let fsiPath, fsiFirstArgs, fsiSupportsServer, fsiSupportsShadowcopy = determineFsiPath ()
let fsiPath, fsiFirstArgs, fsiSupportsShadowcopy = determineFsiPath ()
procInfo.FileName <- fsiPath
......@@ -278,7 +281,7 @@ let fsiStartInfo channelName sourceFile =
if Directory.Exists(initialPath) then
procInfo.WorkingDirectory <- initialPath
procInfo, fsiSupportsServer
procInfo
let nonNull = function null -> false | (s:string) -> true
......@@ -286,13 +289,13 @@ let nonNull = function null -> false | (s:string) -> true
/// Represents an active F# Interactive process to which Visual Studio is connected via stdin/stdout/stderr and a remoting channel
type FsiSession(sourceFile: string) =
let randomSalt = System.Random()
let channelName =
let pid = System.Diagnostics.Process.GetCurrentProcess().Id
let tick = System.Environment.TickCount
let channelName =
let pid = Process.GetCurrentProcess().Id
let tick = Environment.TickCount
let salt = randomSalt.Next()
sprintf "FSIChannel_%d_%d_%d" pid tick salt
let procInfo, fsiSupportsServer = fsiStartInfo channelName sourceFile
let procInfo = fsiStartInfo channelName sourceFile
let usingNetCore = SessionsProperties.fsiUseNetCore
......@@ -349,24 +352,19 @@ type FsiSession(sourceFile: string) =
do cmdProcess.EnableRaisingEvents <- true
let clientConnection =
if fsiSupportsServer then
try Some (FSharp.Compiler.Server.Shared.FSharpInteractiveServer.StartClient(channelName))
with e -> raise (SessionError (VFSIstrings.SR.exceptionRaisedWhenCreatingRemotingClient(e.ToString())))
else
None
let client =
try
new CtrlBreakClient(channelName)
with e -> raise (SessionError (VFSIstrings.SR.exceptionRaisedWhenCreatingRemotingClient(e.ToString())))
/// interrupt timeout in miliseconds
let interruptTimeoutMS = 1000
/// interrupt timeout in miliseconds
let interruptTimeoutMS = 1000
// Create session object
member _.Interrupt() =
match clientConnection with
| None -> false
| Some client ->
match timeoutApp "VFSI interrupt" interruptTimeoutMS (fun () -> client.Interrupt()) () with
| Some () -> true
| None -> false
match timeoutApp "VFSI interrupt" interruptTimeoutMS (fun () -> client.Interrupt()) () with
| Some () -> true
| None -> false
member _.SendInput (str: string) = inputQueue.Post(str)
......@@ -378,7 +376,7 @@ type FsiSession(sourceFile: string) =
member _.Alive = not cmdProcess.HasExited
member _.SupportsInterrupt = not cmdProcess.HasExited && clientConnection.IsSome // clientConnection not on .NET Core
member _.SupportsInterrupt = not cmdProcess.HasExited
member _.ProcessID =
// When using .NET Core, allow up to 2 seconds to allow detection of process ID
......
......@@ -274,7 +274,6 @@ if "%DEPLOY%" == "yes" if "!ISADMIN!" == "yes" (
!SN32! -Vr HostedCompilerServer,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN32! -Vr FSharp.Compiler,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN32! -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN32! -Vr FSharp.Editor,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN32! -Vr FSharp.LanguageService,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN32! -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a 1>NUL 2>NUL
......@@ -293,7 +292,6 @@ if "%DEPLOY%" == "yes" if "!ISADMIN!" == "yes" (
!SN64! -Vr HostedCompilerServer,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN64! -Vr FSharp.Compiler,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN64! -Vr FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN64! -Vr FSharp.Editor,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN64! -Vr FSharp.LanguageService,b03f5f7f11d50a3a 1>NUL 2>NUL
!SN64! -Vr FSharp.LanguageService.Base,b03f5f7f11d50a3a 1>NUL 2>NUL
......@@ -346,7 +344,6 @@ if "%ACTION%" == "restore" if "!ISADMIN!" == "yes" (
!SN32! -Vu HostedCompilerServer,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN32! -Vu FSharp.Compiler,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN32! -Vu FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN32! -Vu FSharp.Editor,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN32! -Vu FSharp.LanguageService,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN32! -Vu FSharp.LanguageService.Base,b03f5f7f11d50a3a 2>NUL 1>NUL
......@@ -365,7 +362,6 @@ if "%ACTION%" == "restore" if "!ISADMIN!" == "yes" (
!SN64! -Vu HostedCompilerServer,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN64! -Vu FSharp.Compiler,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN64! -Vu FSharp.Compiler.Server.Shared,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN64! -Vu FSharp.Editor,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN64! -Vu FSharp.LanguageService,b03f5f7f11d50a3a 2>NUL 1>NUL
!SN64! -Vu FSharp.LanguageService.Base,b03f5f7f11d50a3a 2>NUL 1>NUL
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册