提交 bc517499 编写于 作者: G Gen Lu

Targeting Remote.ServiceHub project to .Net Core

上级 232d7eab
......@@ -4,7 +4,11 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.LanguageServer</RootNamespace>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<!-- Workaround dependencies that do not yet support netcoreapp3.1 https://github.com/dotnet/roslyn/issues/45114 -->
<NoWarn>NU1701;$(NoWarn)</NoWarn>
<AssetTargetFallback Condition="'$(TargetFramework)' == 'netcoreapp3.1'">net472;$(AssetTargetFallback)</AssetTargetFallback>
<IsPackable>true</IsPackable>
<PackageDescription>
......@@ -18,7 +22,7 @@
</ItemGroup>
<ItemGroup>
<Reference Include="System.ComponentModel.Composition" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol" Version="$(MicrosoftVisualStudioLanguageServerProtocolVersion)" />
<PackageReference Include="Microsoft.VisualStudio.LanguageServer.Protocol.Extensions" Version="$(MicrosoftVisualStudioLanguageServerProtocolExtensionsVersion)" />
<PackageReference Include="StreamJsonRpc" Version="$(StreamJsonRpcVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
......@@ -26,6 +30,9 @@
<PackageReference Include="Microsoft.VisualStudio.Text.UI" Version="$(MicrosoftVisualStudioTextUIVersion)" />
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="$(MicrosoftVisualStudioThreadingVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<Reference Include="System.ComponentModel.Composition" />
</ItemGroup>
<ItemGroup>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.LanguageServer.Protocol.UnitTests" />
......
......@@ -36,9 +36,9 @@ public static void InitializeFatalErrorHandlers(TelemetrySession session)
// We also must set the FailFast handler for the compiler layer as well
var compilerAssembly = typeof(Compilation).Assembly;
var compilerFatalErrorType = compilerAssembly.GetType("Microsoft.CodeAnalysis.FatalError", throwOnError: true);
var compilerFatalErrorHandlerProperty = compilerFatalErrorType.GetProperty(nameof(FatalError.Handler), BindingFlags.Static | BindingFlags.Public);
var compilerNonFatalErrorHandlerProperty = compilerFatalErrorType.GetProperty(nameof(FatalError.NonFatalHandler), BindingFlags.Static | BindingFlags.Public);
var compilerFatalErrorType = compilerAssembly.GetType("Microsoft.CodeAnalysis.FatalError", throwOnError: true)!;
var compilerFatalErrorHandlerProperty = compilerFatalErrorType.GetProperty(nameof(FatalError.Handler), BindingFlags.Static | BindingFlags.Public)!;
var compilerNonFatalErrorHandlerProperty = compilerFatalErrorType.GetProperty(nameof(FatalError.NonFatalHandler), BindingFlags.Static | BindingFlags.Public)!;
compilerFatalErrorHandlerProperty.SetValue(null, fatalReporter);
compilerNonFatalErrorHandlerProperty.SetValue(null, nonFatalReporter);
}
......@@ -128,7 +128,7 @@ private static string GetDescription(Exception exception)
// walk up the stack looking for the first call from a type that isn't in the ErrorReporting namespace.
foreach (var frame in new StackTrace(exception).GetFrames())
{
var method = frame.GetMethod();
var method = frame?.GetMethod();
var methodName = method?.Name;
if (methodName == null)
continue;
......
......@@ -4,9 +4,13 @@
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>Microsoft.CodeAnalysis.Remote</RootNamespace>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>netcoreapp3.1;net472</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<!-- Workaround dependencies that do not yet support netcoreapp3.1 https://github.com/dotnet/roslyn/issues/45114 -->
<NoWarn>NU1701;$(NoWarn)</NoWarn>
<AssetTargetFallback Condition="'$(TargetFramework)' == 'netcoreapp3.1'">net472;$(AssetTargetFallback)</AssetTargetFallback>
<!-- NuGet -->
<IsPackable>true</IsPackable>
<PackageDescription>
......@@ -23,9 +27,6 @@
<ProjectReference Include="..\Core\Microsoft.CodeAnalysis.Remote.Workspaces.csproj" />
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
<PackageReference Include="StreamJsonRpc" Version="$(StreamJsonRpcVersion)" />
<PackageReference Include="Newtonsoft.Json" Version="$(NewtonsoftJsonVersion)" />
<PackageReference Include="Microsoft.VisualStudio.CoreUtility" Version="$(MicrosoftVisualStudioCoreUtilityVersion)" />
......@@ -37,6 +38,11 @@
<PackageReference Include="Microsoft.VisualStudio.Threading" Version="$(MicrosoftVisualStudioThreadingVersion)" />
<PackageReference Include="Microsoft.ServiceHub.Framework" Version="$(MicrosoftServiceHubFrameworkVersion)" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)' == 'net472'">
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Core" />
</ItemGroup>
<ItemGroup>
<PublicAPI Include="PublicAPI.Shipped.txt" />
<PublicAPI Include="PublicAPI.Unshipped.txt" />
......
......@@ -244,7 +244,7 @@ private static void SetNativeDllSearchDirectories()
// "appBasePath": "%VSAPPIDDIR%"
//
var loadDir = AppDomain.CurrentDomain.BaseDirectory;
var loadDir = AppDomain.CurrentDomain.BaseDirectory!;
try
{
......@@ -372,7 +372,7 @@ public override void CopyTo(int sourceIndex, char[] destination, int destination
public override IReadOnlyList<TextChangeRange> GetChangeRanges(SourceText oldText)
=> ImmutableArray.Create(new TextChangeRange(new TextSpan(0, oldText.Length), _text.Length));
public override int GetHashCode() => _text.GetHashCode();
public override bool Equals(object obj) => _text.Equals(obj);
public override bool Equals(object? obj) => _text.Equals(obj);
public override string ToString() => _text.ToString();
public override string ToString(TextSpan span) => _text.ToString(span);
}
......
......@@ -397,7 +397,7 @@ private void LogDisconnectInfo(JsonRpcDisconnectedEventArgs? e)
/// if there is an issue with the connection. E.g. the client end point might not receive
/// a callback from server, or the server end point might not receive a call from client.
/// </summary>
private void OnDisconnected(object sender, JsonRpcDisconnectedEventArgs e)
private void OnDisconnected(object? sender, JsonRpcDisconnectedEventArgs e)
{
_disconnectedReason = e;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册