From f13a49bd2a35c7680db410369e96bf68a5c9c3c9 Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Tue, 13 Nov 2018 16:57:15 -0800 Subject: [PATCH 001/297] Fix websocket disconnect issue --- .../AspNetCore/src/websockethandler.cxx | 32 +++++++++++++------ 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx b/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx index 7adc14c915..afa0b950e1 100644 --- a/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx +++ b/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx @@ -266,6 +266,7 @@ Routine Description: HRESULT hr = S_OK; //DWORD dwBuffSize = RECEIVE_BUFFER_SIZE; + *fHandleCreated = FALSE; _pHandler = pHandler; EnterCriticalSection(&_RequestLock); @@ -1145,21 +1146,34 @@ Arguments: _fCleanupInProgress = TRUE; _fIndicateCompletionToIis = TRUE; - // - // We need cancel IO for fast error handling - // Reivist the code once CanelOutstandingIO api is available - // - /*if (_pWebSocketContext != NULL) + + if (reason == ClientDisconnect || reason == ServerStateUnavailable) { - _pWebSocketContext->CancelOutstandingIO(); - }*/ - _pHttpContext->CancelIo(); + // + // Calling shutdown to notify the backend about disonnect + // + WINHTTP_HELPER::sm_pfnWinHttpWebSocketShutdown( + _hWebSocketRequest, + 1011, // indicate that a server is terminating the connection because it encountered + // an unexpected condition that prevent it from fulfilling the request + NULL, // Reason + 0); // length og Reason + } + + if (reason == ServerDisconnect || reason == ServerStateUnavailable) + { + _pHttpContext->CancelIo(); + // + // CancelIo sometime may not be able to cannel pending websocket IO + // ResetConnection to force IISWebsocket module to release the pipeline + // + _pHttpContext->GetResponse()->ResetConnection(); + } // // Don't close the handle here, // as it trigger a WinHttp callback and let IIS pipeline continue // Handle should be closed only in IndicateCompletionToIIS - IndicateCompletionToIIS(); Finished: if (fLocked) { From 1858527fb0d53b6bd0d6dcbe252e5ec710ca0afc Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Wed, 14 Nov 2018 09:32:16 -0800 Subject: [PATCH 002/297] Feedback --- .../AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx b/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx index afa0b950e1..1816154a0c 100644 --- a/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx +++ b/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx @@ -1154,8 +1154,8 @@ Arguments: // WINHTTP_HELPER::sm_pfnWinHttpWebSocketShutdown( _hWebSocketRequest, - 1011, // indicate that a server is terminating the connection because it encountered - // an unexpected condition that prevent it from fulfilling the request + WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS, // indicate that a server is terminating the connection because it encountered + // an unexpected condition that prevent it from fulfilling the request NULL, // Reason 0); // length og Reason } From 88273412b88a6e447a3ce1f1872c2276e6c6ba70 Mon Sep 17 00:00:00 2001 From: "Chris Ross (ASP.NET)" Date: Wed, 14 Nov 2018 16:20:31 -0800 Subject: [PATCH 003/297] Flow the cancellation tokens to ReadAsync and WriteAsync (#2865) --- .../src/Internal/Http/Http1MessageBody.cs | 5 ++ .../src/Internal/Http/Http1OutputProducer.cs | 4 +- .../Core/src/Internal/Http/HttpProtocol.cs | 2 +- .../src/Internal/Http/IHttpOutputProducer.cs | 2 +- .../Core/src/Internal/Http/MessageBody.cs | 6 +- .../src/Internal/Http2/Http2OutputProducer.cs | 2 +- .../test/FunctionalTests/RequestTests.cs | 68 +++++++++++++++++++ .../test/FunctionalTests/ResponseTests.cs | 67 ++++++++++++++++++ .../TestHelpers/StreamExtensions.cs | 45 ++++++++++++ .../Libuv.FunctionalTests.csproj | 1 + .../Sockets.FunctionalTests.csproj | 1 + 11 files changed, 195 insertions(+), 8 deletions(-) create mode 100644 src/Servers/Kestrel/test/FunctionalTests/TestHelpers/StreamExtensions.cs diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs index f11619d7f3..7aeea58f34 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1MessageBody.cs @@ -148,6 +148,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } } } + catch (OperationCanceledException) + { + // TryRead can throw OperationCanceledException https://github.com/dotnet/corefx/issues/32029 + // beacuse of buggy logic, this works around that for now + } catch (BadHttpRequestException ex) { // At this point, the response has already been written, so this won't result in a 4XX response; diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs b/src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs index 685980d1c6..cf0443fbe7 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/Http1OutputProducer.cs @@ -100,7 +100,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http } } - public Task WriteAsync(Func callback, T state) + public Task WriteAsync(Func callback, T state, CancellationToken cancellationToken) { lock (_contextLock) { @@ -115,7 +115,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http _totalBytesCommitted += bytesCommitted; } - return FlushAsync(); + return FlushAsync(cancellationToken); } public void WriteResponseHeaders(int statusCode, string reasonPhrase, HttpResponseHeaders responseHeaders) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs index b0ae93147d..14871734dd 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpProtocol.cs @@ -928,7 +928,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http private Task WriteChunkedAsync(ReadOnlyMemory data, CancellationToken cancellationToken) { - return Output.WriteAsync(_writeChunk, data); + return Output.WriteAsync(_writeChunk, data, cancellationToken); } private static long WriteChunk(PipeWriter writableBuffer, ReadOnlyMemory buffer) diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpOutputProducer.cs b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpOutputProducer.cs index 41dfdbbbec..5e7a1d5b75 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/IHttpOutputProducer.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/IHttpOutputProducer.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http public interface IHttpOutputProducer : IDisposable { void Abort(ConnectionAbortedException abortReason); - Task WriteAsync(Func callback, T state); + Task WriteAsync(Func callback, T state, CancellationToken cancellationToken); Task FlushAsync(CancellationToken cancellationToken); Task Write100ContinueAsync(CancellationToken cancellationToken); void WriteResponseHeaders(int statusCode, string ReasonPhrase, HttpResponseHeaders responseHeaders); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs index 33bd8ebfb5..5d0dee8db9 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs @@ -42,7 +42,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http while (true) { - var result = await _context.RequestBodyPipe.Reader.ReadAsync(); + var result = await _context.RequestBodyPipe.Reader.ReadAsync(cancellationToken); var readableBuffer = result.Buffer; var consumed = readableBuffer.End; @@ -76,7 +76,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http while (true) { - var result = await _context.RequestBodyPipe.Reader.ReadAsync(); + var result = await _context.RequestBodyPipe.Reader.ReadAsync(cancellationToken); var readableBuffer = result.Buffer; var consumed = readableBuffer.End; @@ -90,7 +90,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http // - The WriteAsync(ReadOnlyMemory) isn't overridden on the destination // - We change the Kestrel Memory Pool to not use pinned arrays but instead use native memory #if NETCOREAPP2_1 - await destination.WriteAsync(memory); + await destination.WriteAsync(memory, cancellationToken); #else var array = memory.GetArray(); await destination.WriteAsync(array.Array, array.Offset, array.Count, cancellationToken); diff --git a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs index e701654d1e..24ab8db7e6 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http2/Http2OutputProducer.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http2 // TODO: RST_STREAM? } - public Task WriteAsync(Func callback, T state) + public Task WriteAsync(Func callback, T state, CancellationToken cancellationToken) { throw new NotImplementedException(); } diff --git a/src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs b/src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs index b528e80b3a..c41212972d 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/RequestTests.cs @@ -222,6 +222,74 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests } } + [Fact] + public async Task RequestBodyReadAsyncCanBeCancelled() + { + var helloTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var readTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var cts = new CancellationTokenSource(); + + using (var server = new TestServer(async context => + { + var buffer = new byte[1024]; + try + { + await context.Request.Body.ReadUntilLengthAsync(buffer, 6, cts.Token).DefaultTimeout(); + + Assert.Equal("Hello ", Encoding.ASCII.GetString(buffer, 0, 6)); + + helloTcs.TrySetResult(null); + } + catch (Exception ex) + { + // This shouldn't fail + helloTcs.TrySetException(ex); + } + + try + { + var task = context.Request.Body.ReadAsync(buffer, 0, buffer.Length, cts.Token); + readTcs.TrySetResult(null); + await task; + + context.Response.ContentLength = 12; + await context.Response.WriteAsync("Read success"); + } + catch (OperationCanceledException) + { + context.Response.ContentLength = 14; + await context.Response.WriteAsync("Read cancelled"); + } + + }, new TestServiceContext(LoggerFactory))) + { + using (var connection = server.CreateConnection()) + { + await connection.Send( + "POST / HTTP/1.1", + "Host:", + "Connection: keep-alive", + "Content-Length: 11", + "", + ""); + + await connection.Send("Hello "); + + await helloTcs.Task; + await readTcs.Task; + + // Cancel the body after hello is read + cts.Cancel(); + + await connection.Receive($"HTTP/1.1 200 OK", + $"Date: {server.Context.DateHeaderValue}", + "Content-Length: 14", + "", + "Read cancelled"); + } + } + } + [Fact] public void CanUpgradeRequestWithConnectionKeepAliveUpgradeHeader() { diff --git a/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs b/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs index 39b6725ee3..6cf324d36d 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/ResponseTests.cs @@ -216,6 +216,73 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests } } + [Fact] + public async Task ResponseBodyWriteAsyncCanBeCancelled() + { + var serviceContext = new TestServiceContext(LoggerFactory); + var cts = new CancellationTokenSource(); + var appTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + var writeBlockedTcs = new TaskCompletionSource(TaskCreationOptions.RunContinuationsAsynchronously); + + using (var server = new TestServer(async context => + { + try + { + await context.Response.WriteAsync("hello", cts.Token).DefaultTimeout(); + + var data = new byte[1024 * 1024 * 10]; + + var timerTask = Task.Delay(TimeSpan.FromSeconds(1)); + var writeTask = context.Response.Body.WriteAsync(data, 0, data.Length, cts.Token).DefaultTimeout(); + var completedTask = await Task.WhenAny(writeTask, timerTask); + + while (completedTask == writeTask) + { + await writeTask; + timerTask = Task.Delay(TimeSpan.FromSeconds(1)); + writeTask = context.Response.Body.WriteAsync(data, 0, data.Length, cts.Token).DefaultTimeout(); + completedTask = await Task.WhenAny(writeTask, timerTask); + } + + writeBlockedTcs.TrySetResult(null); + + await writeTask; + } + catch (Exception ex) + { + appTcs.TrySetException(ex); + writeBlockedTcs.TrySetException(ex); + } + finally + { + appTcs.TrySetResult(null); + } + }, serviceContext)) + { + using (var connection = server.CreateConnection()) + { + await connection.Send( + "GET / HTTP/1.1", + "Host:", + "", + ""); + + await connection.Receive($"HTTP/1.1 200 OK", + $"Date: {server.Context.DateHeaderValue}", + "Transfer-Encoding: chunked", + "", + "5", + "hello"); + + await writeBlockedTcs.Task.DefaultTimeout(); + + cts.Cancel(); + + await Assert.ThrowsAsync(() => appTcs.Task).DefaultTimeout(); + } + } + } + [Fact] public Task ResponseStatusCodeSetBeforeHttpContextDisposeAppException() { diff --git a/src/Servers/Kestrel/test/FunctionalTests/TestHelpers/StreamExtensions.cs b/src/Servers/Kestrel/test/FunctionalTests/TestHelpers/StreamExtensions.cs new file mode 100644 index 0000000000..8fb041b7ef --- /dev/null +++ b/src/Servers/Kestrel/test/FunctionalTests/TestHelpers/StreamExtensions.cs @@ -0,0 +1,45 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Xunit; + +namespace System.IO +{ + public static class StreamFillBufferExtensions + { + public static async Task ReadUntilEndAsync(this Stream stream, byte[] buffer, CancellationToken cancellationToken = default) + { + var offset = 0; + + while (offset < buffer.Length) + { + var read = await stream.ReadAsync(buffer, offset, buffer.Length - offset, cancellationToken); + offset += read; + + if (read == 0) + { + return offset; + } + } + + Assert.Equal(0, await stream.ReadAsync(new byte[1], 0, 1, cancellationToken)); + + return offset; + } + + public static async Task ReadUntilLengthAsync(this Stream stream, byte[] buffer, int length, CancellationToken cancellationToken = default) + { + var offset = 0; + + while (offset < length) + { + var read = await stream.ReadAsync(buffer, offset, length - offset, cancellationToken); + offset += read; + + Assert.NotEqual(0, read); + } + } + } +} diff --git a/src/Servers/Kestrel/test/Libuv.FunctionalTests/Libuv.FunctionalTests.csproj b/src/Servers/Kestrel/test/Libuv.FunctionalTests/Libuv.FunctionalTests.csproj index 96bd15c6ac..742b913e55 100644 --- a/src/Servers/Kestrel/test/Libuv.FunctionalTests/Libuv.FunctionalTests.csproj +++ b/src/Servers/Kestrel/test/Libuv.FunctionalTests/Libuv.FunctionalTests.csproj @@ -23,6 +23,7 @@ + diff --git a/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj b/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj index b4e5e24498..8600f1086c 100644 --- a/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj +++ b/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj @@ -22,6 +22,7 @@ + From 4fae8b983833f94766567af7d4a59bb5731f8f7c Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Thu, 15 Nov 2018 23:27:48 +0000 Subject: [PATCH 004/297] Fix websocket disconnect issue --- .../AspNetCore/src/websockethandler.cxx | 32 +++++++++++++------ src/Middleware/WebSockets/setup-wstest.sh | 0 2 files changed, 23 insertions(+), 9 deletions(-) mode change 100644 => 100755 src/Middleware/WebSockets/setup-wstest.sh diff --git a/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx b/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx index 7adc14c915..1816154a0c 100644 --- a/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx +++ b/src/IISIntegration/src/AspNetCoreModuleV1/AspNetCore/src/websockethandler.cxx @@ -266,6 +266,7 @@ Routine Description: HRESULT hr = S_OK; //DWORD dwBuffSize = RECEIVE_BUFFER_SIZE; + *fHandleCreated = FALSE; _pHandler = pHandler; EnterCriticalSection(&_RequestLock); @@ -1145,21 +1146,34 @@ Arguments: _fCleanupInProgress = TRUE; _fIndicateCompletionToIis = TRUE; - // - // We need cancel IO for fast error handling - // Reivist the code once CanelOutstandingIO api is available - // - /*if (_pWebSocketContext != NULL) + + if (reason == ClientDisconnect || reason == ServerStateUnavailable) { - _pWebSocketContext->CancelOutstandingIO(); - }*/ - _pHttpContext->CancelIo(); + // + // Calling shutdown to notify the backend about disonnect + // + WINHTTP_HELPER::sm_pfnWinHttpWebSocketShutdown( + _hWebSocketRequest, + WINHTTP_WEB_SOCKET_SERVER_ERROR_CLOSE_STATUS, // indicate that a server is terminating the connection because it encountered + // an unexpected condition that prevent it from fulfilling the request + NULL, // Reason + 0); // length og Reason + } + + if (reason == ServerDisconnect || reason == ServerStateUnavailable) + { + _pHttpContext->CancelIo(); + // + // CancelIo sometime may not be able to cannel pending websocket IO + // ResetConnection to force IISWebsocket module to release the pipeline + // + _pHttpContext->GetResponse()->ResetConnection(); + } // // Don't close the handle here, // as it trigger a WinHttp callback and let IIS pipeline continue // Handle should be closed only in IndicateCompletionToIIS - IndicateCompletionToIIS(); Finished: if (fLocked) { diff --git a/src/Middleware/WebSockets/setup-wstest.sh b/src/Middleware/WebSockets/setup-wstest.sh old mode 100644 new mode 100755 From a36db52f9e06568c645a398f32029f8e88d8fa7b Mon Sep 17 00:00:00 2001 From: "Chris Ross (ASP.NET)" Date: Tue, 27 Nov 2018 10:17:37 -0800 Subject: [PATCH 005/297] Add Kestrel.Core to patchconfig --- eng/PatchConfig.props | 1 + 1 file changed, 1 insertion(+) diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index 91e93a17fe..56067f24f1 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -7,6 +7,7 @@ Microsoft.AspNetCore; Microsoft.AspNetCore.Server.IISIntegration; + Microsoft.AspNetCore.Server.Kestrel.Core; From 2720c28047f7b5c43de3de8ff0c0d1bb71dfd671 Mon Sep 17 00:00:00 2001 From: Chris R Date: Thu, 29 Nov 2018 10:39:29 -0800 Subject: [PATCH 006/297] Prepare to patch WebSockets --- build/dependencies.props | 2 +- eng/PatchConfig.props | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index f4f0d4a75f..e3672683be 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -7,6 +7,7 @@ 4.5.3-servicing-27114-05 4.5.2-servicing-27114-05 4.5.2-servicing-27114-05 + 4.5.2 4.5.2-servicing-27114-05 @@ -187,7 +188,6 @@ 5.2.0 3.1.1 4.3.2 - 4.5.2 4.5.0 3.1.1 4.3.0 diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index 56067f24f1..93eeee16f7 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -8,6 +8,7 @@ Microsoft.AspNetCore; Microsoft.AspNetCore.Server.IISIntegration; Microsoft.AspNetCore.Server.Kestrel.Core; + Microsoft.AspNetCore.WebSockets; From cdb9d0bc6811a9d9a6e95f1c65a4bdc64385d80a Mon Sep 17 00:00:00 2001 From: Chris R Date: Thu, 29 Nov 2018 10:55:57 -0800 Subject: [PATCH 007/297] Prepare to patch WebSockets --- build/dependencies.props | 2 +- eng/PatchConfig.props | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/build/dependencies.props b/build/dependencies.props index ce5a629445..d797e51ee3 100644 --- a/build/dependencies.props +++ b/build/dependencies.props @@ -4,6 +4,7 @@ 2.2.0 2.2.0 + 4.5.2 @@ -226,7 +227,6 @@ 4.5.1 4.3.2 4.5.0 - 4.5.1 4.5.0 3.1.1 4.3.0 diff --git a/eng/PatchConfig.props b/eng/PatchConfig.props index 8fb3de2790..d3f6bf9ebe 100644 --- a/eng/PatchConfig.props +++ b/eng/PatchConfig.props @@ -9,6 +9,7 @@ Microsoft.AspNetCore.Server.IISIntegration; Microsoft.AspNetCore.Server.IntegrationTesting.IIS; Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets; + Microsoft.AspNetCore.WebSockets; From 99901fbad50bf35f853c8f69423d420f2bc0bfab Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Tue, 11 Dec 2018 10:23:01 -0800 Subject: [PATCH 008/297] Move Identity.Core and Identity.Stores to NetCoreApp3.0 #3754 (#4523) --- .../src/Core/Microsoft.Extensions.Identity.Core.csproj | 4 ++-- .../src/Stores/Microsoft.Extensions.Identity.Stores.csproj | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Identity/src/Core/Microsoft.Extensions.Identity.Core.csproj b/src/Identity/src/Core/Microsoft.Extensions.Identity.Core.csproj index c446217071..14dc8722e5 100644 --- a/src/Identity/src/Core/Microsoft.Extensions.Identity.Core.csproj +++ b/src/Identity/src/Core/Microsoft.Extensions.Identity.Core.csproj @@ -1,8 +1,8 @@ - + ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. ASP.NET Core Identity allows you to add login features to your application and makes it easy to customize data about the logged in user. - netstandard2.0 + netcoreapp3.0 true aspnetcore;identity;membership diff --git a/src/Identity/src/Stores/Microsoft.Extensions.Identity.Stores.csproj b/src/Identity/src/Stores/Microsoft.Extensions.Identity.Stores.csproj index 10e6e98997..e567cf2749 100644 --- a/src/Identity/src/Stores/Microsoft.Extensions.Identity.Stores.csproj +++ b/src/Identity/src/Stores/Microsoft.Extensions.Identity.Stores.csproj @@ -1,8 +1,8 @@ - + ASP.NET Core Identity is the membership system for building ASP.NET Core web applications, including membership, login, and user data. ASP.NET Core Identity allows you to add login features to your application and makes it easy to customize data about the logged in user. - netstandard2.0 + netcoreapp3.0 true aspnetcore;identity;membership From 7f1f7a525626d8929b86ba15478d791bf10ff168 Mon Sep 17 00:00:00 2001 From: Pavel Krymets Date: Tue, 11 Dec 2018 10:48:55 -0800 Subject: [PATCH 009/297] Change runtime site extension to ship by default (#4572) --- build/artifacts.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build/artifacts.props b/build/artifacts.props index 82149d61bd..dbe6135b65 100644 --- a/build/artifacts.props +++ b/build/artifacts.props @@ -13,6 +13,7 @@ + @@ -84,7 +85,6 @@ - From 7fdd930f507bbec2255dd8ed32f75c97de9ec5ae Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Tue, 11 Dec 2018 13:46:46 -0800 Subject: [PATCH 010/297] Change IIS projects to target netcoreapp3.0 (#4371) * Change IIS projects to target netcoreapp3.0 #3754 --- .../IIS.Performance/IIS.Performance.csproj | 2 +- src/IISIntegration/build/repo.targets | 2 +- src/IISIntegration/build/testsite.props | 13 ++------ .../samples/IISSample/IISSample.csproj | 2 +- .../NativeIISSample/NativeIISSample.csproj | 2 +- .../Core/HttpRequestStream.cs | 5 --- .../Core/HttpResponseStream.cs | 7 +--- .../Core/HttpUpgradeStream.cs | 10 ------ .../Core/WrappingStream.cs | 10 ------ .../Microsoft.AspNetCore.Server.IIS.csproj | 4 +-- ...ft.AspNetCore.Server.IISIntegration.csproj | 2 +- .../IISExpressDeployer.cs | 2 +- ...tCore.Server.IntegrationTesting.IIS.csproj | 2 +- .../Common.FunctionalTests/BasicAuthTests.cs | 2 +- .../ClientCertificateTests.cs | 2 +- .../CommonStartupTests.cs | 2 +- .../CompressionTests.cs | 2 +- .../Inprocess/ClientDisconnectTests.cs | 2 +- .../Inprocess/StartupTests.cs | 2 +- .../Common.FunctionalTests/LogFileTests.cs | 2 +- .../OutOfProcess/AspNetCorePortTests.cs | 2 +- .../OutOfProcess/HelloWorldTest.cs | 2 +- .../PublishedSitesFixture.cs | 2 +- .../Utilities/IISTestSiteFixture.cs | 2 +- .../WindowsAuthTests.cs | 2 +- .../test/Common.Tests/Common.Tests.csproj | 2 +- src/IISIntegration/test/Directory.Build.props | 9 ------ ...kwardsCompatibility.FunctionalTests.csproj | 2 +- ...rwardsCompatibility.FunctionalTests.csproj | 2 +- .../IIS.FunctionalTests.csproj | 2 +- .../test/IIS.Tests/IIS.Tests.csproj | 5 ++- .../IISExpress.FunctionalTests/HttpsTests.cs | 2 +- .../IISExpress.FunctionalTests.csproj | 2 +- .../OutOfProcess/NtlmAuthentationTest.cs | 2 +- ...NetCore.Server.IISIntegration.Tests.csproj | 2 +- .../test/TestTasks/TestTasks.csproj | 5 +-- .../InProcessWebSite.csproj | 2 +- .../InProcessWebSite/InProcessWebSite.csproj | 4 +-- .../OutOfProcessWebSite.csproj | 3 +- .../StressTestWebSite.csproj | 2 +- .../WebSites/shared/WebSockets/TestStartup.cs | 32 ++++++++++++++++--- src/Razor/korebuild-lock.txt | 2 ++ 42 files changed, 73 insertions(+), 94 deletions(-) create mode 100644 src/Razor/korebuild-lock.txt diff --git a/src/IISIntegration/benchmarks/IIS.Performance/IIS.Performance.csproj b/src/IISIntegration/benchmarks/IIS.Performance/IIS.Performance.csproj index 6373cfdfa7..6b1fecc0bb 100644 --- a/src/IISIntegration/benchmarks/IIS.Performance/IIS.Performance.csproj +++ b/src/IISIntegration/benchmarks/IIS.Performance/IIS.Performance.csproj @@ -4,7 +4,7 @@ IIS.Performance Microsoft.AspNetCore.Server.IIS.Performance - netcoreapp2.2 + netcoreapp3.0 Exe true true diff --git a/src/IISIntegration/build/repo.targets b/src/IISIntegration/build/repo.targets index 7d668d32b7..9785c82fdf 100644 --- a/src/IISIntegration/build/repo.targets +++ b/src/IISIntegration/build/repo.targets @@ -115,7 +115,7 @@ + Properties="TargetFramework=netcoreapp3.0;Configuration=$(Configuration);RuntimeIdentifier=win7-%(Platforms.Identity);PublishDir=$(StressAppPublishPath)\%(Identity);BuildProjectReferences=false" /> diff --git a/src/IISIntegration/build/testsite.props b/src/IISIntegration/build/testsite.props index 74f205b4cf..9333b3531d 100644 --- a/src/IISIntegration/build/testsite.props +++ b/src/IISIntegration/build/testsite.props @@ -44,26 +44,19 @@ - - + False - + $(MSBuildThisFileDirectory)..\test\TestTasks\bin\$(Configuration)\$(TargetFramework)\TestTasks - $(InjectDepsAssembly) "win7-$(NativePlatform)" "$(AncmInProcessRHPath)" - - $(InjectDepsAssembly).exe - $(InjectDepsAssembly) - - - + $(InjectDepsAssembly).dll dotnet $(InjectDepsAssembly) $(InjectDepsArguments) diff --git a/src/IISIntegration/samples/IISSample/IISSample.csproj b/src/IISIntegration/samples/IISSample/IISSample.csproj index 556945519e..efdf0a9906 100644 --- a/src/IISIntegration/samples/IISSample/IISSample.csproj +++ b/src/IISIntegration/samples/IISSample/IISSample.csproj @@ -1,7 +1,7 @@ - netcoreapp2.2;net461 + netcoreapp3.0 diff --git a/src/IISIntegration/samples/NativeIISSample/NativeIISSample.csproj b/src/IISIntegration/samples/NativeIISSample/NativeIISSample.csproj index 5fcf5c96a8..cf234bf644 100644 --- a/src/IISIntegration/samples/NativeIISSample/NativeIISSample.csproj +++ b/src/IISIntegration/samples/NativeIISSample/NativeIISSample.csproj @@ -3,7 +3,7 @@ - netcoreapp2.2 + netcoreapp3.0 true diff --git a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpRequestStream.cs b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpRequestStream.cs index 8a9d37b146..9fa5d7405e 100644 --- a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpRequestStream.cs +++ b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpRequestStream.cs @@ -78,17 +78,12 @@ namespace Microsoft.AspNetCore.Server.IIS.Core return ReadAsyncInternal(new Memory(buffer, offset, count), cancellationToken).AsTask(); } -#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { ValidateState(cancellationToken); return ReadAsyncInternal(destination, cancellationToken); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif private async ValueTask ReadAsyncInternal(Memory buffer, CancellationToken cancellationToken) { diff --git a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpResponseStream.cs b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpResponseStream.cs index 1a04535448..739b6b16f5 100644 --- a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpResponseStream.cs +++ b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpResponseStream.cs @@ -89,17 +89,12 @@ namespace Microsoft.AspNetCore.Server.IIS.Core return _context.WriteAsync(new ReadOnlyMemory(buffer, offset, count), cancellationToken); } -#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { ValidateState(cancellationToken); - return new ValueTask(_httpResponseControl.WriteAsync(source, cancellationToken)); + return new ValueTask(_context.WriteAsync(source, cancellationToken)); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public void StartAcceptingWrites() { diff --git a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpUpgradeStream.cs b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpUpgradeStream.cs index c8b481f948..eb71f933e8 100644 --- a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpUpgradeStream.cs +++ b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/HttpUpgradeStream.cs @@ -145,15 +145,10 @@ namespace Microsoft.AspNetCore.Server.IIS.Core return _requestStream.ReadAsync(buffer, offset, count, cancellationToken); } -#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { return _requestStream.ReadAsync(destination, cancellationToken); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) { @@ -165,15 +160,10 @@ namespace Microsoft.AspNetCore.Server.IIS.Core return _responseStream.WriteAsync(buffer, offset, count, cancellationToken); } -#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { return _responseStream.WriteAsync(source, cancellationToken); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override long Seek(long offset, SeekOrigin origin) { diff --git a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/WrappingStream.cs b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/WrappingStream.cs index 18ae443711..e765550b8f 100644 --- a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/WrappingStream.cs +++ b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Core/WrappingStream.cs @@ -68,13 +68,8 @@ namespace Microsoft.AspNetCore.Server.IIS.Core public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => _inner.ReadAsync(buffer, offset, count, cancellationToken); -#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) => _inner.ReadAsync(destination, cancellationToken); -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override int ReadByte() => _inner.ReadByte(); @@ -91,13 +86,8 @@ namespace Microsoft.AspNetCore.Server.IIS.Core public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => _inner.WriteAsync(buffer, offset, count, cancellationToken); -#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) => _inner.WriteAsync(source, cancellationToken); -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override void WriteByte(byte value) => _inner.WriteByte(value); diff --git a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Microsoft.AspNetCore.Server.IIS.csproj b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Microsoft.AspNetCore.Server.IIS.csproj index ac22e5fe84..3cb4d97a51 100644 --- a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Microsoft.AspNetCore.Server.IIS.csproj +++ b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IIS/Microsoft.AspNetCore.Server.IIS.csproj @@ -1,7 +1,7 @@ - netstandard2.0 + netcoreapp3.0 Microsoft.AspNetCore.Server.IIS Provides support for hosting ASP.NET Core in IIS using the AspNetCoreModule. $(NoWarn);CS1591 @@ -9,7 +9,7 @@ aspnetcore;iis true true - netcoreapp2.2 + netcoreapp3.0 True diff --git a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IISIntegration/Microsoft.AspNetCore.Server.IISIntegration.csproj b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IISIntegration/Microsoft.AspNetCore.Server.IISIntegration.csproj index faae91cdbf..67e359cd76 100644 --- a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IISIntegration/Microsoft.AspNetCore.Server.IISIntegration.csproj +++ b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IISIntegration/Microsoft.AspNetCore.Server.IISIntegration.csproj @@ -2,7 +2,7 @@ ASP.NET Core components for working with the IIS AspNetCoreModule. - netstandard2.0 + netcoreapp3.0 $(NoWarn);CS1591 true aspnetcore;iis diff --git a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISExpressDeployer.cs b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISExpressDeployer.cs index 8fe8c66585..3fa6e5db0f 100644 --- a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISExpressDeployer.cs +++ b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/IISExpressDeployer.cs @@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Server.IntegrationTesting.IIS // Start timer StartTimer(); - // For an unpublished application the dllroot points pre-built dlls like projectdir/bin/debug/net461/ + // For an unpublished application the dllroot points pre-built dlls like projectdir/bin/debug/netcoreapp3.0/ // and contentRoot points to the project directory so you get things like static assets. // For a published app both point to the publish directory. var dllRoot = CheckIfPublishIsRequired(); diff --git a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj index 64577364d0..bd5e1e201b 100644 --- a/src/IISIntegration/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj +++ b/src/IISIntegration/src/Microsoft.AspNetCore.Server.IntegrationTesting.IIS/Microsoft.AspNetCore.Server.IntegrationTesting.IIS.csproj @@ -1,7 +1,7 @@  - netstandard2.0 + netcoreapp3.0 Microsoft.AspNetCore.Server.IntegrationTesting.IIS $(VersionPrefix)-$(VersionSuffix) diff --git a/src/IISIntegration/test/Common.FunctionalTests/BasicAuthTests.cs b/src/IISIntegration/test/Common.FunctionalTests/BasicAuthTests.cs index d8607db21e..13c3efb76b 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/BasicAuthTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/BasicAuthTests.cs @@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22) + .WithTfms(Tfm.NetCoreApp30) .WithApplicationTypes(ApplicationType.Portable) .WithAllAncmVersions() .WithAllHostingModels(); diff --git a/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateTests.cs b/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateTests.cs index 43ccc83eff..438ad7dc57 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/ClientCertificateTests.cs @@ -31,7 +31,7 @@ namespace Microsoft.AspNetCore.Server.IIS.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22, Tfm.Net461) + .WithTfms(Tfm.NetCoreApp30) .WithAllApplicationTypes() .WithAllAncmVersions() .WithAllHostingModels(); diff --git a/src/IISIntegration/test/Common.FunctionalTests/CommonStartupTests.cs b/src/IISIntegration/test/Common.FunctionalTests/CommonStartupTests.cs index e2bcf2a8f9..54c8385e7d 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/CommonStartupTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/CommonStartupTests.cs @@ -22,7 +22,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22) + .WithTfms(Tfm.NetCoreApp30) .WithAllApplicationTypes() .WithAllAncmVersions() .WithAllHostingModels(); diff --git a/src/IISIntegration/test/Common.FunctionalTests/CompressionTests.cs b/src/IISIntegration/test/Common.FunctionalTests/CompressionTests.cs index c2d0277c4c..2359eb90c7 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/CompressionTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/CompressionTests.cs @@ -50,7 +50,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests Assert.Equal( new byte[] { 0x1F, 0x8B, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x0B, 0x63, 0x60, 0xA0, 0x3D, 0x00, 0x00, + 0x04, 0x0A, 0x63, 0x60, 0xA0, 0x3D, 0x00, 0x00, 0xCA, 0xC6, 0x88, 0x99, 0x64, 0x00, 0x00, 0x00 }, await response.Content.ReadAsByteArrayAsync()); } diff --git a/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ClientDisconnectTests.cs b/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ClientDisconnectTests.cs index 6e2d1bc752..f97001b45f 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ClientDisconnectTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/Inprocess/ClientDisconnectTests.cs @@ -66,7 +66,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests await _fixture.Client.RetryRequestAsync("/WaitingRequestCount", async message => await message.Content.ReadAsStringAsync() == "0"); } - [ConditionalFact] + [ConditionalFact(Skip = "https://github.com/aspnet/AspNetCore/issues/4512")] public async Task ClientDisconnectCallbackStress() { // Fixture initialization fails if inside of the Task.Run, so send an diff --git a/src/IISIntegration/test/Common.FunctionalTests/Inprocess/StartupTests.cs b/src/IISIntegration/test/Common.FunctionalTests/Inprocess/StartupTests.cs index d51e6feb25..0a1539ff42 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/Inprocess/StartupTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/Inprocess/StartupTests.cs @@ -109,7 +109,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22) + .WithTfms(Tfm.NetCoreApp30) .WithAllApplicationTypes() .WithAncmV2InProcess(); diff --git a/src/IISIntegration/test/Common.FunctionalTests/LogFileTests.cs b/src/IISIntegration/test/Common.FunctionalTests/LogFileTests.cs index 1e15cde5c2..e93b4f007a 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/LogFileTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/LogFileTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22) + .WithTfms(Tfm.NetCoreApp30) .WithAllApplicationTypes() .WithAncmVersions(AncmVersion.AspNetCoreModuleV2) .WithAllHostingModels(); diff --git a/src/IISIntegration/test/Common.FunctionalTests/OutOfProcess/AspNetCorePortTests.cs b/src/IISIntegration/test/Common.FunctionalTests/OutOfProcess/AspNetCorePortTests.cs index 3b86662717..6c241f822c 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/OutOfProcess/AspNetCorePortTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/OutOfProcess/AspNetCorePortTests.cs @@ -32,7 +32,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22) + .WithTfms(Tfm.NetCoreApp30) .WithApplicationTypes(ApplicationType.Portable) .WithAllAncmVersions(); diff --git a/src/IISIntegration/test/Common.FunctionalTests/OutOfProcess/HelloWorldTest.cs b/src/IISIntegration/test/Common.FunctionalTests/OutOfProcess/HelloWorldTest.cs index 11219d4406..68cfdbb0d8 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/OutOfProcess/HelloWorldTest.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/OutOfProcess/HelloWorldTest.cs @@ -26,7 +26,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22, Tfm.Net461) + .WithTfms(Tfm.NetCoreApp30) .WithAllApplicationTypes() .WithAllAncmVersions(); diff --git a/src/IISIntegration/test/Common.FunctionalTests/PublishedSitesFixture.cs b/src/IISIntegration/test/Common.FunctionalTests/PublishedSitesFixture.cs index 282ee26109..ba11dece7c 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/PublishedSitesFixture.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/PublishedSitesFixture.cs @@ -46,7 +46,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests new DeploymentParameters(publisher.ApplicationPath, DeployerSelector.ServerType, RuntimeFlavor.CoreClr, RuntimeArchitecture.x64) { HostingModel = hostingModel, - TargetFramework = "netcoreapp2.2", + TargetFramework = Tfm.NetCoreApp30, AncmVersion = AncmVersion.AspNetCoreModuleV2 }, publish); diff --git a/src/IISIntegration/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs b/src/IISIntegration/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs index e8cfd8f641..1c035a818c 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/Utilities/IISTestSiteFixture.cs @@ -113,7 +113,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests RuntimeFlavor.CoreClr, RuntimeArchitecture.x64) { - TargetFramework = Tfm.NetCoreApp22, + TargetFramework = Tfm.NetCoreApp30, AncmVersion = AncmVersion.AspNetCoreModuleV2, HostingModel = HostingModel.InProcess, PublishApplicationBeforeDeployment = true, diff --git a/src/IISIntegration/test/Common.FunctionalTests/WindowsAuthTests.cs b/src/IISIntegration/test/Common.FunctionalTests/WindowsAuthTests.cs index 8431b15801..14dc6275cd 100644 --- a/src/IISIntegration/test/Common.FunctionalTests/WindowsAuthTests.cs +++ b/src/IISIntegration/test/Common.FunctionalTests/WindowsAuthTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22, Tfm.Net461) + .WithTfms(Tfm.NetCoreApp30) .WithApplicationTypes(ApplicationType.Portable) .WithAllAncmVersions() .WithAllHostingModels(); diff --git a/src/IISIntegration/test/Common.Tests/Common.Tests.csproj b/src/IISIntegration/test/Common.Tests/Common.Tests.csproj index ede80732ee..a53d327877 100644 --- a/src/IISIntegration/test/Common.Tests/Common.Tests.csproj +++ b/src/IISIntegration/test/Common.Tests/Common.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 false diff --git a/src/IISIntegration/test/Directory.Build.props b/src/IISIntegration/test/Directory.Build.props index edfd666254..4b89a431e7 100644 --- a/src/IISIntegration/test/Directory.Build.props +++ b/src/IISIntegration/test/Directory.Build.props @@ -1,15 +1,6 @@ - - - netcoreapp2.2 - $(DeveloperBuildTestTfms) - $(StandardTestTfms) - $(StandardTestTfms);net461 - - diff --git a/src/IISIntegration/test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj b/src/IISIntegration/test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj index c819a03ab1..aa012e408a 100644 --- a/src/IISIntegration/test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj +++ b/src/IISIntegration/test/IIS.BackwardsCompatibility.FunctionalTests/IIS.BackwardsCompatibility.FunctionalTests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 IISBackwardsCompatibility.FunctionalTests True diff --git a/src/IISIntegration/test/IIS.ForwardsCompatibility.FunctionalTests/IIS.ForwardsCompatibility.FunctionalTests.csproj b/src/IISIntegration/test/IIS.ForwardsCompatibility.FunctionalTests/IIS.ForwardsCompatibility.FunctionalTests.csproj index 929f6ec6b0..c7c897e2e5 100644 --- a/src/IISIntegration/test/IIS.ForwardsCompatibility.FunctionalTests/IIS.ForwardsCompatibility.FunctionalTests.csproj +++ b/src/IISIntegration/test/IIS.ForwardsCompatibility.FunctionalTests/IIS.ForwardsCompatibility.FunctionalTests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 IISForwardsCompatibility.FunctionalTests True diff --git a/src/IISIntegration/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj b/src/IISIntegration/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj index 62dec62e60..b42e1ca4b9 100644 --- a/src/IISIntegration/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj +++ b/src/IISIntegration/test/IIS.FunctionalTests/IIS.FunctionalTests.csproj @@ -1,7 +1,7 @@ - netcoreapp2.2 + netcoreapp3.0 IIS.FunctionalTests True diff --git a/src/IISIntegration/test/IIS.Tests/IIS.Tests.csproj b/src/IISIntegration/test/IIS.Tests/IIS.Tests.csproj index 3fdb2a5363..4d95c0cfb4 100644 --- a/src/IISIntegration/test/IIS.Tests/IIS.Tests.csproj +++ b/src/IISIntegration/test/IIS.Tests/IIS.Tests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2 + netcoreapp3.0 @@ -11,7 +11,6 @@ - diff --git a/src/IISIntegration/test/IISExpress.FunctionalTests/HttpsTests.cs b/src/IISIntegration/test/IISExpress.FunctionalTests/HttpsTests.cs index ac58f73c0e..7324bd7613 100644 --- a/src/IISIntegration/test/IISExpress.FunctionalTests/HttpsTests.cs +++ b/src/IISIntegration/test/IISExpress.FunctionalTests/HttpsTests.cs @@ -24,7 +24,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22, Tfm.Net461) + .WithTfms(Tfm.NetCoreApp30) .WithAllApplicationTypes() .WithAllAncmVersions() .WithAllHostingModels(); diff --git a/src/IISIntegration/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj b/src/IISIntegration/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj index 988c2d5943..549d4ae3b4 100644 --- a/src/IISIntegration/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj +++ b/src/IISIntegration/test/IISExpress.FunctionalTests/IISExpress.FunctionalTests.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2 + netcoreapp3.0 True diff --git a/src/IISIntegration/test/IISExpress.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs b/src/IISIntegration/test/IISExpress.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs index 3ff46bf304..294498389f 100644 --- a/src/IISIntegration/test/IISExpress.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs +++ b/src/IISIntegration/test/IISExpress.FunctionalTests/OutOfProcess/NtlmAuthentationTest.cs @@ -30,7 +30,7 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests public static TestMatrix TestVariants => TestMatrix.ForServers(DeployerSelector.ServerType) - .WithTfms(Tfm.NetCoreApp22, Tfm.Net461) + .WithTfms(Tfm.NetCoreApp30) .WithAllAncmVersions(); [ConditionalTheory] diff --git a/src/IISIntegration/test/Microsoft.AspNetCore.Server.IISIntegration.Tests/Microsoft.AspNetCore.Server.IISIntegration.Tests.csproj b/src/IISIntegration/test/Microsoft.AspNetCore.Server.IISIntegration.Tests/Microsoft.AspNetCore.Server.IISIntegration.Tests.csproj index 115d768c1b..491dc71963 100644 --- a/src/IISIntegration/test/Microsoft.AspNetCore.Server.IISIntegration.Tests/Microsoft.AspNetCore.Server.IISIntegration.Tests.csproj +++ b/src/IISIntegration/test/Microsoft.AspNetCore.Server.IISIntegration.Tests/Microsoft.AspNetCore.Server.IISIntegration.Tests.csproj @@ -1,7 +1,7 @@ - $(StandardTestTfms) + netcoreapp3.0 diff --git a/src/IISIntegration/test/TestTasks/TestTasks.csproj b/src/IISIntegration/test/TestTasks/TestTasks.csproj index 3cf4f265bb..24f48ce246 100644 --- a/src/IISIntegration/test/TestTasks/TestTasks.csproj +++ b/src/IISIntegration/test/TestTasks/TestTasks.csproj @@ -1,8 +1,9 @@ - + Exe - $(StandardTestTfms) + netcoreapp3.0 + win7-x64;win7-x86 diff --git a/src/IISIntegration/test/WebSites/InProcessForwardsCompatWebSite/InProcessWebSite.csproj b/src/IISIntegration/test/WebSites/InProcessForwardsCompatWebSite/InProcessWebSite.csproj index e08c2be69f..abf9d74542 100644 --- a/src/IISIntegration/test/WebSites/InProcessForwardsCompatWebSite/InProcessWebSite.csproj +++ b/src/IISIntegration/test/WebSites/InProcessForwardsCompatWebSite/InProcessWebSite.csproj @@ -3,7 +3,7 @@ - netcoreapp2.2 + netcoreapp3.0 diff --git a/src/IISIntegration/test/WebSites/InProcessWebSite/InProcessWebSite.csproj b/src/IISIntegration/test/WebSites/InProcessWebSite/InProcessWebSite.csproj index d007d2daa1..e50a8777e5 100644 --- a/src/IISIntegration/test/WebSites/InProcessWebSite/InProcessWebSite.csproj +++ b/src/IISIntegration/test/WebSites/InProcessWebSite/InProcessWebSite.csproj @@ -1,9 +1,9 @@ - + - netcoreapp2.2 + netcoreapp3.0 true diff --git a/src/IISIntegration/test/WebSites/OutOfProcessWebSite/OutOfProcessWebSite.csproj b/src/IISIntegration/test/WebSites/OutOfProcessWebSite/OutOfProcessWebSite.csproj index 14beb7394e..4f6c2f95be 100644 --- a/src/IISIntegration/test/WebSites/OutOfProcessWebSite/OutOfProcessWebSite.csproj +++ b/src/IISIntegration/test/WebSites/OutOfProcessWebSite/OutOfProcessWebSite.csproj @@ -3,7 +3,8 @@ - $(StandardTestTfms) + netcoreapp3.0 + OutOfProcess diff --git a/src/IISIntegration/test/WebSites/StressTestWebSite/StressTestWebSite.csproj b/src/IISIntegration/test/WebSites/StressTestWebSite/StressTestWebSite.csproj index 25ae032221..453950b189 100644 --- a/src/IISIntegration/test/WebSites/StressTestWebSite/StressTestWebSite.csproj +++ b/src/IISIntegration/test/WebSites/StressTestWebSite/StressTestWebSite.csproj @@ -3,7 +3,7 @@ - $(StandardTestTfms) + netcoreapp3.0 true diff --git a/src/IISIntegration/test/WebSites/shared/WebSockets/TestStartup.cs b/src/IISIntegration/test/WebSites/shared/WebSockets/TestStartup.cs index b1604e367a..f35b9db813 100644 --- a/src/IISIntegration/test/WebSites/shared/WebSockets/TestStartup.cs +++ b/src/IISIntegration/test/WebSites/shared/WebSockets/TestStartup.cs @@ -1,7 +1,9 @@ using System; +using System.Collections.Generic; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Builder.Internal; using Microsoft.AspNetCore.Http; namespace Microsoft.AspNetCore.IISIntegration.FunctionalTests @@ -10,6 +12,8 @@ namespace Microsoft.AspNetCore.IISIntegration.FunctionalTests { public static void Register(IApplicationBuilder app, object startup) { + var delegates = new Dictionary(); + var type = startup.GetType(); foreach (var method in type.GetMethods(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) { @@ -17,22 +21,40 @@ namespace Microsoft.AspNetCore.IISIntegration.FunctionalTests if (method.Name != "Configure" && parameters.Length == 1) { - Action appfunc = null; + RequestDelegate appfunc = null; + if (parameters[0].ParameterType == typeof(IApplicationBuilder)) { - appfunc = innerAppBuilder => method.Invoke(startup, new[] { innerAppBuilder }); + var innerAppBuilder = app.New(); + method.Invoke(startup, new[] { innerAppBuilder }); + appfunc = innerAppBuilder.Build(); } else if (parameters[0].ParameterType == typeof(HttpContext)) { - appfunc = innerAppBuilder => innerAppBuilder.Run(ctx => (Task)method.Invoke(startup, new[] { ctx })); + appfunc = context => (Task)method.Invoke(startup, new[] { context }); } - if (appfunc != null) + if (appfunc == null) { - app.Map("/" + method.Name, appfunc); + continue; } + + delegates.Add("/" + method.Name, appfunc); } } + + app.Run(async context => { + foreach (var requestDelegate in delegates) + { + if (context.Request.Path.StartsWithSegments(requestDelegate.Key, out var matchedPath, out var remainingPath)) + { + var pathBase = context.Request.PathBase; + context.Request.PathBase = pathBase.Add(matchedPath); + context.Request.Path = remainingPath; + await requestDelegate.Value(context); + } + } + }); } } } diff --git a/src/Razor/korebuild-lock.txt b/src/Razor/korebuild-lock.txt new file mode 100644 index 0000000000..0970da4378 --- /dev/null +++ b/src/Razor/korebuild-lock.txt @@ -0,0 +1,2 @@ +version:3.0.0-build-20181120.4 +commithash:84dcc6f0eb5455a3c0305d6d238926defb050889 From 5151e7b1edf9a9294d5af8b3c0dc54f4b59c9deb Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 11 Dec 2018 14:05:21 -0800 Subject: [PATCH 011/297] Workaround problems when opening solution files in Visual Studio (#4569) Changes: * Condense Routing.sln into HttpAbstractions.sln * Workaround NU1105 by adding all ProjectReferences to the .sln * Workaround exceptions in the ReferencesHostBridge by moving Reference items to a temporary item group * Add a 'startvs.cmd' script for launching VS with the right env variables * Remove RangeHelper test project * Move RangeHelper tests into StaticFiles.Tests and add target for NPM restore --- Microsoft.AspNetCore.sln | 39 ----- build/repo.props | 7 + build/repo.targets | 15 ++ docs/BuildFromSource.md | 95 ++++++++--- eng/Baseline.xml | 1 - eng/targets/CSharp.Common.targets | 6 + eng/targets/ResolveReferences.targets | 8 +- src/DataProtection/startvs.cmd | 3 + src/Http/HttpAbstractions.sln | 153 +++++++++++++++--- src/Http/Routing.sln | 137 ---------------- .../src/Microsoft.AspNetCore.Routing.csproj | 1 + src/Http/startvs.cmd | 3 + .../CorsMiddlewareFunctionalTest.cs | 0 .../CorsMiddlewareTests.cs | 0 .../{Test => UnitTests}/CorsOptionsTest.cs | 0 .../CorsPolicyBuilderTests.cs | 0 .../CorsPolicyExtensionsTests.cs | 0 .../{Test => UnitTests}/CorsPolicyTests.cs | 0 .../{Test => UnitTests}/CorsResultTests.cs | 0 .../{Test => UnitTests}/CorsServiceTests.cs | 0 .../{Test => UnitTests}/CorsTestFixtureOfT.cs | 0 .../DefaultCorsPolicyProviderTests.cs | 0 .../Microsoft.AspNetCore.Cors.Test.csproj | 0 .../{Test => UnitTests}/TestCorsOptions.cs | 0 .../{Test => UnitTests}/UriHelpersTests.cs | 0 src/Middleware/Middleware.sln | 141 ++++++++++++++-- .../Microsoft.AspNetCore.StaticFiles.csproj | 2 +- ...AspNetCore.RangeHelper.Sources.Test.csproj | 17 -- .../{Tests => UnitTests}/CacheHeaderTests.cs | 0 .../DefaultContentTypeProviderTests.cs | 0 .../DefaultFilesMiddlewareTests.cs | 0 .../DirectoryBrowserMiddlewareTests.cs | 0 ...rosoft.AspNetCore.StaticFiles.Tests.csproj | 1 - .../{Tests => UnitTests}/RangeHeaderTests.cs | 0 .../RangeHelperTests.cs | 0 .../StaticFileContextTest.cs | 0 .../StaticFileMiddlewareTests.cs | 0 .../StaticFilesTestServer.cs | 0 .../{Tests => UnitTests}/SubFolder/Empty.txt | 0 .../SubFolder/SingleByte.txt | 0 .../SubFolder/default.html | 0 .../{Tests => UnitTests}/SubFolder/extra.xml | 0 .../{Tests => UnitTests}/SubFolder/ranges.txt | 0 .../{Tests => UnitTests}/TestDocument.txt | 0 src/Middleware/startvs.cmd | 3 + src/Servers/Directory.Build.props | 4 +- src/Servers/Kestrel.sln | 80 +++++++++ .../FunctionalTests/GeneratedCodeTests.cs | 8 +- src/Servers/startvs.cmd | 3 + startvs.cmd | 32 ++++ 50 files changed, 494 insertions(+), 265 deletions(-) delete mode 100644 Microsoft.AspNetCore.sln create mode 100644 src/DataProtection/startvs.cmd delete mode 100644 src/Http/Routing.sln create mode 100644 src/Http/startvs.cmd rename src/Middleware/CORS/test/{Test => UnitTests}/CorsMiddlewareFunctionalTest.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsMiddlewareTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsOptionsTest.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsPolicyBuilderTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsPolicyExtensionsTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsPolicyTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsResultTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsServiceTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsTestFixtureOfT.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/DefaultCorsPolicyProviderTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/Microsoft.AspNetCore.Cors.Test.csproj (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/TestCorsOptions.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/UriHelpersTests.cs (100%) delete mode 100644 src/Middleware/StaticFiles/test/RangeHelper.Sources.Test/Microsoft.AspNetCore.RangeHelper.Sources.Test.csproj rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/CacheHeaderTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/DefaultContentTypeProviderTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/DefaultFilesMiddlewareTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/DirectoryBrowserMiddlewareTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/Microsoft.AspNetCore.StaticFiles.Tests.csproj (89%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/RangeHeaderTests.cs (100%) rename src/Middleware/StaticFiles/test/{RangeHelper.Sources.Test => UnitTests}/RangeHelperTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/StaticFileContextTest.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/StaticFileMiddlewareTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/StaticFilesTestServer.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/Empty.txt (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/SingleByte.txt (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/default.html (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/extra.xml (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/ranges.txt (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/TestDocument.txt (100%) create mode 100644 src/Middleware/startvs.cmd create mode 100644 src/Servers/startvs.cmd create mode 100644 startvs.cmd diff --git a/Microsoft.AspNetCore.sln b/Microsoft.AspNetCore.sln deleted file mode 100644 index 809b017e25..0000000000 --- a/Microsoft.AspNetCore.sln +++ /dev/null @@ -1,39 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26124.0 -MinimumVisualStudioVersion = 15.0.26124.0 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{EE2CAA71-82AA-41C0-AE87-5B4FB77D6CFE}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SharedFx.UnitTests", "test\SharedFx.UnitTests\SharedFx.UnitTests.csproj", "{99CC38EC-902B-4B3F-AD33-177018110199}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 - Debug|x86 = Debug|x86 - Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 - Release|x86 = Release|x86 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|Any CPU.Build.0 = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|x64.ActiveCfg = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|x64.Build.0 = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|x86.ActiveCfg = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Debug|x86.Build.0 = Debug|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|Any CPU.ActiveCfg = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|Any CPU.Build.0 = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|x64.ActiveCfg = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|x64.Build.0 = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|x86.ActiveCfg = Release|Any CPU - {99CC38EC-902B-4B3F-AD33-177018110199}.Release|x86.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {99CC38EC-902B-4B3F-AD33-177018110199} = {EE2CAA71-82AA-41C0-AE87-5B4FB77D6CFE} - EndGlobalSection -EndGlobal diff --git a/build/repo.props b/build/repo.props index ff0120ce5a..35e1ed077b 100644 --- a/build/repo.props +++ b/build/repo.props @@ -51,6 +51,13 @@ + + + $(GetArtifactInfoDependsOn);ResolveRepoInfo + + $(RestoreDependsOn);RestoreNpm + + + + + + + install --no-optional + ci + + + + + diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md index aee68a11f0..0a95e6cd55 100644 --- a/docs/BuildFromSource.md +++ b/docs/BuildFromSource.md @@ -1,16 +1,11 @@ Build ASP.NET Core from Source ============================== -Building ASP.NET Core from source allows you tweak and customize ASP.NET Core, and -to contribute your improvements back to the project. +Building ASP.NET Core from source allows you tweak and customize ASP.NET Core, and to contribute your improvements back to the project. -## :warning: Temporary instructions +:warning: We are currently in the middle of restructing our source code. These instructions will likely change rapidly during November and December 2018. -We are currently in the middle of restructing our repositories. While this work is being done, the following instructions will help you be more productive while working on this repo. - -1. Before opening a solution, run `build.cmd /p:_ProjectsOnly=true /p:SkipTests=true`. This will only build the projects which have merged into this repo, not the git submodules. -2. Use (or create) a solution which is scoped to your project file. The build system does not use .sln files. These only exist for developer productivity in Visual Studio, so feel free to adjust the projects in .sln files to match your workload. -3. Questions? Contact @aspnet for help. +See https://github.com/aspnet/AspNetCore/labels/area-infrastructure for known issues and to track ongoing work. ## Install pre-requistes @@ -58,22 +53,66 @@ git submodule update --init --recursive ## Building in Visual Studio / Code -Before opening our .sln files in Visual Studio or VS Code, executing the following on command-line: -``` -.\build.cmd /t:Restore -``` -This will download required tools. +Before opening our .sln files in Visual Studio or VS Code, you need to perform the following actions. + +1. Executing the following on command-line: + ``` + .\build.cmd /p:SkipTests=true /p:_ProjectsOnly=true + ``` + This will download required tools and build the entire repository once. At that point, you should be able to open .sln files to work on the projects you care about. + +2. Use the `startvs.cmd` script to open Visual Studio .sln files. This script first sets required environment variables. + +> :bulb: Pro tip: you will also want to run this command after pulling large sets of changes. Visual Studio will only build projects in a solution file, and makes a best effort to use other files on disk. If you pull many changes, the files on disk may be stale and will need to re-build. + +### Solution files + +We don't have a single .sln file for all of ASP.NET Core because Visual Studio doesn't currently handle projects of this scale. +Instead, we have many .sln files which include a sub-set of projects. These principles guide how we create and manage .slns: + +1. Solution files are not used by CI or command line build scripts. They are for meant for use by developers only. +2. Solution files group together projects which are frequently edited at the same time. +3. Can't find a solution that has the projects you care about? Feel free to make a PR to add a new .sln file. + +> :bulb: Pro tip: `dotnet new sln` and `dotnet sln` are one of the easiest ways to create and modify solutions. + +### Known issue: NU1105 + +Opening solution files may produce an error code NU1105 with a message such + +> Unable to find project information for 'C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj'. Inside Visual Studio, this may be because the project is unloaded or not part of current solution. Otherwise the project file may be invalid or missing targets required for restore. + +This is a known issue in NuGet () and we are working with them for a solution. See also to track progress on this. + +**The workaround** for now is to add all projects to the solution. + + dotnet sln add C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj + #### PATH -For VS Code and Visual Studio to work correctly, you must place the following location in your PATH. -``` -Windows: %USERPROFILE%\.dotnet\x64 -Linux/macOS: $HOME/.dotnet -``` -This must come **before** any other installation of `dotnet`. In Windows, we recommend removing `C:\Program Files\dotnet` from PATH in system variables and adding `%USERPROFILE%\.dotnet\x64` to PATH in user variables. +For VS Code and Visual Studio and `dotnet` commands to work correctly, you must place the following location in your PATH. +Use the following commands to update the PATH variable in a command line window. - +Windows (Command Prompt) + +```batch +set PATH=%USERPROFILE%\.dotnet\x64;%PATH% +``` + +Windows (Powershell) + +```ps1 +$env:PATH="$env:USERPROFILE\.dotnet\x64;$env:PATH" +``` + +Linux/macOS: + +```sh +export PATH="$HOME/.dotnet:$PATH" +``` + +On Windows, we recommend using the `startvs.cmd` command to launch Visual Studio. ## Building on command-line @@ -89,6 +128,14 @@ On macOS/Linux: ./build.sh ``` +### Building a subset of the code + +This repository is large. Look for `build.cmd`/`.sh` scripts in subfolders. These scripts can be used to invoke build and test on a smaller set of projects. + +#### Known issue: not every subfolder has a build.cmd script + +We'll be adding more. See https://github.com/aspnet/AspNetCore/issues/4247. + #### Build properties Additional properties can be added as an argument in the form `/property:$name=$value`, or `/p:$name=$value` for short. For example: @@ -99,8 +146,8 @@ Additional properties can be added as an argument in the form `/property:$name=$ Common properties include: Property | Description --------------------------|--------------------------------------------------------- -BuildNumber | (string). A specific build number, typically from a CI counter +-------------------------|------------------------------------------------------------------------------------------------------------- +BuildNumberSuffix | (string). A specific build number, typically from a CI counter, which is appended to the pre-release label. Configuration | `Debug` or `Release`. Default = `Debug`. SkipTests | `true` or `false`. When true, builds without running tests. NoBuild | `true` or `false`. Runs tests without rebuilding. @@ -109,7 +156,7 @@ NoBuild | `true` or `false`. Runs tests without rebuilding. After building ASP.NET Core from source, you will need to install and use your local version of ASP.NET Core. -- Run the installers produced in `artifacts/installers/` for your platform. +- Run the installers produced in `artifacts/{Debug, Release}/installers/` for your platform. - Add a NuGet.Config to your project directory with the following content: ```xml @@ -128,7 +175,7 @@ After building ASP.NET Core from source, you will need to install and use your l - Update the versions on `PackageReference` items in your .csproj project file to point to the version from your local build. ```xml - + ``` diff --git a/eng/Baseline.xml b/eng/Baseline.xml index 689906d3cf..1a1f29b251 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -55,5 +55,4 @@ - diff --git a/eng/targets/CSharp.Common.targets b/eng/targets/CSharp.Common.targets index a7f7b610b6..8df4213c62 100644 --- a/eng/targets/CSharp.Common.targets +++ b/eng/targets/CSharp.Common.targets @@ -1,5 +1,11 @@ + + + net$(TargetFrameworkVersion.Substring(1).Replace('.','')) + .NETFramework + + diff --git a/eng/targets/ResolveReferences.targets b/eng/targets/ResolveReferences.targets index caf44207ee..7ff54b7d33 100644 --- a/eng/targets/ResolveReferences.targets +++ b/eng/targets/ResolveReferences.targets @@ -45,12 +45,18 @@ + + + <_ReferenceTemp Include="@(Reference)" /> + - + + <_ReferenceTemp Remove="@(_ReferenceTemp)" /> + + + 2.1.1 + + + + + + + + 2.1.1 diff --git a/eng/Baseline.xml b/eng/Baseline.xml index 1a1f29b251..dc0f2f0b13 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -50,6 +50,7 @@ + diff --git a/eng/Dependencies.props b/eng/Dependencies.props index aea94f775c..836b443038 100644 --- a/eng/Dependencies.props +++ b/eng/Dependencies.props @@ -17,6 +17,8 @@ + + diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index 15849673ea..bb785afb7d 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -38,6 +38,7 @@ + diff --git a/src/Middleware/Middleware.sln b/src/Middleware/Middleware.sln index 4967def70b..e861bd87a8 100644 --- a/src/Middleware/Middleware.sln +++ b/src/Middleware/Middleware.sln @@ -165,6 +165,14 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Respon EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.ResponseCaching.Abstractions", "ResponseCaching.Abstractions\src\Microsoft.AspNetCore.ResponseCaching.Abstractions.csproj", "{D0204B45-8528-4504-9FC1-D229F3A33896}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Session", "Session", "{D1394339-B3BE-4F42-8EC0-6E02CC0165EE}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionSample", "Session\samples\SessionSample.csproj", "{3AD7A532-59FC-46BC-8257-D0E6F9533B73}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session", "Session\src\Microsoft.AspNetCore.Session.csproj", "{0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session.Tests", "Session\test\Microsoft.AspNetCore.Session.Tests.csproj", "{20C89A12-96B6-4F2B-9CA8-62891DCA2549}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel", "..\Servers\Kestrel\Kestrel\src\Microsoft.AspNetCore.Server.Kestrel.csproj", "{FD1C2473-5485-4105-87CB-617158F90FCA}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.TestHost", "..\Hosting\TestHost\src\Microsoft.AspNetCore.TestHost.csproj", "{6F6A7E3D-D883-494D-8C61-E75D7EBFE3F4}" @@ -865,6 +873,42 @@ Global {D0204B45-8528-4504-9FC1-D229F3A33896}.Release|x64.Build.0 = Release|Any CPU {D0204B45-8528-4504-9FC1-D229F3A33896}.Release|x86.ActiveCfg = Release|Any CPU {D0204B45-8528-4504-9FC1-D229F3A33896}.Release|x86.Build.0 = Release|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Debug|x64.ActiveCfg = Debug|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Debug|x64.Build.0 = Debug|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Debug|x86.ActiveCfg = Debug|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Debug|x86.Build.0 = Debug|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Release|Any CPU.Build.0 = Release|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Release|x64.ActiveCfg = Release|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Release|x64.Build.0 = Release|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Release|x86.ActiveCfg = Release|Any CPU + {3AD7A532-59FC-46BC-8257-D0E6F9533B73}.Release|x86.Build.0 = Release|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Debug|x64.ActiveCfg = Debug|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Debug|x64.Build.0 = Debug|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Debug|x86.ActiveCfg = Debug|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Debug|x86.Build.0 = Debug|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Release|Any CPU.Build.0 = Release|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Release|x64.ActiveCfg = Release|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Release|x64.Build.0 = Release|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Release|x86.ActiveCfg = Release|Any CPU + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24}.Release|x86.Build.0 = Release|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Debug|Any CPU.Build.0 = Debug|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Debug|x64.ActiveCfg = Debug|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Debug|x64.Build.0 = Debug|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Debug|x86.ActiveCfg = Debug|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Debug|x86.Build.0 = Debug|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Release|Any CPU.ActiveCfg = Release|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Release|Any CPU.Build.0 = Release|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Release|x64.ActiveCfg = Release|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Release|x64.Build.0 = Release|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Release|x86.ActiveCfg = Release|Any CPU + {20C89A12-96B6-4F2B-9CA8-62891DCA2549}.Release|x86.Build.0 = Release|Any CPU {FD1C2473-5485-4105-87CB-617158F90FCA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {FD1C2473-5485-4105-87CB-617158F90FCA}.Debug|Any CPU.Build.0 = Debug|Any CPU {FD1C2473-5485-4105-87CB-617158F90FCA}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1031,6 +1075,9 @@ Global {D8239A8C-F692-460A-B204-5CF05502BEE2} = {EDF56413-B406-4200-B4D4-0EE3F9CB8F7C} {9F973483-5D32-4093-88F0-761C9BEAEE04} = {EDF56413-B406-4200-B4D4-0EE3F9CB8F7C} {D0204B45-8528-4504-9FC1-D229F3A33896} = {7A493DEA-32F2-4AB1-9113-828D44F5DDA2} + {3AD7A532-59FC-46BC-8257-D0E6F9533B73} = {D1394339-B3BE-4F42-8EC0-6E02CC0165EE} + {0FBCB5C7-B212-4BEE-B9AE-0BF653BBAD24} = {D1394339-B3BE-4F42-8EC0-6E02CC0165EE} + {20C89A12-96B6-4F2B-9CA8-62891DCA2549} = {D1394339-B3BE-4F42-8EC0-6E02CC0165EE} {FD1C2473-5485-4105-87CB-617158F90FCA} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} {6F6A7E3D-D883-494D-8C61-E75D7EBFE3F4} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} {9D3062AB-5B11-4FFE-BEAF-304CF7F19AA5} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} diff --git a/src/Middleware/Session/samples/SessionSample.csproj b/src/Middleware/Session/samples/SessionSample.csproj new file mode 100644 index 0000000000..e56bbdefff --- /dev/null +++ b/src/Middleware/Session/samples/SessionSample.csproj @@ -0,0 +1,17 @@ + + + + netcoreapp2.1;net461 + + + + + + + + + + + + + diff --git a/src/Session/samples/SessionSample/Startup.cs b/src/Middleware/Session/samples/Startup.cs similarity index 100% rename from src/Session/samples/SessionSample/Startup.cs rename to src/Middleware/Session/samples/Startup.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/CookieProtection.cs b/src/Middleware/Session/src/CookieProtection.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/CookieProtection.cs rename to src/Middleware/Session/src/CookieProtection.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/DistributedSession.cs b/src/Middleware/Session/src/DistributedSession.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/DistributedSession.cs rename to src/Middleware/Session/src/DistributedSession.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs b/src/Middleware/Session/src/DistributedSessionStore.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/DistributedSessionStore.cs rename to src/Middleware/Session/src/DistributedSessionStore.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/EncodedKey.cs b/src/Middleware/Session/src/EncodedKey.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/EncodedKey.cs rename to src/Middleware/Session/src/EncodedKey.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/ISessionStore.cs b/src/Middleware/Session/src/ISessionStore.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/ISessionStore.cs rename to src/Middleware/Session/src/ISessionStore.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs b/src/Middleware/Session/src/LoggingExtensions.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/LoggingExtensions.cs rename to src/Middleware/Session/src/LoggingExtensions.cs diff --git a/src/Middleware/Session/src/Microsoft.AspNetCore.Session.csproj b/src/Middleware/Session/src/Microsoft.AspNetCore.Session.csproj new file mode 100644 index 0000000000..787ee561e5 --- /dev/null +++ b/src/Middleware/Session/src/Microsoft.AspNetCore.Session.csproj @@ -0,0 +1,20 @@ + + + + ASP.NET Core session state middleware. + netstandard2.0 + $(NoWarn);CS1591 + true + true + aspnetcore;session;sessionstate + + + + + + + + + + + diff --git a/src/Session/src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs b/src/Middleware/Session/src/NoOpSessionStore.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/NoOpSessionStore.cs rename to src/Middleware/Session/src/NoOpSessionStore.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs b/src/Middleware/Session/src/Properties/Resources.Designer.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/Properties/Resources.Designer.cs rename to src/Middleware/Session/src/Properties/Resources.Designer.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/Resources.resx b/src/Middleware/Session/src/Resources.resx similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/Resources.resx rename to src/Middleware/Session/src/Resources.resx diff --git a/src/Session/src/Microsoft.AspNetCore.Session/SessionDefaults.cs b/src/Middleware/Session/src/SessionDefaults.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/SessionDefaults.cs rename to src/Middleware/Session/src/SessionDefaults.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/SessionFeature.cs b/src/Middleware/Session/src/SessionFeature.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/SessionFeature.cs rename to src/Middleware/Session/src/SessionFeature.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs b/src/Middleware/Session/src/SessionMiddleware.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/SessionMiddleware.cs rename to src/Middleware/Session/src/SessionMiddleware.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs b/src/Middleware/Session/src/SessionMiddlewareExtensions.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/SessionMiddlewareExtensions.cs rename to src/Middleware/Session/src/SessionMiddlewareExtensions.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/SessionOptions.cs b/src/Middleware/Session/src/SessionOptions.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/SessionOptions.cs rename to src/Middleware/Session/src/SessionOptions.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs b/src/Middleware/Session/src/SessionServiceCollectionExtensions.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/SessionServiceCollectionExtensions.cs rename to src/Middleware/Session/src/SessionServiceCollectionExtensions.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/SipHash.cs b/src/Middleware/Session/src/SipHash.cs similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/SipHash.cs rename to src/Middleware/Session/src/SipHash.cs diff --git a/src/Session/src/Microsoft.AspNetCore.Session/baseline.netcore.json b/src/Middleware/Session/src/baseline.netcore.json similarity index 100% rename from src/Session/src/Microsoft.AspNetCore.Session/baseline.netcore.json rename to src/Middleware/Session/src/baseline.netcore.json diff --git a/src/Middleware/Session/test/Microsoft.AspNetCore.Session.Tests.csproj b/src/Middleware/Session/test/Microsoft.AspNetCore.Session.Tests.csproj new file mode 100644 index 0000000000..4c3e5f7420 --- /dev/null +++ b/src/Middleware/Session/test/Microsoft.AspNetCore.Session.Tests.csproj @@ -0,0 +1,14 @@ + + + + $(StandardTestTfms) + + + + + + + + + + diff --git a/src/Session/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs b/src/Middleware/Session/test/SessionTests.cs similarity index 100% rename from src/Session/test/Microsoft.AspNetCore.Session.Tests/SessionTests.cs rename to src/Middleware/Session/test/SessionTests.cs diff --git a/src/Session/.gitignore b/src/Session/.gitignore deleted file mode 100644 index f332e76e0f..0000000000 --- a/src/Session/.gitignore +++ /dev/null @@ -1,33 +0,0 @@ -[Oo]bj/ -[Bb]in/ -TestResults/ -.nuget/ -*.sln.ide/ -_ReSharper.*/ -packages/ -artifacts/ -PublishProfiles/ -*.user -*.suo -*.cache -*.docstates -_ReSharper.* -nuget.exe -*net45.csproj -*net451.csproj -*k10.csproj -*.psess -*.vsp -*.pidb -*.userprefs -*DS_Store -*.ncrunchsolution -*.*sdf -*.ipch -.vs/ -.vscode/ -project.lock.json -.build/ -.testPublish/ -launchSettings.json -global.json diff --git a/src/Session/Directory.Build.props b/src/Session/Directory.Build.props deleted file mode 100644 index 2883c9cc0a..0000000000 --- a/src/Session/Directory.Build.props +++ /dev/null @@ -1,21 +0,0 @@ - - - - - - - - - Microsoft ASP.NET Core - https://github.com/aspnet/AspNetCore - git - $(MSBuildThisFileDirectory) - $(MSBuildThisFileDirectory)build\Key.snk - true - true - true - - - diff --git a/src/Session/Directory.Build.targets b/src/Session/Directory.Build.targets deleted file mode 100644 index 53b3f6e1da..0000000000 --- a/src/Session/Directory.Build.targets +++ /dev/null @@ -1,7 +0,0 @@ - - - $(MicrosoftNETCoreApp20PackageVersion) - $(MicrosoftNETCoreApp21PackageVersion) - $(NETStandardLibrary20PackageVersion) - - diff --git a/src/Session/NuGetPackageVerifier.json b/src/Session/NuGetPackageVerifier.json deleted file mode 100644 index b153ab1515..0000000000 --- a/src/Session/NuGetPackageVerifier.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Default": { - "rules": [ - "DefaultCompositeRule" - ] - } -} \ No newline at end of file diff --git a/src/Session/README.md b/src/Session/README.md deleted file mode 100644 index 976f9f21cf..0000000000 --- a/src/Session/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Session -================ - -AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/yyivj6uwu3uj2x40/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/Session/branch/dev) - -Travis: [![Travis](https://travis-ci.org/aspnet/Session.svg?branch=dev)](https://travis-ci.org/aspnet/Session) - -Contains libraries for session state middleware for ASP.NET Core. - -For ASP.NET 4.x session state, please go to https://github.com/aspnet/AspNetSessionState. - -This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo. diff --git a/src/Session/Session.sln b/src/Session/Session.sln deleted file mode 100644 index d8d95dc295..0000000000 --- a/src/Session/Session.sln +++ /dev/null @@ -1,74 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26621.2 -MinimumVisualStudioVersion = 15.0.26730.03 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" - ProjectSection(SolutionItems) = preProject - test\Directory.Build.props = test\Directory.Build.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" - ProjectSection(SolutionItems) = preProject - src\Directory.Build.props = src\Directory.Build.props - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session", "src\Microsoft.AspNetCore.Session\Microsoft.AspNetCore.Session.csproj", "{71802736-F640-4733-9671-02D267EDD76A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session.Tests", "test\Microsoft.AspNetCore.Session.Tests\Microsoft.AspNetCore.Session.Tests.csproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionSample", "samples\SessionSample\SessionSample.csproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{3B45F658-5BF1-4E07-BE9C-6F5110AC2277}" - ProjectSection(SolutionItems) = preProject - .appveyor.yml = .appveyor.yml - .gitattributes = .gitattributes - .gitignore = .gitignore - .travis.yml = .travis.yml - Directory.Build.props = Directory.Build.props - Directory.Build.targets = Directory.Build.targets - NuGet.config = NuGet.config - NuGetPackageVerifier.json = NuGetPackageVerifier.json - README.md = README.md - version.xml = version.xml - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4F21221F-2813-41B7-AAFC-E03FD52971CC}" - ProjectSection(SolutionItems) = preProject - build\common.props = build\common.props - build\dependencies.props = build\dependencies.props - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.Build.0 = Release|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.Build.0 = Release|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {71802736-F640-4733-9671-02D267EDD76A} = {A189F10C-3A9C-4F81-83D0-32E5FE50DAD8} - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639} = {E9D63F97-6078-42AD-BFD3-F956BF921BB5} - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365} = {94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE} - {4F21221F-2813-41B7-AAFC-E03FD52971CC} = {3B45F658-5BF1-4E07-BE9C-6F5110AC2277} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6AE224B9-B604-4E47-9617-9D114DAE9BE5} - EndGlobalSection -EndGlobal diff --git a/src/Session/build/Key.snk b/src/Session/build/Key.snk deleted file mode 100644 index e10e4889c125d3120cd9e81582243d70f7cbb806..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098=Iw=HCsnz~#iVhm& zj%TU(_THUee?3yHBjk$37ysB?i5#7WD$={H zV4B!OxRPrb|8)HPg~A}8P>^=#y<)56#=E&NzcjOtPK~<4n6GHt=K$ro*T(lhby_@U zEk(hLzk1H)0yXj{A_5>fk-TgNoP|q6(tP2xo8zt8i%212CWM#AeCd?`hS|4~L({h~Moo(~vy&3Z z1uI}`fd^*>o=rwbAGymj6RM^pZm(*Kfhs+Y1#`-2JPWZMK8@;ZWCk2+9bX4YP);~fj-BU*R zQPvWv$89!{Rl9wM+zR>_TSkn^voYxA?2G iKnV#iZ6Ah`K>b=@=IjYJXrxL124zR(38)nxe+&q_$QXwJ diff --git a/src/Session/build/dependencies.props b/src/Session/build/dependencies.props deleted file mode 100644 index 6e86d21f90..0000000000 --- a/src/Session/build/dependencies.props +++ /dev/null @@ -1,36 +0,0 @@ - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - - - - 2.1.3-rtm-15802 - 2.0.0 - 2.1.2 - 15.6.1 - 2.0.3 - 2.3.1 - 2.4.0-beta.1.build3945 - - - - - - - - 2.1.1 - 2.1.1 - 2.1.1 - 2.1.2 - 2.1.1 - 2.1.1 - 2.1.1 - 2.1.1 - 2.1.1 - 2.1.1 - 2.1.1 - 2.1.1 - 2.1.1 - - \ No newline at end of file diff --git a/src/Session/build/repo.props b/src/Session/build/repo.props deleted file mode 100644 index 1dc8b8100d..0000000000 --- a/src/Session/build/repo.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/src/Session/build/sources.props b/src/Session/build/sources.props deleted file mode 100644 index 9215df9751..0000000000 --- a/src/Session/build/sources.props +++ /dev/null @@ -1,17 +0,0 @@ - - - - - $(DotNetRestoreSources) - - $(RestoreSources); - https://dotnet.myget.org/F/dotnet-core/api/v3/index.json; - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; - https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; - - - $(RestoreSources); - https://api.nuget.org/v3/index.json; - - - diff --git a/src/Session/samples/SessionSample/Properties/launchSettings.json b/src/Session/samples/SessionSample/Properties/launchSettings.json deleted file mode 100644 index 6bab3d3602..0000000000 --- a/src/Session/samples/SessionSample/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:2481/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "SessionSample": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} \ No newline at end of file diff --git a/src/Session/samples/SessionSample/SessionSample.csproj b/src/Session/samples/SessionSample/SessionSample.csproj deleted file mode 100644 index 67abefae09..0000000000 --- a/src/Session/samples/SessionSample/SessionSample.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netcoreapp2.1;net461 - - - - - - - - - - - - - - - - diff --git a/src/Session/src/Directory.Build.props b/src/Session/src/Directory.Build.props deleted file mode 100644 index 1e0980f663..0000000000 --- a/src/Session/src/Directory.Build.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj deleted file mode 100644 index 3da00b9032..0000000000 --- a/src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - ASP.NET Core session state middleware. - netstandard2.0 - $(NoWarn);CS1591 - true - true - aspnetcore;session;sessionstate - - - - - - - - - - - diff --git a/src/Session/test/Directory.Build.props b/src/Session/test/Directory.Build.props deleted file mode 100644 index 270e1fa209..0000000000 --- a/src/Session/test/Directory.Build.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - netcoreapp2.1 - $(DeveloperBuildTestTfms) - netcoreapp2.1;netcoreapp2.0 - $(StandardTestTfms);net461 - - - - - - diff --git a/src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj deleted file mode 100644 index 9dc11b9d2f..0000000000 --- a/src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - $(StandardTestTfms) - true - true - - - - - - - - - - - - - - - - diff --git a/src/Session/version.props b/src/Session/version.props deleted file mode 100644 index 669c874829..0000000000 --- a/src/Session/version.props +++ /dev/null @@ -1,12 +0,0 @@ - - - 2.1.1 - rtm - $(VersionPrefix) - $(VersionPrefix)-$(VersionSuffix)-final - t000 - a- - $(FeatureBranchVersionPrefix)$(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-')) - $(VersionSuffix)-$(BuildNumber) - - From 719ff084094f2e32205035a7f7372ba1a4e4c171 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 11 Dec 2018 14:56:56 -0800 Subject: [PATCH 013/297] Add RoutingSample.Web to HttpAbstractions.sln --- src/Http/HttpAbstractions.sln | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/src/Http/HttpAbstractions.sln b/src/Http/HttpAbstractions.sln index 2e963df3d2..17e89b8dea 100644 --- a/src/Http/HttpAbstractions.sln +++ b/src/Http/HttpAbstractions.sln @@ -75,7 +75,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Routin EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests", "Routing.Abstractions\test\Microsoft.AspNetCore.Mvc.Routing.Abstractions.Tests.csproj", "{E4AC79A3-625B-421B-9F91-EFCBD9BEB37F}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.TestHost", "..\Hosting\TestHost\src\Microsoft.AspNetCore.TestHost.csproj", "{BF8DC0FF-96F9-4705-8CFA-F42BE989AB6A}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.TestHost", "..\Hosting\TestHost\src\Microsoft.AspNetCore.TestHost.csproj", "{BF8DC0FF-96F9-4705-8CFA-F42BE989AB6A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoutingSample.Web", "Routing\test\testassets\RoutingSample.Web\RoutingSample.Web.csproj", "{F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dependencies", "dependencies", "{793FFE24-138A-4C3D-81AB-18D625E36230}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -387,6 +391,18 @@ Global {BF8DC0FF-96F9-4705-8CFA-F42BE989AB6A}.Release|x64.Build.0 = Release|Any CPU {BF8DC0FF-96F9-4705-8CFA-F42BE989AB6A}.Release|x86.ActiveCfg = Release|Any CPU {BF8DC0FF-96F9-4705-8CFA-F42BE989AB6A}.Release|x86.Build.0 = Release|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Debug|x64.ActiveCfg = Debug|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Debug|x64.Build.0 = Debug|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Debug|x86.ActiveCfg = Debug|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Debug|x86.Build.0 = Debug|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Release|Any CPU.Build.0 = Release|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Release|x64.ActiveCfg = Release|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Release|x64.Build.0 = Release|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Release|x86.ActiveCfg = Release|Any CPU + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -407,6 +423,7 @@ Global {5A64C915-7045-4100-B2CB-3A50BD854D2D} = {0B1B3E58-DA37-46D6-B791-47739EF27790} {21624719-422E-4621-A17A-C6F10436F1FE} = {4D5C4F16-5DC5-4244-A10F-08545126F61B} {38EA14B3-17BB-44F4-A9EA-A8675E9BF1E4} = {4D5C4F16-5DC5-4244-A10F-08545126F61B} + {391FBA36-BEEB-411A-A588-3F83901C0C1A} = {FB2DCA0F-EB9E-425B-ABBC-D543DBEC090F} {2378049E-ABE9-4843-AAC7-A6C9E704463D} = {391FBA36-BEEB-411A-A588-3F83901C0C1A} {1A866315-5FD5-4F96-BFAC-1447E3CB4514} = {80A090C8-ED02-4DE3-875A-30DCCDBD84BA} {068A1DA0-C7DF-4E3C-9933-4E79A141EFF8} = {80A090C8-ED02-4DE3-875A-30DCCDBD84BA} @@ -416,6 +433,8 @@ Global {8B64326C-A87F-4157-8337-22B5C4D7A4B7} = {14A7B3DE-46C8-4245-B0BD-9AFF3795C163} {3E8E6EAC-4C92-46C5-AED0-5F3C0745D34F} = {24D19E8E-25FD-4C0B-8865-697878B67BE0} {E4AC79A3-625B-421B-9F91-EFCBD9BEB37F} = {24D19E8E-25FD-4C0B-8865-697878B67BE0} + {BF8DC0FF-96F9-4705-8CFA-F42BE989AB6A} = {793FFE24-138A-4C3D-81AB-18D625E36230} + {F4F5D8AF-FBD1-463F-9473-B63AA820A6C4} = {14A7B3DE-46C8-4245-B0BD-9AFF3795C163} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {85B5E151-2E9D-419C-83DD-0DDCF446C83A} From 97cdbfb1a1824c8545f0586f39c8c7d0ca5b3508 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Tue, 11 Dec 2018 15:41:36 -0800 Subject: [PATCH 014/297] Change middleware projects to target netcoreapp3.0 #3754 (#4472) --- .../Microsoft.AspNetCore.HostFiltering.csproj | 2 +- .../Microsoft.AspNetCore.HttpOverrides.csproj | 2 +- .../src/Microsoft.AspNetCore.HttpsPolicy.csproj | 2 +- .../src/BrotliCompressionProvider.cs | 9 +-------- .../src/GzipCompressionProvider.cs | 16 ++-------------- ...crosoft.AspNetCore.ResponseCompression.csproj | 2 +- .../src/ResponseCompressionProvider.cs | 8 +------- .../src/Microsoft.AspNetCore.Rewrite.csproj | 2 +- 8 files changed, 9 insertions(+), 34 deletions(-) diff --git a/src/Middleware/HostFiltering/src/Microsoft.AspNetCore.HostFiltering.csproj b/src/Middleware/HostFiltering/src/Microsoft.AspNetCore.HostFiltering.csproj index a8eb42bb02..b18fc411cb 100644 --- a/src/Middleware/HostFiltering/src/Microsoft.AspNetCore.HostFiltering.csproj +++ b/src/Middleware/HostFiltering/src/Microsoft.AspNetCore.HostFiltering.csproj @@ -4,7 +4,7 @@ ASP.NET Core middleware for filtering out requests with unknown HTTP host headers. - netstandard2.0 + netcoreapp3.0 true aspnetcore diff --git a/src/Middleware/HttpOverrides/src/Microsoft.AspNetCore.HttpOverrides.csproj b/src/Middleware/HttpOverrides/src/Microsoft.AspNetCore.HttpOverrides.csproj index 11b2130693..23b78b1c16 100644 --- a/src/Middleware/HttpOverrides/src/Microsoft.AspNetCore.HttpOverrides.csproj +++ b/src/Middleware/HttpOverrides/src/Microsoft.AspNetCore.HttpOverrides.csproj @@ -4,7 +4,7 @@ ASP.NET Core basic middleware for supporting HTTP method overrides. Includes: * X-Forwarded-* headers to forward headers from a proxy. * HTTP method override header. - netstandard2.0 + netcoreapp3.0 $(NoWarn);CS1591 true aspnetcore;proxy;headers;xforwarded diff --git a/src/Middleware/HttpsPolicy/src/Microsoft.AspNetCore.HttpsPolicy.csproj b/src/Middleware/HttpsPolicy/src/Microsoft.AspNetCore.HttpsPolicy.csproj index f367ea28cc..35061ff218 100644 --- a/src/Middleware/HttpsPolicy/src/Microsoft.AspNetCore.HttpsPolicy.csproj +++ b/src/Middleware/HttpsPolicy/src/Microsoft.AspNetCore.HttpsPolicy.csproj @@ -4,7 +4,7 @@ ASP.NET Core basic middleware for supporting HTTPS Redirection and HTTP Strict-Transport-Security. - netstandard2.0 + netcoreapp3.0 $(NoWarn);CS1591 true aspnetcore;https;hsts diff --git a/src/Middleware/ResponseCompression/src/BrotliCompressionProvider.cs b/src/Middleware/ResponseCompression/src/BrotliCompressionProvider.cs index 28955fd6f7..6cc0a88d5d 100644 --- a/src/Middleware/ResponseCompression/src/BrotliCompressionProvider.cs +++ b/src/Middleware/ResponseCompression/src/BrotliCompressionProvider.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -38,14 +38,7 @@ namespace Microsoft.AspNetCore.ResponseCompression /// public Stream CreateStream(Stream outputStream) { -#if NETCOREAPP2_1 return new BrotliStream(outputStream, Options.Level, leaveOpen: true); -#elif NET461 || NETSTANDARD2_0 - // Brotli is only supported in .NET Core 2.1+ - throw new PlatformNotSupportedException(); -#else -#error Target frameworks need to be updated. -#endif } } } diff --git a/src/Middleware/ResponseCompression/src/GzipCompressionProvider.cs b/src/Middleware/ResponseCompression/src/GzipCompressionProvider.cs index 1e5026430c..0a001e0d53 100644 --- a/src/Middleware/ResponseCompression/src/GzipCompressionProvider.cs +++ b/src/Middleware/ResponseCompression/src/GzipCompressionProvider.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -33,19 +33,7 @@ namespace Microsoft.AspNetCore.ResponseCompression public string EncodingName { get; } = "gzip"; /// - public bool SupportsFlush - { - get - { -#if NET461 - return false; -#elif NETSTANDARD2_0 || NETCOREAPP2_1 - return true; -#else -#error target frameworks need to be updated -#endif - } - } + public bool SupportsFlush => true; /// public Stream CreateStream(Stream outputStream) diff --git a/src/Middleware/ResponseCompression/src/Microsoft.AspNetCore.ResponseCompression.csproj b/src/Middleware/ResponseCompression/src/Microsoft.AspNetCore.ResponseCompression.csproj index b1fb865276..f35baf967d 100644 --- a/src/Middleware/ResponseCompression/src/Microsoft.AspNetCore.ResponseCompression.csproj +++ b/src/Middleware/ResponseCompression/src/Microsoft.AspNetCore.ResponseCompression.csproj @@ -2,7 +2,7 @@ ASP.NET Core middleware for HTTP Response compression. - net461;netstandard2.0;netcoreapp2.1 + netcoreapp3.0 true aspnetcore diff --git a/src/Middleware/ResponseCompression/src/ResponseCompressionProvider.cs b/src/Middleware/ResponseCompression/src/ResponseCompressionProvider.cs index b63ff7380e..8b2c2222e9 100644 --- a/src/Middleware/ResponseCompression/src/ResponseCompressionProvider.cs +++ b/src/Middleware/ResponseCompression/src/ResponseCompressionProvider.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -48,13 +48,7 @@ namespace Microsoft.AspNetCore.ResponseCompression // Use the factory so it can resolve IOptions from DI. _providers = new ICompressionProvider[] { -#if NETCOREAPP2_1 new CompressionProviderFactory(typeof(BrotliCompressionProvider)), -#elif NET461 || NETSTANDARD2_0 - // Brotli is only supported in .NET Core 2.1+ -#else -#error Target frameworks need to be updated. -#endif new CompressionProviderFactory(typeof(GzipCompressionProvider)), }; } diff --git a/src/Middleware/Rewrite/src/Microsoft.AspNetCore.Rewrite.csproj b/src/Middleware/Rewrite/src/Microsoft.AspNetCore.Rewrite.csproj index 48a6e913f5..0ac6ec15b1 100644 --- a/src/Middleware/Rewrite/src/Microsoft.AspNetCore.Rewrite.csproj +++ b/src/Middleware/Rewrite/src/Microsoft.AspNetCore.Rewrite.csproj @@ -5,7 +5,7 @@ * Support for custom URL rewrite rules * Support for running IIS URL Rewrite module rules * Support for running Apache mod_rewrite rules. - netstandard2.0 + netcoreapp3.0 $(NoWarn);CS1591 true aspnetcore;urlrewrite;mod_rewrite From 21488b2b0443e6635af0f6efcfdf0aae6a03e804 Mon Sep 17 00:00:00 2001 From: seancpeters Date: Tue, 11 Dec 2018 15:53:10 -0800 Subject: [PATCH 015/297] Add a workaround for a bug in `dotnet tool install` and the scaffolding command line tool (#4580) --- modules/Scaffolding | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/Scaffolding b/modules/Scaffolding index 446caddc44..a8a3c4d6bc 160000 --- a/modules/Scaffolding +++ b/modules/Scaffolding @@ -1 +1 @@ -Subproject commit 446caddc44066c23e67873edcc7489a1310ffd05 +Subproject commit a8a3c4d6bcef48a3dd464d03f629a0a18dbf3110 From 0f9ad16b096ca2535d77efd2ad27645449421b44 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 11 Dec 2018 15:58:50 -0800 Subject: [PATCH 016/297] Add 2.1.7 package archive baselines --- .../ArchiveBaseline.2.1.7.txt | 206 ++++++++++++++++++ .../ArchiveBaseline.2.1.7.txt | 198 +++++++++++++++++ 2 files changed, 404 insertions(+) create mode 100644 src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.7.txt create mode 100644 src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.7.txt diff --git a/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.7.txt b/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.7.txt new file mode 100644 index 0000000000..3415c1024c --- /dev/null +++ b/src/PackageArchive/Archive.CiServer.Patch.Compat/ArchiveBaseline.2.1.7.txt @@ -0,0 +1,206 @@ +microsoft.extensions.platformabstractions\1.1.0\.signature.p7s +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Contracts.dll +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\microsoft.visualstudio.web.codegeneration.contracts.2.1.7.nupkg +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\microsoft.visualstudio.web.codegeneration.contracts.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\microsoft.visualstudio.web.codegeneration.contracts.nuspec +microsoft.visualstudio.web.codegeneration.core\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.core\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.core\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Core.dll +microsoft.visualstudio.web.codegeneration.core\2.1.7\microsoft.visualstudio.web.codegeneration.core.2.1.7.nupkg +microsoft.visualstudio.web.codegeneration.core\2.1.7\microsoft.visualstudio.web.codegeneration.core.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.core\2.1.7\microsoft.visualstudio.web.codegeneration.core.nuspec +microsoft.visualstudio.web.codegeneration.design\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.design\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.design\2.1.7\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.design\2.1.7\lib\netstandard2.0\dotnet-aspnet-codegenerator-design.dll +microsoft.visualstudio.web.codegeneration.design\2.1.7\microsoft.visualstudio.web.codegeneration.design.2.1.7.nupkg +microsoft.visualstudio.web.codegeneration.design\2.1.7\microsoft.visualstudio.web.codegeneration.design.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.design\2.1.7\microsoft.visualstudio.web.codegeneration.design.nuspec +microsoft.visualstudio.web.codegeneration.design\2.1.7\runtimes\win7-x64\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.design\2.1.7\runtimes\win7-x86\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.design\2.1.7\runtimes\win-arm\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.design\2.1.7\runtimes\win-arm64\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.dll +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.7.nupkg +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\microsoft.visualstudio.web.codegeneration.entityframeworkcore.nuspec +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\Templates\DbContext\NewLocalDbContext.cshtml +microsoft.visualstudio.web.codegeneration.templating\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.templating\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.templating\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Templating.dll +microsoft.visualstudio.web.codegeneration.templating\2.1.7\microsoft.visualstudio.web.codegeneration.templating.2.1.7.nupkg +microsoft.visualstudio.web.codegeneration.templating\2.1.7\microsoft.visualstudio.web.codegeneration.templating.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.templating\2.1.7\microsoft.visualstudio.web.codegeneration.templating.nuspec +microsoft.visualstudio.web.codegeneration.utils\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.utils\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.utils\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Utils.dll +microsoft.visualstudio.web.codegeneration.utils\2.1.7\microsoft.visualstudio.web.codegeneration.utils.2.1.7.nupkg +microsoft.visualstudio.web.codegeneration.utils\2.1.7\microsoft.visualstudio.web.codegeneration.utils.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.utils\2.1.7\microsoft.visualstudio.web.codegeneration.utils.nuspec +microsoft.visualstudio.web.codegeneration\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.dll +microsoft.visualstudio.web.codegeneration\2.1.7\microsoft.visualstudio.web.codegeneration.2.1.7.nupkg +microsoft.visualstudio.web.codegeneration\2.1.7\microsoft.visualstudio.web.codegeneration.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration\2.1.7\microsoft.visualstudio.web.codegeneration.nuspec +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\area.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\controller.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\identity.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\razorpage.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\view.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\lib\netstandard2.0\identitygeneratorfilesconfig.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\microsoft.visualstudio.web.codegenerators.mvc.2.1.7.nupkg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\microsoft.visualstudio.web.codegenerators.mvc.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\microsoft.visualstudio.web.codegenerators.mvc.nuspec +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\ApiControllerWithActions.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\ApiControllerWithContext.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\ApiEmptyController.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\ControllerWithActions.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\EmptyController.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\MvcControllerWithContext.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\_LoginPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Data\ApplicationDbContext.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Data\ApplicationUser.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\IdentityHostingStartup.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\_Layout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\_ValidationScriptsPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\_ViewImports.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\_ViewStart.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account._ViewImports.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.AccessDenied.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.AccessDenied.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ConfirmEmail.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ConfirmEmail.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ExternalLogin.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ExternalLogin.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ForgotPassword.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ForgotPassword.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ForgotPasswordConfirmation.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ForgotPasswordConfirmation.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Lockout.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Lockout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Login.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Login.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.LoginWith2fa.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.LoginWith2fa.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.LoginWithRecoveryCode.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.LoginWithRecoveryCode.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Logout.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Logout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Register.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Register.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ResetPassword.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ResetPassword.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ResetPasswordConfirmation.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ResetPasswordConfirmation.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage._Layout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage._ManageNav.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage._StatusMessage.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage._ViewImports.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ChangePassword.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ChangePassword.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.DeletePersonalData.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.DeletePersonalData.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.Disable2fa.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.Disable2fa.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.DownloadPersonalData.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.DownloadPersonalData.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.EnableAuthenticator.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.EnableAuthenticator.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ExternalLogins.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ExternalLogins.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.GenerateRecoveryCodes.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.GenerateRecoveryCodes.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.Index.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.Index.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ManageNavPages.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.PersonalData.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.PersonalData.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ResetAuthenticator.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ResetAuthenticator.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.SetPassword.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.SetPassword.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ShowRecoveryCodes.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ShowRecoveryCodes.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.TwoFactorAuthentication.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.TwoFactorAuthentication.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Error.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Error.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\ScaffoldingReadme.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\SupportPages._CookieConsentPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\SupportPages._ViewImports.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\SupportPages._ViewStart.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\css\site.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\css\site.min.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\favicon.ico +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\images\banner1.svg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\images\banner2.svg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\images\banner3.svg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\js\site.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\js\site.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\.bower.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap.css.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap.min.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap.min.css.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap-theme.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap-theme.css.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap-theme.min.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap-theme.min.css.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.eot +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.svg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.ttf +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.woff +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.woff2 +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\js\bootstrap.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\js\bootstrap.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\js\npm.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\LICENSE +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\.bower.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\dist\jquery.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\dist\jquery.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\dist\jquery.min.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\LICENSE.txt +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\.bower.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\dist\additional-methods.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\dist\additional-methods.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\dist\jquery.validate.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\dist\jquery.validate.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\LICENSE.md +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation-unobtrusive\.bower.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation-unobtrusive\LICENSE.txt +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\MvcLayout\_Layout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\MvcLayout\Error.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\_ValidationScriptsPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Create.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\CreatePageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Delete.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\DeletePageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Details.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\DetailsPageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Edit.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\EditPageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Empty.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\EmptyPageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\List.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\ListPageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Startup\ReadMe.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Startup\Startup.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\_ValidationScriptsPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Create.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Delete.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Details.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Edit.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Empty.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\List.cshtml +system.composition.hosting\1.0.31\.signature.p7s +system.composition\1.0.31\.signature.p7s diff --git a/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.7.txt b/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.7.txt new file mode 100644 index 0000000000..0875cca7d0 --- /dev/null +++ b/src/PackageArchive/Archive.CiServer.Patch/ArchiveBaseline.2.1.7.txt @@ -0,0 +1,198 @@ +microsoft.extensions.platformabstractions\1.1.0\.signature.p7s +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Contracts.dll +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\microsoft.visualstudio.web.codegeneration.contracts.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.contracts\2.1.7\microsoft.visualstudio.web.codegeneration.contracts.nuspec +microsoft.visualstudio.web.codegeneration.core\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.core\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.core\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Core.dll +microsoft.visualstudio.web.codegeneration.core\2.1.7\microsoft.visualstudio.web.codegeneration.core.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.core\2.1.7\microsoft.visualstudio.web.codegeneration.core.nuspec +microsoft.visualstudio.web.codegeneration.design\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.design\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.design\2.1.7\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.design\2.1.7\lib\netstandard2.0\dotnet-aspnet-codegenerator-design.dll +microsoft.visualstudio.web.codegeneration.design\2.1.7\microsoft.visualstudio.web.codegeneration.design.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.design\2.1.7\microsoft.visualstudio.web.codegeneration.design.nuspec +microsoft.visualstudio.web.codegeneration.design\2.1.7\runtimes\win7-x64\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.design\2.1.7\runtimes\win7-x86\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.design\2.1.7\runtimes\win-arm\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.design\2.1.7\runtimes\win-arm64\lib\net461\dotnet-aspnet-codegenerator-design.exe +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.EntityFrameworkCore.dll +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\microsoft.visualstudio.web.codegeneration.entityframeworkcore.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\microsoft.visualstudio.web.codegeneration.entityframeworkcore.nuspec +microsoft.visualstudio.web.codegeneration.entityframeworkcore\2.1.7\Templates\DbContext\NewLocalDbContext.cshtml +microsoft.visualstudio.web.codegeneration.templating\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.templating\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.templating\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Templating.dll +microsoft.visualstudio.web.codegeneration.templating\2.1.7\microsoft.visualstudio.web.codegeneration.templating.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.templating\2.1.7\microsoft.visualstudio.web.codegeneration.templating.nuspec +microsoft.visualstudio.web.codegeneration.utils\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration.utils\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration.utils\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.Utils.dll +microsoft.visualstudio.web.codegeneration.utils\2.1.7\microsoft.visualstudio.web.codegeneration.utils.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration.utils\2.1.7\microsoft.visualstudio.web.codegeneration.utils.nuspec +microsoft.visualstudio.web.codegeneration\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegeneration\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegeneration\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGeneration.dll +microsoft.visualstudio.web.codegeneration\2.1.7\microsoft.visualstudio.web.codegeneration.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegeneration\2.1.7\microsoft.visualstudio.web.codegeneration.nuspec +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\.nupkg.metadata +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\.signature.p7s +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\area.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\controller.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\identity.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\razorpage.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Generators\ParameterDefinitions\view.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\lib\netstandard2.0\identitygeneratorfilesconfig.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\lib\netstandard2.0\Microsoft.VisualStudio.Web.CodeGenerators.Mvc.dll +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\microsoft.visualstudio.web.codegenerators.mvc.2.1.7.nupkg.sha512 +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\microsoft.visualstudio.web.codegenerators.mvc.nuspec +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\ApiControllerWithActions.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\ApiControllerWithContext.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\ApiEmptyController.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\ControllerWithActions.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\EmptyController.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ControllerGenerator\MvcControllerWithContext.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\_LoginPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Data\ApplicationDbContext.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Data\ApplicationUser.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\IdentityHostingStartup.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\_Layout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\_ValidationScriptsPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\_ViewImports.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\_ViewStart.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account._ViewImports.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.AccessDenied.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.AccessDenied.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ConfirmEmail.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ConfirmEmail.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ExternalLogin.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ExternalLogin.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ForgotPassword.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ForgotPassword.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ForgotPasswordConfirmation.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ForgotPasswordConfirmation.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Lockout.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Lockout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Login.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Login.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.LoginWith2fa.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.LoginWith2fa.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.LoginWithRecoveryCode.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.LoginWithRecoveryCode.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Logout.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Logout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Register.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.Register.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ResetPassword.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ResetPassword.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ResetPasswordConfirmation.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Account.ResetPasswordConfirmation.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage._Layout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage._ManageNav.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage._StatusMessage.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage._ViewImports.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ChangePassword.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ChangePassword.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.DeletePersonalData.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.DeletePersonalData.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.Disable2fa.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.Disable2fa.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.DownloadPersonalData.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.DownloadPersonalData.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.EnableAuthenticator.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.EnableAuthenticator.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ExternalLogins.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ExternalLogins.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.GenerateRecoveryCodes.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.GenerateRecoveryCodes.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.Index.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.Index.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ManageNavPages.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.PersonalData.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.PersonalData.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ResetAuthenticator.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ResetAuthenticator.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.SetPassword.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.SetPassword.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ShowRecoveryCodes.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.ShowRecoveryCodes.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.TwoFactorAuthentication.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Account\Manage\Account.Manage.TwoFactorAuthentication.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Error.cs.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\Pages\Error.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\ScaffoldingReadme.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\SupportPages._CookieConsentPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\SupportPages._ViewImports.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\SupportPages._ViewStart.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\css\site.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\css\site.min.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\favicon.ico +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\images\banner1.svg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\images\banner2.svg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\images\banner3.svg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\js\site.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\js\site.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\.bower.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap.css.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap.min.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap.min.css.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap-theme.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap-theme.css.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap-theme.min.css +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\css\bootstrap-theme.min.css.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.eot +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.svg +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.ttf +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.woff +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\fonts\glyphicons-halflings-regular.woff2 +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\js\bootstrap.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\js\bootstrap.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\dist\js\npm.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\bootstrap\LICENSE +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\.bower.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\dist\jquery.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\dist\jquery.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\dist\jquery.min.map +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery\LICENSE.txt +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\.bower.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\dist\additional-methods.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\dist\additional-methods.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\dist\jquery.validate.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\dist\jquery.validate.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation\LICENSE.md +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation-unobtrusive\.bower.json +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation-unobtrusive\jquery.validate.unobtrusive.min.js +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Identity\wwwroot\lib\jquery-validation-unobtrusive\LICENSE.txt +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\MvcLayout\_Layout.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\MvcLayout\Error.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\_ValidationScriptsPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Create.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\CreatePageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Delete.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\DeletePageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Details.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\DetailsPageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Edit.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\EditPageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\Empty.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\EmptyPageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\List.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\RazorPageGenerator\ListPageModel.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Startup\ReadMe.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\Startup\Startup.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\_ValidationScriptsPartial.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Create.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Delete.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Details.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Edit.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\Empty.cshtml +microsoft.visualstudio.web.codegenerators.mvc\2.1.7\Templates\ViewGenerator\List.cshtml +system.composition.hosting\1.0.31\.signature.p7s +system.composition\1.0.31\.signature.p7s From 38785d0be9a32e30e0f7ed3a1474aa95353ff84d Mon Sep 17 00:00:00 2001 From: dotnet-maestro-bot Date: Tue, 11 Dec 2018 16:13:20 -0800 Subject: [PATCH 017/297] [automated] Merge branch 'release/2.1' => 'release/2.2' (#4577) * Workaround problems when opening solution files in Visual Studio (#4569) Changes: * Condense Routing.sln into HttpAbstractions.sln * Workaround NU1105 by adding all ProjectReferences to the .sln * Workaround exceptions in the ReferencesHostBridge by moving Reference items to a temporary item group * Add a 'startvs.cmd' script for launching VS with the right env variables * Remove RangeHelper test project * Move RangeHelper tests into StaticFiles.Tests and add target for NPM restore * Convert Session to use Reference and move to Middleware folder (#4576) * Add RoutingSample.Web to HttpAbstractions.sln --- build/buildorder.props | 1 - build/repo.props | 7 + build/submodules.props | 1 - docs/BuildFromSource.md | 95 +++++-- eng/Baseline.Designer.props | 11 + eng/Baseline.xml | 1 + eng/Dependencies.props | 2 + eng/ProjectReferences.props | 1 + eng/targets/CSharp.Common.targets | 6 + eng/targets/ResolveReferences.targets | 8 +- src/DataProtection/startvs.cmd | 3 + src/Http/HttpAbstractions.sln | 235 ++++++++++++++++-- src/Http/Routing.sln | 185 -------------- .../src/Microsoft.AspNetCore.Routing.csproj | 1 + src/Http/startvs.cmd | 3 + .../CorsMiddlewareTests.cs | 0 .../{Test => UnitTests}/CorsOptionsTest.cs | 0 .../CorsPolicyBuilderTests.cs | 0 .../CorsPolicyExtensionsTests.cs | 0 .../{Test => UnitTests}/CorsPolicyTests.cs | 0 .../{Test => UnitTests}/CorsResultTests.cs | 0 .../{Test => UnitTests}/CorsServiceTests.cs | 0 .../DefaultCorsPolicyProviderTests.cs | 0 .../Microsoft.AspNetCore.Cors.Test.csproj | 0 .../{Test => UnitTests}/UriHelpersTests.cs | 0 src/Middleware/Middleware.sln | 188 ++++++++++++-- .../Session/samples/SessionSample.csproj | 17 ++ .../Session/samples}/Startup.cs | 0 .../Session/src}/CookieProtection.cs | 0 .../Session/src}/DistributedSession.cs | 0 .../Session/src}/DistributedSessionStore.cs | 0 .../Session/src}/EncodedKey.cs | 0 .../Session/src}/ISessionStore.cs | 0 .../Session/src}/LoggingExtensions.cs | 0 .../src/Microsoft.AspNetCore.Session.csproj | 20 ++ .../Session/src}/NoOpSessionStore.cs | 0 .../src}/Properties/Resources.Designer.cs | 0 .../Session/src}/Resources.resx | 0 .../Session/src}/SessionDefaults.cs | 0 .../Session/src}/SessionFeature.cs | 0 .../Session/src}/SessionMiddleware.cs | 0 .../src}/SessionMiddlewareExtensions.cs | 0 .../Session/src}/SessionOptions.cs | 0 .../SessionServiceCollectionExtensions.cs | 0 .../Session/src}/SipHash.cs | 0 .../Session/src}/baseline.netcore.json | 0 .../Microsoft.AspNetCore.Session.Tests.csproj | 14 ++ .../Session/test}/SessionTests.cs | 0 .../Microsoft.AspNetCore.StaticFiles.csproj | 2 +- ...AspNetCore.RangeHelper.Sources.Test.csproj | 17 -- .../{Tests => UnitTests}/CacheHeaderTests.cs | 0 .../DefaultContentTypeProviderTests.cs | 0 .../DefaultFilesMiddlewareTests.cs | 0 .../DirectoryBrowserMiddlewareTests.cs | 0 ...rosoft.AspNetCore.StaticFiles.Tests.csproj | 1 - .../{Tests => UnitTests}/RangeHeaderTests.cs | 0 .../RangeHelperTests.cs | 0 .../StaticFileContextTest.cs | 0 .../StaticFileMiddlewareTests.cs | 0 .../StaticFilesTestServer.cs | 0 .../{Tests => UnitTests}/SubFolder/Empty.txt | 0 .../SubFolder/SingleByte.txt | 0 .../SubFolder/default.html | 0 .../{Tests => UnitTests}/SubFolder/extra.xml | 0 .../{Tests => UnitTests}/SubFolder/ranges.txt | 0 .../SubFolder/你好/default.html | 0 .../SubFolder/你好/世界/default.html | 0 .../{Tests => UnitTests}/TestDocument.txt | 0 src/Middleware/startvs.cmd | 3 + src/Servers/Kestrel.sln | 82 ++++++ src/Servers/startvs.cmd | 3 + src/Session/.gitignore | 33 --- src/Session/Directory.Build.props | 20 -- src/Session/Directory.Build.targets | 10 - src/Session/NuGetPackageVerifier.json | 7 - src/Session/README.md | 12 - src/Session/Session.sln | 74 ------ src/Session/build/Key.snk | Bin 596 -> 0 bytes src/Session/build/dependencies.props | 30 --- src/Session/build/repo.props | 9 - src/Session/build/sources.props | 17 -- .../Properties/launchSettings.json | 27 -- .../SessionSample/SessionSample.csproj | 20 -- src/Session/src/Directory.Build.props | 7 - .../Microsoft.AspNetCore.Session.csproj | 20 -- src/Session/test/Directory.Build.props | 14 -- .../Microsoft.AspNetCore.Session.Tests.csproj | 22 -- src/Session/version.props | 12 - startvs.cmd | 32 +++ 89 files changed, 670 insertions(+), 603 deletions(-) create mode 100644 src/DataProtection/startvs.cmd delete mode 100644 src/Http/Routing.sln create mode 100644 src/Http/startvs.cmd rename src/Middleware/CORS/test/{Test => UnitTests}/CorsMiddlewareTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsOptionsTest.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsPolicyBuilderTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsPolicyExtensionsTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsPolicyTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsResultTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/CorsServiceTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/DefaultCorsPolicyProviderTests.cs (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/Microsoft.AspNetCore.Cors.Test.csproj (100%) rename src/Middleware/CORS/test/{Test => UnitTests}/UriHelpersTests.cs (100%) create mode 100644 src/Middleware/Session/samples/SessionSample.csproj rename src/{Session/samples/SessionSample => Middleware/Session/samples}/Startup.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/CookieProtection.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/DistributedSession.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/DistributedSessionStore.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/EncodedKey.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/ISessionStore.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/LoggingExtensions.cs (100%) create mode 100644 src/Middleware/Session/src/Microsoft.AspNetCore.Session.csproj rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/NoOpSessionStore.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/Properties/Resources.Designer.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/Resources.resx (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/SessionDefaults.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/SessionFeature.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/SessionMiddleware.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/SessionMiddlewareExtensions.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/SessionOptions.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/SessionServiceCollectionExtensions.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/SipHash.cs (100%) rename src/{Session/src/Microsoft.AspNetCore.Session => Middleware/Session/src}/baseline.netcore.json (100%) create mode 100644 src/Middleware/Session/test/Microsoft.AspNetCore.Session.Tests.csproj rename src/{Session/test/Microsoft.AspNetCore.Session.Tests => Middleware/Session/test}/SessionTests.cs (100%) delete mode 100644 src/Middleware/StaticFiles/test/RangeHelper.Sources.Test/Microsoft.AspNetCore.RangeHelper.Sources.Test.csproj rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/CacheHeaderTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/DefaultContentTypeProviderTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/DefaultFilesMiddlewareTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/DirectoryBrowserMiddlewareTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/Microsoft.AspNetCore.StaticFiles.Tests.csproj (89%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/RangeHeaderTests.cs (100%) rename src/Middleware/StaticFiles/test/{RangeHelper.Sources.Test => UnitTests}/RangeHelperTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/StaticFileContextTest.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/StaticFileMiddlewareTests.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/StaticFilesTestServer.cs (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/Empty.txt (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/SingleByte.txt (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/default.html (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/extra.xml (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/ranges.txt (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/你好/default.html (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/SubFolder/你好/世界/default.html (100%) rename src/Middleware/StaticFiles/test/{Tests => UnitTests}/TestDocument.txt (100%) create mode 100644 src/Middleware/startvs.cmd create mode 100644 src/Servers/startvs.cmd delete mode 100644 src/Session/.gitignore delete mode 100644 src/Session/Directory.Build.props delete mode 100644 src/Session/Directory.Build.targets delete mode 100644 src/Session/NuGetPackageVerifier.json delete mode 100644 src/Session/README.md delete mode 100644 src/Session/Session.sln delete mode 100644 src/Session/build/Key.snk delete mode 100644 src/Session/build/dependencies.props delete mode 100644 src/Session/build/repo.props delete mode 100644 src/Session/build/sources.props delete mode 100644 src/Session/samples/SessionSample/Properties/launchSettings.json delete mode 100644 src/Session/samples/SessionSample/SessionSample.csproj delete mode 100644 src/Session/src/Directory.Build.props delete mode 100644 src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj delete mode 100644 src/Session/test/Directory.Build.props delete mode 100644 src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj delete mode 100644 src/Session/version.props create mode 100644 startvs.cmd diff --git a/build/buildorder.props b/build/buildorder.props index 25c647ca23..21999af70f 100644 --- a/build/buildorder.props +++ b/build/buildorder.props @@ -10,7 +10,6 @@ - diff --git a/build/repo.props b/build/repo.props index 9b0b4585d7..f96466ea7b 100644 --- a/build/repo.props +++ b/build/repo.props @@ -56,6 +56,13 @@ + + + - diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md index aee68a11f0..0a95e6cd55 100644 --- a/docs/BuildFromSource.md +++ b/docs/BuildFromSource.md @@ -1,16 +1,11 @@ Build ASP.NET Core from Source ============================== -Building ASP.NET Core from source allows you tweak and customize ASP.NET Core, and -to contribute your improvements back to the project. +Building ASP.NET Core from source allows you tweak and customize ASP.NET Core, and to contribute your improvements back to the project. -## :warning: Temporary instructions +:warning: We are currently in the middle of restructing our source code. These instructions will likely change rapidly during November and December 2018. -We are currently in the middle of restructing our repositories. While this work is being done, the following instructions will help you be more productive while working on this repo. - -1. Before opening a solution, run `build.cmd /p:_ProjectsOnly=true /p:SkipTests=true`. This will only build the projects which have merged into this repo, not the git submodules. -2. Use (or create) a solution which is scoped to your project file. The build system does not use .sln files. These only exist for developer productivity in Visual Studio, so feel free to adjust the projects in .sln files to match your workload. -3. Questions? Contact @aspnet for help. +See https://github.com/aspnet/AspNetCore/labels/area-infrastructure for known issues and to track ongoing work. ## Install pre-requistes @@ -58,22 +53,66 @@ git submodule update --init --recursive ## Building in Visual Studio / Code -Before opening our .sln files in Visual Studio or VS Code, executing the following on command-line: -``` -.\build.cmd /t:Restore -``` -This will download required tools. +Before opening our .sln files in Visual Studio or VS Code, you need to perform the following actions. + +1. Executing the following on command-line: + ``` + .\build.cmd /p:SkipTests=true /p:_ProjectsOnly=true + ``` + This will download required tools and build the entire repository once. At that point, you should be able to open .sln files to work on the projects you care about. + +2. Use the `startvs.cmd` script to open Visual Studio .sln files. This script first sets required environment variables. + +> :bulb: Pro tip: you will also want to run this command after pulling large sets of changes. Visual Studio will only build projects in a solution file, and makes a best effort to use other files on disk. If you pull many changes, the files on disk may be stale and will need to re-build. + +### Solution files + +We don't have a single .sln file for all of ASP.NET Core because Visual Studio doesn't currently handle projects of this scale. +Instead, we have many .sln files which include a sub-set of projects. These principles guide how we create and manage .slns: + +1. Solution files are not used by CI or command line build scripts. They are for meant for use by developers only. +2. Solution files group together projects which are frequently edited at the same time. +3. Can't find a solution that has the projects you care about? Feel free to make a PR to add a new .sln file. + +> :bulb: Pro tip: `dotnet new sln` and `dotnet sln` are one of the easiest ways to create and modify solutions. + +### Known issue: NU1105 + +Opening solution files may produce an error code NU1105 with a message such + +> Unable to find project information for 'C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj'. Inside Visual Studio, this may be because the project is unloaded or not part of current solution. Otherwise the project file may be invalid or missing targets required for restore. + +This is a known issue in NuGet () and we are working with them for a solution. See also to track progress on this. + +**The workaround** for now is to add all projects to the solution. + + dotnet sln add C:\src\AspNetCore\src\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj + #### PATH -For VS Code and Visual Studio to work correctly, you must place the following location in your PATH. -``` -Windows: %USERPROFILE%\.dotnet\x64 -Linux/macOS: $HOME/.dotnet -``` -This must come **before** any other installation of `dotnet`. In Windows, we recommend removing `C:\Program Files\dotnet` from PATH in system variables and adding `%USERPROFILE%\.dotnet\x64` to PATH in user variables. +For VS Code and Visual Studio and `dotnet` commands to work correctly, you must place the following location in your PATH. +Use the following commands to update the PATH variable in a command line window. - +Windows (Command Prompt) + +```batch +set PATH=%USERPROFILE%\.dotnet\x64;%PATH% +``` + +Windows (Powershell) + +```ps1 +$env:PATH="$env:USERPROFILE\.dotnet\x64;$env:PATH" +``` + +Linux/macOS: + +```sh +export PATH="$HOME/.dotnet:$PATH" +``` + +On Windows, we recommend using the `startvs.cmd` command to launch Visual Studio. ## Building on command-line @@ -89,6 +128,14 @@ On macOS/Linux: ./build.sh ``` +### Building a subset of the code + +This repository is large. Look for `build.cmd`/`.sh` scripts in subfolders. These scripts can be used to invoke build and test on a smaller set of projects. + +#### Known issue: not every subfolder has a build.cmd script + +We'll be adding more. See https://github.com/aspnet/AspNetCore/issues/4247. + #### Build properties Additional properties can be added as an argument in the form `/property:$name=$value`, or `/p:$name=$value` for short. For example: @@ -99,8 +146,8 @@ Additional properties can be added as an argument in the form `/property:$name=$ Common properties include: Property | Description --------------------------|--------------------------------------------------------- -BuildNumber | (string). A specific build number, typically from a CI counter +-------------------------|------------------------------------------------------------------------------------------------------------- +BuildNumberSuffix | (string). A specific build number, typically from a CI counter, which is appended to the pre-release label. Configuration | `Debug` or `Release`. Default = `Debug`. SkipTests | `true` or `false`. When true, builds without running tests. NoBuild | `true` or `false`. Runs tests without rebuilding. @@ -109,7 +156,7 @@ NoBuild | `true` or `false`. Runs tests without rebuilding. After building ASP.NET Core from source, you will need to install and use your local version of ASP.NET Core. -- Run the installers produced in `artifacts/installers/` for your platform. +- Run the installers produced in `artifacts/{Debug, Release}/installers/` for your platform. - Add a NuGet.Config to your project directory with the following content: ```xml @@ -128,7 +175,7 @@ After building ASP.NET Core from source, you will need to install and use your l - Update the versions on `PackageReference` items in your .csproj project file to point to the version from your local build. ```xml - + ``` diff --git a/eng/Baseline.Designer.props b/eng/Baseline.Designer.props index 4c1e38844d..8f5460b224 100644 --- a/eng/Baseline.Designer.props +++ b/eng/Baseline.Designer.props @@ -509,6 +509,17 @@ + + + 2.2.0 + + + + + + + + 2.2.0 diff --git a/eng/Baseline.xml b/eng/Baseline.xml index d88dbac121..97364fe67c 100644 --- a/eng/Baseline.xml +++ b/eng/Baseline.xml @@ -52,6 +52,7 @@ + diff --git a/eng/Dependencies.props b/eng/Dependencies.props index 48dbf486dd..1c132cfb36 100644 --- a/eng/Dependencies.props +++ b/eng/Dependencies.props @@ -19,6 +19,8 @@ + + diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index e8ca163451..c02c9991e9 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -41,6 +41,7 @@ + diff --git a/eng/targets/CSharp.Common.targets b/eng/targets/CSharp.Common.targets index a7f7b610b6..8df4213c62 100644 --- a/eng/targets/CSharp.Common.targets +++ b/eng/targets/CSharp.Common.targets @@ -1,5 +1,11 @@ + + + net$(TargetFrameworkVersion.Substring(1).Replace('.','')) + .NETFramework + + diff --git a/eng/targets/ResolveReferences.targets b/eng/targets/ResolveReferences.targets index 897a906869..675b0efa18 100644 --- a/eng/targets/ResolveReferences.targets +++ b/eng/targets/ResolveReferences.targets @@ -46,12 +46,18 @@ + + + <_ReferenceTemp Include="@(Reference)" /> + - + + <_ReferenceTemp Remove="@(_ReferenceTemp)" /> + - 99.9 - - diff --git a/src/Session/NuGetPackageVerifier.json b/src/Session/NuGetPackageVerifier.json deleted file mode 100644 index b153ab1515..0000000000 --- a/src/Session/NuGetPackageVerifier.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "Default": { - "rules": [ - "DefaultCompositeRule" - ] - } -} \ No newline at end of file diff --git a/src/Session/README.md b/src/Session/README.md deleted file mode 100644 index 976f9f21cf..0000000000 --- a/src/Session/README.md +++ /dev/null @@ -1,12 +0,0 @@ -Session -================ - -AppVeyor: [![AppVeyor](https://ci.appveyor.com/api/projects/status/yyivj6uwu3uj2x40/branch/dev?svg=true)](https://ci.appveyor.com/project/aspnetci/Session/branch/dev) - -Travis: [![Travis](https://travis-ci.org/aspnet/Session.svg?branch=dev)](https://travis-ci.org/aspnet/Session) - -Contains libraries for session state middleware for ASP.NET Core. - -For ASP.NET 4.x session state, please go to https://github.com/aspnet/AspNetSessionState. - -This project is part of ASP.NET Core. You can find samples, documentation and getting started instructions for ASP.NET Core at the [Home](https://github.com/aspnet/home) repo. diff --git a/src/Session/Session.sln b/src/Session/Session.sln deleted file mode 100644 index d8d95dc295..0000000000 --- a/src/Session/Session.sln +++ /dev/null @@ -1,74 +0,0 @@ -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.26621.2 -MinimumVisualStudioVersion = 15.0.26730.03 -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{E9D63F97-6078-42AD-BFD3-F956BF921BB5}" - ProjectSection(SolutionItems) = preProject - test\Directory.Build.props = test\Directory.Build.props - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{A189F10C-3A9C-4F81-83D0-32E5FE50DAD8}" - ProjectSection(SolutionItems) = preProject - src\Directory.Build.props = src\Directory.Build.props - EndProjectSection -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session", "src\Microsoft.AspNetCore.Session\Microsoft.AspNetCore.Session.csproj", "{71802736-F640-4733-9671-02D267EDD76A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Session.Tests", "test\Microsoft.AspNetCore.Session.Tests\Microsoft.AspNetCore.Session.Tests.csproj", "{8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SessionSample", "samples\SessionSample\SessionSample.csproj", "{FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionItems", "SolutionItems", "{3B45F658-5BF1-4E07-BE9C-6F5110AC2277}" - ProjectSection(SolutionItems) = preProject - .appveyor.yml = .appveyor.yml - .gitattributes = .gitattributes - .gitignore = .gitignore - .travis.yml = .travis.yml - Directory.Build.props = Directory.Build.props - Directory.Build.targets = Directory.Build.targets - NuGet.config = NuGet.config - NuGetPackageVerifier.json = NuGetPackageVerifier.json - README.md = README.md - version.xml = version.xml - EndProjectSection -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{4F21221F-2813-41B7-AAFC-E03FD52971CC}" - ProjectSection(SolutionItems) = preProject - build\common.props = build\common.props - build\dependencies.props = build\dependencies.props - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {71802736-F640-4733-9671-02D267EDD76A}.Release|Any CPU.Build.0 = Release|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Debug|Any CPU.Build.0 = Debug|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.ActiveCfg = Release|Any CPU - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639}.Release|Any CPU.Build.0 = Release|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {71802736-F640-4733-9671-02D267EDD76A} = {A189F10C-3A9C-4F81-83D0-32E5FE50DAD8} - {8C131A0A-BC1A-4CF3-8B77-8813FBFE5639} = {E9D63F97-6078-42AD-BFD3-F956BF921BB5} - {FE0B9969-3BDE-4A7D-BE1B-47EAE8DBF365} = {94E80ED2-9F27-40AC-A9EF-C707BDFAA3BE} - {4F21221F-2813-41B7-AAFC-E03FD52971CC} = {3B45F658-5BF1-4E07-BE9C-6F5110AC2277} - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {6AE224B9-B604-4E47-9617-9D114DAE9BE5} - EndGlobalSection -EndGlobal diff --git a/src/Session/build/Key.snk b/src/Session/build/Key.snk deleted file mode 100644 index e10e4889c125d3120cd9e81582243d70f7cbb806..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 596 zcmV-a0;~N80ssI2Bme+XQ$aES1ONa50098=Iw=HCsnz~#iVhm& zj%TU(_THUee?3yHBjk$37ysB?i5#7WD$={H zV4B!OxRPrb|8)HPg~A}8P>^=#y<)56#=E&NzcjOtPK~<4n6GHt=K$ro*T(lhby_@U zEk(hLzk1H)0yXj{A_5>fk-TgNoP|q6(tP2xo8zt8i%212CWM#AeCd?`hS|4~L({h~Moo(~vy&3Z z1uI}`fd^*>o=rwbAGymj6RM^pZm(*Kfhs+Y1#`-2JPWZMK8@;ZWCk2+9bX4YP);~fj-BU*R zQPvWv$89!{Rl9wM+zR>_TSkn^voYxA?2G iKnV#iZ6Ah`K>b=@=IjYJXrxL124zR(38)nxe+&q_$QXwJ diff --git a/src/Session/build/dependencies.props b/src/Session/build/dependencies.props deleted file mode 100644 index 78eb063ed4..0000000000 --- a/src/Session/build/dependencies.props +++ /dev/null @@ -1,30 +0,0 @@ - - - $(MSBuildAllProjects);$(MSBuildThisFileFullPath) - - - 2.2.0-preview2-20181004.6 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.2.0-preview3-35425 - 2.0.9 - 2.1.3 - 2.2.0-preview3-27001-02 - 15.6.1 - 2.0.3 - 2.3.1 - 2.4.0 - - - - diff --git a/src/Session/build/repo.props b/src/Session/build/repo.props deleted file mode 100644 index e3e0fa123b..0000000000 --- a/src/Session/build/repo.props +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/src/Session/build/sources.props b/src/Session/build/sources.props deleted file mode 100644 index 9215df9751..0000000000 --- a/src/Session/build/sources.props +++ /dev/null @@ -1,17 +0,0 @@ - - - - - $(DotNetRestoreSources) - - $(RestoreSources); - https://dotnet.myget.org/F/dotnet-core/api/v3/index.json; - https://dotnet.myget.org/F/aspnetcore-dev/api/v3/index.json; - https://dotnet.myget.org/F/aspnetcore-tools/api/v3/index.json; - - - $(RestoreSources); - https://api.nuget.org/v3/index.json; - - - diff --git a/src/Session/samples/SessionSample/Properties/launchSettings.json b/src/Session/samples/SessionSample/Properties/launchSettings.json deleted file mode 100644 index 6bab3d3602..0000000000 --- a/src/Session/samples/SessionSample/Properties/launchSettings.json +++ /dev/null @@ -1,27 +0,0 @@ -{ - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:2481/", - "sslPort": 0 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "SessionSample": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} \ No newline at end of file diff --git a/src/Session/samples/SessionSample/SessionSample.csproj b/src/Session/samples/SessionSample/SessionSample.csproj deleted file mode 100644 index 103dffc357..0000000000 --- a/src/Session/samples/SessionSample/SessionSample.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - netcoreapp2.2;net461 - - - - - - - - - - - - - - - - diff --git a/src/Session/src/Directory.Build.props b/src/Session/src/Directory.Build.props deleted file mode 100644 index 1e0980f663..0000000000 --- a/src/Session/src/Directory.Build.props +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj b/src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj deleted file mode 100644 index 3da00b9032..0000000000 --- a/src/Session/src/Microsoft.AspNetCore.Session/Microsoft.AspNetCore.Session.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - ASP.NET Core session state middleware. - netstandard2.0 - $(NoWarn);CS1591 - true - true - aspnetcore;session;sessionstate - - - - - - - - - - - diff --git a/src/Session/test/Directory.Build.props b/src/Session/test/Directory.Build.props deleted file mode 100644 index 3a373e2cb8..0000000000 --- a/src/Session/test/Directory.Build.props +++ /dev/null @@ -1,14 +0,0 @@ - - - - - netcoreapp2.2 - $(DeveloperBuildTestTfms) - - $(StandardTestTfms);net461 - - - - - - diff --git a/src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj b/src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj deleted file mode 100644 index 9dc11b9d2f..0000000000 --- a/src/Session/test/Microsoft.AspNetCore.Session.Tests/Microsoft.AspNetCore.Session.Tests.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - $(StandardTestTfms) - true - true - - - - - - - - - - - - - - - - diff --git a/src/Session/version.props b/src/Session/version.props deleted file mode 100644 index 4889a26987..0000000000 --- a/src/Session/version.props +++ /dev/null @@ -1,12 +0,0 @@ - - - 2.2.0 - rtm - $(VersionPrefix) - $(VersionPrefix)-$(VersionSuffix)-final - t000 - a- - $(FeatureBranchVersionPrefix)$(VersionSuffix)-$([System.Text.RegularExpressions.Regex]::Replace('$(FeatureBranchVersionSuffix)', '[^\w-]', '-')) - $(VersionSuffix)-$(BuildNumber) - - diff --git a/startvs.cmd b/startvs.cmd new file mode 100644 index 0000000000..05cd3ebfda --- /dev/null +++ b/startvs.cmd @@ -0,0 +1,32 @@ +@ECHO OFF + +:: This command launches a Visual Studio solution with environment variables required to use a local version of the .NET Core SDK. + +IF "%DOTNET_HOME%"=="" ( + set DOTNET_HOME=%USERPROFILE%\.dotnet\x64 +) + +:: This tells .NET Core to use the same dotnet.exe that build scripts use +SET DOTNET_ROOT=%DOTNET_HOME% + +:: This tells .NET Core not to go looking for .NET Core in other places +SET DOTNET_MULTILEVEL_LOOKUP=0 + +:: Put our local dotnet.exe on PATH first so Visual Studio knows which one to use +SET PATH=%DOTNET_ROOT%;%PATH% + +SET sln=%1 + +IF NOT EXIST %DOTNET_ROOT%\dotnet.exe ( + echo .NET Core has not yet been installed. Run `build.cmd -restore` to install tools + exit /b 1 +) + +IF "%sln%"=="" ( + echo Error^: Expected argument ^ + echo Usage^: startvs.cmd ^ + + exit /b 1 +) + +start %sln% From ff385f71c592ff218956cfa3b1b0a184604b8409 Mon Sep 17 00:00:00 2001 From: Mikael Mengistu Date: Tue, 11 Dec 2018 16:22:06 -0800 Subject: [PATCH 018/297] Check connectionState in stop so we don't null ref (#4557) --- .../src/main/java/com/microsoft/signalr/HubConnection.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java b/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java index 5b255ec9bd..2ad841d798 100644 --- a/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java +++ b/src/SignalR/clients/java/signalr/src/main/java/com/microsoft/signalr/HubConnection.java @@ -436,8 +436,11 @@ public class HubConnection { exception = new RuntimeException(errorMessage); logger.error("HubConnection disconnected with an error {}.", errorMessage); } - connectionState.cancelOutstandingInvocations(exception); - connectionState = null; + if (connectionState != null) { + connectionState.cancelOutstandingInvocations(exception); + connectionState = null; + } + logger.info("HubConnection stopped."); hubConnectionState = HubConnectionState.DISCONNECTED; handshakeResponseSubject.onComplete(); From 19276ce01c24682049481bb76d991caa9c5b9af3 Mon Sep 17 00:00:00 2001 From: Kahbazi Date: Mon, 10 Dec 2018 00:04:59 +0330 Subject: [PATCH 019/297] Remove nameof from log events --- .../MvcCoreLoggerExtensions.cs | 2 +- .../CorsLoggerExtensions.cs | 2 +- .../MvcJsonLoggerExtensions.cs | 4 +-- .../LoggerExtensions.cs | 4 +-- .../MvcRazorLoggerExtensions.cs | 30 ++++++++--------- .../PageLoggerExtensions.cs | 18 +++++------ .../MvcTagHelpersLoggerExtensions.cs | 2 +- .../MvcViewFeaturesLoggerExtensions.cs | 32 +++++++++---------- 8 files changed, 47 insertions(+), 47 deletions(-) diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreLoggerExtensions.cs index 51d5142bc1..65e56e1ef5 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreLoggerExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Core/MvcCoreLoggerExtensions.cs @@ -652,7 +652,7 @@ namespace Microsoft.AspNetCore.Mvc _transformingClientError = LoggerMessage.Define( LogLevel.Trace, - new EventId(49, nameof(Infrastructure.ClientErrorResultFilter)), + new EventId(49, "ClientErrorResultFilter"), "Replacing {InitialActionResultType} with status code {StatusCode} with {ReplacedActionResultType}."); } diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsLoggerExtensions.cs index 39eb058613..2dda618959 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsLoggerExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Cors/CorsLoggerExtensions.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.Cors { _notMostEffectiveFilter = LoggerMessage.Define( LogLevel.Debug, - new EventId(1, nameof(NotMostEffectiveFilter)), + new EventId(1, "NotMostEffectiveFilter"), "Skipping the execution of current filter as its not the most effective filter implementing the policy {FilterPolicy}."); } diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonLoggerExtensions.cs index 559e0aec93..8ca8f2ed30 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonLoggerExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Json/MvcJsonLoggerExtensions.cs @@ -16,12 +16,12 @@ namespace Microsoft.AspNetCore.Mvc.Formatters { _jsonInputFormatterCrashed = LoggerMessage.Define( LogLevel.Debug, - new EventId(1, nameof(JsonInputException)), + new EventId(1, "JsonInputException"), "JSON input formatter threw an exception."); _jsonResultExecuting = LoggerMessage.Define( LogLevel.Information, - new EventId(1, nameof(JsonResultExecuting)), + new EventId(1, "JsonResultExecuting"), "Executing JsonResult, writing value of type '{Type}'."); } diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/LoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/LoggerExtensions.cs index 80f5c2d03f..3bb43de3c1 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/LoggerExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Formatters.Xml/LoggerExtensions.cs @@ -15,12 +15,12 @@ namespace Microsoft.AspNetCore.Mvc.Formatters.Xml { _failedToCreateXmlSerializer = LoggerMessage.Define( LogLevel.Warning, - new EventId(1, nameof(FailedToCreateXmlSerializer)), + new EventId(1, "FailedToCreateXmlSerializer"), "An error occurred while trying to create an XmlSerializer for the type '{Type}'."); _failedToCreateDataContractSerializer = LoggerMessage.Define( LogLevel.Warning, - new EventId(2, nameof(FailedToCreateDataContractSerializer)), + new EventId(2, "FailedToCreateDataContractSerializer"), "An error occurred while trying to create a DataContractSerializer for the type '{Type}'."); } diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorLoggerExtensions.cs index 39072cb1d7..4a11e49085 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorLoggerExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.Razor/MvcRazorLoggerExtensions.cs @@ -36,27 +36,27 @@ namespace Microsoft.AspNetCore.Mvc.Razor { _viewCompilerStartCodeGeneration = LoggerMessage.Define( LogLevel.Debug, - new EventId(1, nameof(ViewCompilerStartCodeGeneration)), + new EventId(1, "ViewCompilerStartCodeGeneration"), "Code generation for the Razor file at '{FilePath}' started."); _viewCompilerEndCodeGeneration = LoggerMessage.Define( LogLevel.Debug, - new EventId(2, nameof(ViewCompilerEndCodeGeneration)), + new EventId(2, "ViewCompilerEndCodeGeneration"), "Code generation for the Razor file at '{FilePath}' completed in {ElapsedMilliseconds}ms."); _viewCompilerLocatedCompiledView = LoggerMessage.Define( LogLevel.Debug, - new EventId(3, nameof(ViewCompilerLocatedCompiledView)), + new EventId(3, "ViewCompilerLocatedCompiledView"), "Initializing Razor view compiler with compiled view: '{ViewName}'."); _viewCompilerNoCompiledViewsFound = LoggerMessage.Define( LogLevel.Debug, - new EventId(4, nameof(ViewCompilerNoCompiledViewsFound)), + new EventId(4, "ViewCompilerNoCompiledViewsFound"), "Initializing Razor view compiler with no compiled views."); _viewCompilerLocatedCompiledViewForPath = LoggerMessage.Define( LogLevel.Trace, - new EventId(5, nameof(ViewCompilerLocatedCompiledViewForPath)), + new EventId(5, "ViewCompilerLocatedCompiledViewForPath"), "Located compiled view for view at path '{Path}'."); _viewCompilerRecompilingCompiledView = LoggerMessage.Define( @@ -66,52 +66,52 @@ namespace Microsoft.AspNetCore.Mvc.Razor _viewCompilerCouldNotFindFileToCompileForPath = LoggerMessage.Define( LogLevel.Trace, - new EventId(7, nameof(ViewCompilerCouldNotFindFileAtPath)), + new EventId(7, "ViewCompilerCouldNotFindFileAtPath"), "Could not find a file for view at path '{Path}'."); _viewCompilerFoundFileToCompileForPath = LoggerMessage.Define( LogLevel.Trace, - new EventId(8, nameof(ViewCompilerFoundFileToCompile)), + new EventId(8, "ViewCompilerFoundFileToCompile"), "Found file at path '{Path}'."); _viewCompilerInvalidatingCompiledFile = LoggerMessage.Define( LogLevel.Trace, - new EventId(9, nameof(ViewCompilerInvalidingCompiledFile)), + new EventId(9, "ViewCompilerInvalidingCompiledFile"), "Invalidating compiled view at path '{Path}' with a file since the checksum did not match."); _viewLookupCacheMiss = LoggerMessage.Define( LogLevel.Debug, - new EventId(1, nameof(ViewLookupCacheMiss)), + new EventId(1, "ViewLookupCacheMiss"), "View lookup cache miss for view '{ViewName}' in controller '{ControllerName}'."); _viewLookupCacheHit = LoggerMessage.Define( LogLevel.Debug, - new EventId(2, nameof(ViewLookupCacheHit)), + new EventId(2, "ViewLookupCacheHit"), "View lookup cache hit for view '{ViewName}' in controller '{ControllerName}'."); _precompiledViewFound = LoggerMessage.Define( LogLevel.Debug, - new EventId(3, nameof(PrecompiledViewFound)), + new EventId(3, "PrecompiledViewFound"), "Using precompiled view for '{RelativePath}'."); _generatedCodeToAssemblyCompilationStart = LoggerMessage.Define( LogLevel.Debug, - new EventId(1, nameof(GeneratedCodeToAssemblyCompilationStart)), + new EventId(1, "GeneratedCodeToAssemblyCompilationStart"), "Compilation of the generated code for the Razor file at '{FilePath}' started."); _generatedCodeToAssemblyCompilationEnd = LoggerMessage.Define( LogLevel.Debug, - new EventId(2, nameof(GeneratedCodeToAssemblyCompilationEnd)), + new EventId(2, "GeneratedCodeToAssemblyCompilationEnd"), "Compilation of the generated code for the Razor file at '{FilePath}' completed in {ElapsedMilliseconds}ms."); _tagHelperComponentInitialized = LoggerMessage.Define( LogLevel.Debug, - new EventId(2, nameof(TagHelperComponentInitialized)), + new EventId(2, "TagHelperComponentInitialized"), "Tag helper component '{ComponentName}' initialized."); _tagHelperComponentProcessed = LoggerMessage.Define( LogLevel.Debug, - new EventId(3, nameof(TagHelperComponentProcessed)), + new EventId(3, "TagHelperComponentProcessed"), "Tag helper component '{ComponentName}' processed."); } diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageLoggerExtensions.cs index 7de4b8679b..825dc0c190 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageLoggerExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.RazorPages/PageLoggerExtensions.cs @@ -30,27 +30,27 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages _handlerMethodExecuting = LoggerMessage.Define( LogLevel.Information, - new EventId(101, nameof(ExecutingHandlerMethod)), + new EventId(101, "ExecutingHandlerMethod"), "Executing handler method {HandlerName} with arguments ({Arguments}) - ModelState is {ValidationState}"); _handlerMethodExecuted = LoggerMessage.Define( LogLevel.Information, - new EventId(102, nameof(ExecutedHandlerMethod)), + new EventId(102, "ExecutedHandlerMethod"), "Executed handler method {HandlerName}, returned result {ActionResult}."); _implicitHandlerMethodExecuting = LoggerMessage.Define( LogLevel.Information, - new EventId(103, nameof(ExecutingImplicitHandlerMethod)), + new EventId(103, "ExecutingImplicitHandlerMethod"), "Executing an implicit handler method - ModelState is {ValidationState}"); _implicitHandlerMethodExecuted = LoggerMessage.Define( LogLevel.Information, - new EventId(104, nameof(ExecutedImplicitHandlerMethod)), + new EventId(104, "ExecutedImplicitHandlerMethod"), "Executed an implicit handler method, returned result {ActionResult}."); _pageFilterShortCircuit = LoggerMessage.Define( LogLevel.Debug, - new EventId(3, nameof(PageFilterShortCircuited)), + new EventId(3, "PageFilterShortCircuited"), "Request was short circuited at page filter '{PageFilter}'."); _malformedPageDirective = LoggerMessage.Define( @@ -60,22 +60,22 @@ namespace Microsoft.AspNetCore.Mvc.RazorPages _notMostEffectiveFilter = LoggerMessage.Define( LogLevel.Debug, - new EventId(1, nameof(NotMostEffectiveFilter)), + new EventId(1, "NotMostEffectiveFilter"), "Skipping the execution of current filter as its not the most effective filter implementing the policy {FilterPolicy}."); _beforeExecutingMethodOnFilter = LoggerMessage.Define( LogLevel.Trace, - new EventId(1, nameof(BeforeExecutingMethodOnFilter)), + new EventId(1, "BeforeExecutingMethodOnFilter"), "{FilterType}: Before executing {Method} on filter {Filter}."); _afterExecutingMethodOnFilter = LoggerMessage.Define( LogLevel.Trace, - new EventId(2, nameof(AfterExecutingMethodOnFilter)), + new EventId(2, "AfterExecutingMethodOnFilter"), "{FilterType}: After executing {Method} on filter {Filter}."); _unsupportedAreaPath = LoggerMessage.Define( LogLevel.Warning, - new EventId(1, nameof(UnsupportedAreaPath)), + new EventId(1, "UnsupportedAreaPath"), "The page at '{FilePath}' is located under the area root directory '/Areas/' but does not follow the path format '/Areas/AreaName/Pages/Directory/FileName.cshtml"); } diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/MvcTagHelpersLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/MvcTagHelpersLoggerExtensions.cs index ed33b73382..9cae27c529 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/MvcTagHelpersLoggerExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.TagHelpers/MvcTagHelpersLoggerExtensions.cs @@ -14,7 +14,7 @@ namespace Microsoft.AspNetCore.Mvc.TagHelpers { _distributedFormatterDeserializedFailed = LoggerMessage.Define( LogLevel.Error, - new EventId(1, nameof(DistributedFormatterDeserializationException)), + new EventId(1, "DistributedFormatterDeserializationException"), "Couldn't deserialize cached value for key {Key}."); } diff --git a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesLoggerExtensions.cs b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesLoggerExtensions.cs index ad03bd3b18..a7e9a492fd 100644 --- a/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesLoggerExtensions.cs +++ b/src/Mvc/src/Microsoft.AspNetCore.Mvc.ViewFeatures/MvcViewFeaturesLoggerExtensions.cs @@ -42,83 +42,83 @@ namespace Microsoft.AspNetCore.Mvc.ViewFeatures { _viewComponentExecuting = LoggerMessage.Define( LogLevel.Debug, - new EventId(1, nameof(ViewComponentExecuting)), + new EventId(1, "ViewComponentExecuting"), "Executing view component {ViewComponentName} with arguments ({Arguments})."); _viewComponentExecuted = LoggerMessage.Define( LogLevel.Debug, - new EventId(2, nameof(ViewComponentExecuted)), + new EventId(2, "ViewComponentExecuted"), "Executed view component {ViewComponentName} in {ElapsedMilliseconds}ms and returned " + "{ViewComponentResult}"); _partialViewResultExecuting = LoggerMessage.Define( LogLevel.Information, - new EventId(1, nameof(PartialViewResultExecuting)), + new EventId(1, "PartialViewResultExecuting"), "Executing PartialViewResult, running view {PartialViewName}."); _partialViewFound = LoggerMessage.Define( LogLevel.Debug, - new EventId(2, nameof(PartialViewFound)), + new EventId(2, "PartialViewFound"), "The partial view path '{PartialViewFilePath}' was found in {ElapsedMilliseconds}ms."); _partialViewNotFound = LoggerMessage.Define>( LogLevel.Error, - new EventId(3, nameof(PartialViewNotFound)), + new EventId(3, "PartialViewNotFound"), "The partial view '{PartialViewName}' was not found. Searched locations: {SearchedViewLocations}"); _partialViewResultExecuted = LoggerMessage.Define( LogLevel.Information, - new EventId(4, nameof(PartialViewResultExecuted)), + new EventId(4, "PartialViewResultExecuted"), "Executed PartialViewResult - view {PartialViewName} executed in {ElapsedMilliseconds}ms."); _antiforgeryTokenInvalid = LoggerMessage.Define( LogLevel.Information, - new EventId(1, nameof(AntiforgeryTokenInvalid)), + new EventId(1, "AntiforgeryTokenInvalid"), "Antiforgery token validation failed. {Message}"); _viewComponentResultExecuting = LoggerMessage.Define( LogLevel.Information, - new EventId(1, nameof(ViewComponentResultExecuting)), + new EventId(1, "ViewComponentResultExecuting"), "Executing ViewComponentResult, running {ViewComponentName}."); _viewResultExecuting = LoggerMessage.Define( LogLevel.Information, - new EventId(1, nameof(ViewResultExecuting)), + new EventId(1, "ViewResultExecuting"), "Executing ViewResult, running view {ViewName}."); _viewFound = LoggerMessage.Define( LogLevel.Debug, - new EventId(2, nameof(ViewFound)), + new EventId(2, "ViewFound"), "The view path '{ViewFilePath}' was found in {ElapsedMilliseconds}ms."); _viewNotFound = LoggerMessage.Define>( LogLevel.Error, - new EventId(3, nameof(ViewNotFound)), + new EventId(3, "ViewNotFound"), "The view '{ViewName}' was not found. Searched locations: {SearchedViewLocations}"); _viewResultExecuted = LoggerMessage.Define( LogLevel.Information, - new EventId(4, nameof(ViewResultExecuted)), + new EventId(4, "ViewResultExecuted"), "Executed ViewResult - view {ViewName} executed in {ElapsedMilliseconds}ms."); _tempDataCookieNotFound = LoggerMessage.Define( LogLevel.Debug, - new EventId(1, nameof(TempDataCookieNotFound)), + new EventId(1, "TempDataCookieNotFound"), "The temp data cookie {CookieName} was not found."); _tempDataCookieLoadSuccess = LoggerMessage.Define( LogLevel.Debug, - new EventId(2, nameof(TempDataCookieLoadSuccess)), + new EventId(2, "TempDataCookieLoadSuccess"), "The temp data cookie {CookieName} was used to successfully load temp data."); _tempDataCookieLoadFailure = LoggerMessage.Define( LogLevel.Warning, - new EventId(3, nameof(TempDataCookieLoadFailure)), + new EventId(3, "TempDataCookieLoadFailure"), "The temp data cookie {CookieName} could not be loaded."); _notMostEffectiveFilter = LoggerMessage.Define( LogLevel.Trace, - new EventId(1, nameof(NotMostEffectiveFilter)), + new EventId(1, "NotMostEffectiveFilter"), "Skipping the execution of current filter as its not the most effective filter implementing the policy {FilterPolicy}."); } From 87629bbad906e9507026692904b6bcb5021cdd33 Mon Sep 17 00:00:00 2001 From: Nate McMaster Date: Tue, 11 Dec 2018 18:19:36 -0800 Subject: [PATCH 020/297] Update Middleware.sln and Kestrel.sln to workaround NU1105 error --- docs/BuildFromSource.md | 2 +- src/Middleware/Middleware.sln | 277 +++++++++++++++++++++++++++++++--- src/Servers/Kestrel.sln | 93 +++++++++--- version.props | 2 +- 4 files changed, 333 insertions(+), 41 deletions(-) diff --git a/docs/BuildFromSource.md b/docs/BuildFromSource.md index 7bfdf52d4a..0a95e6cd55 100644 --- a/docs/BuildFromSource.md +++ b/docs/BuildFromSource.md @@ -57,7 +57,7 @@ Before opening our .sln files in Visual Studio or VS Code, you need to perform t 1. Executing the following on command-line: ``` - .\build.cmd /p:SkipTests=true /p:_ProjectsOnly=true /p:BuildNumberSuffix=t999 + .\build.cmd /p:SkipTests=true /p:_ProjectsOnly=true ``` This will download required tools and build the entire repository once. At that point, you should be able to open .sln files to work on the projects you care about. diff --git a/src/Middleware/Middleware.sln b/src/Middleware/Middleware.sln index 696e17f7f2..92742c634a 100644 --- a/src/Middleware/Middleware.sln +++ b/src/Middleware/Middleware.sln @@ -60,7 +60,6 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "samples", "samples", "{8989BEC1-6D0A-4E11-A09C-B31FD6222748}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MiddlewareAnalysisSample", "MiddlewareAnalysis\samples\MiddlewareAnalysisSample\MiddlewareAnalysisSample.csproj", "{18F82832-9164-434E-BAEF-6579B3CFCDF3}" -<<<<<<< HEAD EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.MiddlewareAnalysis", "MiddlewareAnalysis\src\Microsoft.AspNetCore.MiddlewareAnalysis.csproj", "{7E00616F-9D5C-4318-99CB-8F6ECFA82515}" EndProject @@ -83,12 +82,6 @@ EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore", "HealthChecks.EntityFrameworkCore\src\Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore.csproj", "{DA051189-4133-4131-A8B4-0F63EE8552D0}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore.Tests", "HealthChecks.EntityFrameworkCore\test\Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore.Tests.csproj", "{7553B6FF-9EA0-4BC2-A720-783685CB2F8D}" -======= -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.MiddlewareAnalysis", "MiddlewareAnalysis\src\Microsoft.AspNetCore.MiddlewareAnalysis.csproj", "{7E00616F-9D5C-4318-99CB-8F6ECFA82515}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.MiddlewareAnalysis.Tests", "MiddlewareAnalysis\test\Microsoft.AspNetCore.MiddlewareAnalysis.Tests.csproj", "{009E3DE7-AFC7-4C66-852D-29BF73257176}" ->>>>>>> 4c5debd6ea3a830497f1ad4c3e570466a4f9a2f6 EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "HostFiltering", "HostFiltering", "{9298FDED-65F9-4022-A747-FAEC3ADF3AD3}" EndProject @@ -212,14 +205,46 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Http.Headers" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Routing", "..\http\Routing\src\Microsoft.AspNetCore.Routing.csproj", "{03EA49FF-EF19-476C-8FCF-C426860751A8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel.Https", "..\Servers\Kestrel\Https\src\Microsoft.AspNetCore.Server.Kestrel.Https.csproj", "{0186A5D0-6D05-4C19-BB81-E49A51745FFF}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.IntegrationTesting", "..\Hosting\Server.IntegrationTesting\src\Microsoft.AspNetCore.Server.IntegrationTesting.csproj", "{17B7BFF6-4E72-410C-B690-02741505500A}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.HttpSys", "..\Servers\HttpSys\src\Microsoft.AspNetCore.Server.HttpSys.csproj", "{260E77CB-800F-4A13-BE92-9CAA097705C2}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_dependencies", "_dependencies", "{ACA6DDB9-7592-47CE-A740-D15BF307E9E0}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel.Core", "..\Servers\Kestrel\Core\src\Microsoft.AspNetCore.Server.Kestrel.Core.csproj", "{85534665-96ED-4C14-BB63-DA9CC5F50DBD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions", "..\Servers\Kestrel\Transport.Abstractions\src\Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.csproj", "{E6D8587C-97DB-4083-9983-8819241E202E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets", "..\Servers\Kestrel\Transport.Sockets\src\Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj", "{7FF45C00-BAAF-43AD-B0D3-392C04E241E5}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Connections.Abstractions", "..\Servers\Connections.Abstractions\src\Microsoft.AspNetCore.Connections.Abstractions.csproj", "{69A74E57-48B7-43B8-A3D7-874F7B72F271}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Http.Extensions", "..\Http\Http.Extensions\src\Microsoft.AspNetCore.Http.Extensions.csproj", "{13BB39CC-E440-4FF0-B37A-1353BA508E42}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Http.Abstractions", "..\Http\Http.Abstractions\src\Microsoft.AspNetCore.Http.Abstractions.csproj", "{DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.WebUtilities", "..\Http\WebUtilities\src\Microsoft.AspNetCore.WebUtilities.csproj", "{E2B8EE5C-A471-4E85-9381-B890B5D95685}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Hosting", "..\Hosting\Hosting\src\Microsoft.AspNetCore.Hosting.csproj", "{F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Hosting.Abstractions", "..\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj", "{4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authentication.Core", "..\Http\Authentication.Core\src\Microsoft.AspNetCore.Authentication.Core.csproj", "{7E20E488-5AB4-4779-9DE1-35B21112E368}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Authentication.Abstractions", "..\Http\Authentication.Abstractions\src\Microsoft.AspNetCore.Authentication.Abstractions.csproj", "{34A19AEF-182F-4800-88CC-CCCFFB9A6564}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Hosting.Server.Abstractions", "..\Hosting\Server.Abstractions\src\Microsoft.AspNetCore.Hosting.Server.Abstractions.csproj", "{4FA4495C-AEAE-4F71-9533-496243141BA0}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Http.Features", "..\Http\Http.Features\src\Microsoft.AspNetCore.Http.Features.csproj", "{E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Routing.Abstractions", "..\Http\Routing.Abstractions\src\Microsoft.AspNetCore.Routing.Abstractions.csproj", "{A7098F46-C2F3-4BC7-88CE-59DAD57F8499}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection", "..\DataProtection\DataProtection\src\Microsoft.AspNetCore.DataProtection.csproj", "{3AD5B221-C718-4F14-883A-4345DC90CF9C}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Cryptography.Internal", "..\DataProtection\Cryptography.Internal\src\Microsoft.AspNetCore.Cryptography.Internal.csproj", "{227030D6-99AD-4C6A-AE70-1333BCBE8705}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.DataProtection.Abstractions", "..\DataProtection\Abstractions\src\Microsoft.AspNetCore.DataProtection.Abstractions.csproj", "{7343B4E4-C5A2-49E2-B431-4D1E6A26E424}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -1082,18 +1107,6 @@ Global {03EA49FF-EF19-476C-8FCF-C426860751A8}.Release|x64.Build.0 = Release|Any CPU {03EA49FF-EF19-476C-8FCF-C426860751A8}.Release|x86.ActiveCfg = Release|Any CPU {03EA49FF-EF19-476C-8FCF-C426860751A8}.Release|x86.Build.0 = Release|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Debug|x64.ActiveCfg = Debug|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Debug|x64.Build.0 = Debug|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Debug|x86.ActiveCfg = Debug|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Debug|x86.Build.0 = Debug|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Release|Any CPU.Build.0 = Release|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Release|x64.ActiveCfg = Release|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Release|x64.Build.0 = Release|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Release|x86.ActiveCfg = Release|Any CPU - {0186A5D0-6D05-4C19-BB81-E49A51745FFF}.Release|x86.Build.0 = Release|Any CPU {17B7BFF6-4E72-410C-B690-02741505500A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {17B7BFF6-4E72-410C-B690-02741505500A}.Debug|Any CPU.Build.0 = Debug|Any CPU {17B7BFF6-4E72-410C-B690-02741505500A}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -1118,6 +1131,210 @@ Global {260E77CB-800F-4A13-BE92-9CAA097705C2}.Release|x64.Build.0 = Release|Any CPU {260E77CB-800F-4A13-BE92-9CAA097705C2}.Release|x86.ActiveCfg = Release|Any CPU {260E77CB-800F-4A13-BE92-9CAA097705C2}.Release|x86.Build.0 = Release|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Debug|x64.ActiveCfg = Debug|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Debug|x64.Build.0 = Debug|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Debug|x86.ActiveCfg = Debug|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Debug|x86.Build.0 = Debug|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Release|Any CPU.Build.0 = Release|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Release|x64.ActiveCfg = Release|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Release|x64.Build.0 = Release|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Release|x86.ActiveCfg = Release|Any CPU + {85534665-96ED-4C14-BB63-DA9CC5F50DBD}.Release|x86.Build.0 = Release|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Debug|x64.ActiveCfg = Debug|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Debug|x64.Build.0 = Debug|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Debug|x86.ActiveCfg = Debug|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Debug|x86.Build.0 = Debug|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Release|Any CPU.Build.0 = Release|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Release|x64.ActiveCfg = Release|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Release|x64.Build.0 = Release|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Release|x86.ActiveCfg = Release|Any CPU + {E6D8587C-97DB-4083-9983-8819241E202E}.Release|x86.Build.0 = Release|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Debug|x64.ActiveCfg = Debug|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Debug|x64.Build.0 = Debug|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Debug|x86.ActiveCfg = Debug|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Debug|x86.Build.0 = Debug|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Release|Any CPU.Build.0 = Release|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Release|x64.ActiveCfg = Release|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Release|x64.Build.0 = Release|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Release|x86.ActiveCfg = Release|Any CPU + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5}.Release|x86.Build.0 = Release|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Debug|Any CPU.Build.0 = Debug|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Debug|x64.ActiveCfg = Debug|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Debug|x64.Build.0 = Debug|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Debug|x86.ActiveCfg = Debug|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Debug|x86.Build.0 = Debug|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Release|Any CPU.ActiveCfg = Release|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Release|Any CPU.Build.0 = Release|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Release|x64.ActiveCfg = Release|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Release|x64.Build.0 = Release|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Release|x86.ActiveCfg = Release|Any CPU + {69A74E57-48B7-43B8-A3D7-874F7B72F271}.Release|x86.Build.0 = Release|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Debug|Any CPU.Build.0 = Debug|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Debug|x64.ActiveCfg = Debug|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Debug|x64.Build.0 = Debug|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Debug|x86.ActiveCfg = Debug|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Debug|x86.Build.0 = Debug|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Release|Any CPU.ActiveCfg = Release|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Release|Any CPU.Build.0 = Release|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Release|x64.ActiveCfg = Release|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Release|x64.Build.0 = Release|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Release|x86.ActiveCfg = Release|Any CPU + {13BB39CC-E440-4FF0-B37A-1353BA508E42}.Release|x86.Build.0 = Release|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Debug|x64.ActiveCfg = Debug|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Debug|x64.Build.0 = Debug|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Debug|x86.ActiveCfg = Debug|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Debug|x86.Build.0 = Debug|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Release|Any CPU.Build.0 = Release|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Release|x64.ActiveCfg = Release|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Release|x64.Build.0 = Release|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Release|x86.ActiveCfg = Release|Any CPU + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD}.Release|x86.Build.0 = Release|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Debug|x64.ActiveCfg = Debug|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Debug|x64.Build.0 = Debug|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Debug|x86.ActiveCfg = Debug|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Debug|x86.Build.0 = Debug|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Release|Any CPU.Build.0 = Release|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Release|x64.ActiveCfg = Release|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Release|x64.Build.0 = Release|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Release|x86.ActiveCfg = Release|Any CPU + {E2B8EE5C-A471-4E85-9381-B890B5D95685}.Release|x86.Build.0 = Release|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Debug|x64.ActiveCfg = Debug|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Debug|x64.Build.0 = Debug|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Debug|x86.ActiveCfg = Debug|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Debug|x86.Build.0 = Debug|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Release|Any CPU.Build.0 = Release|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Release|x64.ActiveCfg = Release|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Release|x64.Build.0 = Release|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Release|x86.ActiveCfg = Release|Any CPU + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A}.Release|x86.Build.0 = Release|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Debug|x64.ActiveCfg = Debug|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Debug|x64.Build.0 = Debug|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Debug|x86.ActiveCfg = Debug|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Debug|x86.Build.0 = Debug|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Release|Any CPU.Build.0 = Release|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Release|x64.ActiveCfg = Release|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Release|x64.Build.0 = Release|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Release|x86.ActiveCfg = Release|Any CPU + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF}.Release|x86.Build.0 = Release|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Debug|x64.ActiveCfg = Debug|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Debug|x64.Build.0 = Debug|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Debug|x86.ActiveCfg = Debug|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Debug|x86.Build.0 = Debug|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Release|Any CPU.Build.0 = Release|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Release|x64.ActiveCfg = Release|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Release|x64.Build.0 = Release|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Release|x86.ActiveCfg = Release|Any CPU + {7E20E488-5AB4-4779-9DE1-35B21112E368}.Release|x86.Build.0 = Release|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Debug|Any CPU.Build.0 = Debug|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Debug|x64.ActiveCfg = Debug|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Debug|x64.Build.0 = Debug|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Debug|x86.ActiveCfg = Debug|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Debug|x86.Build.0 = Debug|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Release|Any CPU.ActiveCfg = Release|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Release|Any CPU.Build.0 = Release|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Release|x64.ActiveCfg = Release|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Release|x64.Build.0 = Release|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Release|x86.ActiveCfg = Release|Any CPU + {34A19AEF-182F-4800-88CC-CCCFFB9A6564}.Release|x86.Build.0 = Release|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Debug|x64.ActiveCfg = Debug|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Debug|x64.Build.0 = Debug|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Debug|x86.ActiveCfg = Debug|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Debug|x86.Build.0 = Debug|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Release|Any CPU.Build.0 = Release|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Release|x64.ActiveCfg = Release|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Release|x64.Build.0 = Release|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Release|x86.ActiveCfg = Release|Any CPU + {4FA4495C-AEAE-4F71-9533-496243141BA0}.Release|x86.Build.0 = Release|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Debug|x64.ActiveCfg = Debug|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Debug|x64.Build.0 = Debug|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Debug|x86.ActiveCfg = Debug|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Debug|x86.Build.0 = Debug|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Release|Any CPU.Build.0 = Release|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Release|x64.ActiveCfg = Release|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Release|x64.Build.0 = Release|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Release|x86.ActiveCfg = Release|Any CPU + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44}.Release|x86.Build.0 = Release|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Debug|x64.ActiveCfg = Debug|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Debug|x64.Build.0 = Debug|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Debug|x86.ActiveCfg = Debug|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Debug|x86.Build.0 = Debug|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Release|Any CPU.Build.0 = Release|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Release|x64.ActiveCfg = Release|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Release|x64.Build.0 = Release|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Release|x86.ActiveCfg = Release|Any CPU + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499}.Release|x86.Build.0 = Release|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Debug|x64.ActiveCfg = Debug|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Debug|x64.Build.0 = Debug|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Debug|x86.ActiveCfg = Debug|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Debug|x86.Build.0 = Debug|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Release|Any CPU.Build.0 = Release|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Release|x64.ActiveCfg = Release|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Release|x64.Build.0 = Release|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Release|x86.ActiveCfg = Release|Any CPU + {3AD5B221-C718-4F14-883A-4345DC90CF9C}.Release|x86.Build.0 = Release|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Debug|Any CPU.Build.0 = Debug|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Debug|x64.ActiveCfg = Debug|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Debug|x64.Build.0 = Debug|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Debug|x86.ActiveCfg = Debug|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Debug|x86.Build.0 = Debug|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Release|Any CPU.ActiveCfg = Release|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Release|Any CPU.Build.0 = Release|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Release|x64.ActiveCfg = Release|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Release|x64.Build.0 = Release|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Release|x86.ActiveCfg = Release|Any CPU + {227030D6-99AD-4C6A-AE70-1333BCBE8705}.Release|x86.Build.0 = Release|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Debug|x64.ActiveCfg = Debug|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Debug|x64.Build.0 = Debug|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Debug|x86.ActiveCfg = Debug|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Debug|x86.Build.0 = Debug|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Release|Any CPU.Build.0 = Release|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Release|x64.ActiveCfg = Release|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Release|x64.Build.0 = Release|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Release|x86.ActiveCfg = Release|Any CPU + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -1205,9 +1422,25 @@ Global {9D3062AB-5B11-4FFE-BEAF-304CF7F19AA5} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} {CB8AD0DF-00CE-443B-AAC4-3A5CCEDC6AD0} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} {03EA49FF-EF19-476C-8FCF-C426860751A8} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} - {0186A5D0-6D05-4C19-BB81-E49A51745FFF} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} {17B7BFF6-4E72-410C-B690-02741505500A} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} {260E77CB-800F-4A13-BE92-9CAA097705C2} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {85534665-96ED-4C14-BB63-DA9CC5F50DBD} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {E6D8587C-97DB-4083-9983-8819241E202E} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {7FF45C00-BAAF-43AD-B0D3-392C04E241E5} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {69A74E57-48B7-43B8-A3D7-874F7B72F271} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {13BB39CC-E440-4FF0-B37A-1353BA508E42} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {DA0B4770-47A7-4756-BDEF-8A93F3A5FBCD} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {E2B8EE5C-A471-4E85-9381-B890B5D95685} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {F5F3D90B-01FA-43D3-ABED-E1E6EBD0172A} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {4B8B3A14-8E5A-4FBE-9EEF-294BAD79F4BF} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {7E20E488-5AB4-4779-9DE1-35B21112E368} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {34A19AEF-182F-4800-88CC-CCCFFB9A6564} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {4FA4495C-AEAE-4F71-9533-496243141BA0} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {E5CF6C4E-3C92-44FD-90BF-10F97BBB6B44} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {A7098F46-C2F3-4BC7-88CE-59DAD57F8499} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {3AD5B221-C718-4F14-883A-4345DC90CF9C} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {227030D6-99AD-4C6A-AE70-1333BCBE8705} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} + {7343B4E4-C5A2-49E2-B431-4D1E6A26E424} = {ACA6DDB9-7592-47CE-A740-D15BF307E9E0} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {83786312-A93B-4BB4-AB06-7C6913A59AFA} diff --git a/src/Servers/Kestrel.sln b/src/Servers/Kestrel.sln index 441943483d..f554a1ccce 100644 --- a/src/Servers/Kestrel.sln +++ b/src/Servers/Kestrel.sln @@ -65,6 +65,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SystemdActivation", "System EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{2B456D08-F72B-4EB8-B663-B6D78FC04BF8}" +EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Http.Features", "..\http\Http.Features\src\Microsoft.AspNetCore.Http.Features.csproj", "{CE32EDC9-F78C-45C6-A298-C437DA5EA438}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Hosting", "..\Hosting\hosting\src\Microsoft.AspNetCore.Hosting.csproj", "{6BAE8654-7D3D-4E29-8314-9AB28E81CC1E}" @@ -75,6 +76,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Http.A EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dependencies", "dependencies", "{F0A1281A-B512-49D2-8362-21EE32B3674F}" EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Http.Extensions", "..\Http\Http.Extensions\src\Microsoft.AspNetCore.Http.Extensions.csproj", "{972064E3-2562-4100-ACA8-B55814B4D09B}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Hosting.Abstractions", "..\Hosting\Abstractions\src\Microsoft.AspNetCore.Hosting.Abstractions.csproj", "{06B9D580-DD25-4119-82BE-5F5B9E7F365E}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Net.Http.Headers", "..\Http\Headers\src\Microsoft.Net.Http.Headers.csproj", "{D9872E91-EF1D-4181-82C9-584224ADE368}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Hosting.Server.Abstractions", "..\Hosting\Server.Abstractions\src\Microsoft.AspNetCore.Hosting.Server.Abstractions.csproj", "{E0AD50A3-2518-4060-8BB9-5649B04B3A6D}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.WebUtilities", "..\Http\WebUtilities\src\Microsoft.AspNetCore.WebUtilities.csproj", "{EE45763C-753D-4228-8E5D-A71F8BDB3D89}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -409,6 +420,66 @@ Global {5FAEC63D-FF6B-4228-8883-7F1FAC6EAF61}.Release|x64.Build.0 = Release|Any CPU {5FAEC63D-FF6B-4228-8883-7F1FAC6EAF61}.Release|x86.ActiveCfg = Release|Any CPU {5FAEC63D-FF6B-4228-8883-7F1FAC6EAF61}.Release|x86.Build.0 = Release|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Debug|x64.ActiveCfg = Debug|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Debug|x64.Build.0 = Debug|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Debug|x86.ActiveCfg = Debug|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Debug|x86.Build.0 = Debug|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Release|Any CPU.Build.0 = Release|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Release|x64.ActiveCfg = Release|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Release|x64.Build.0 = Release|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Release|x86.ActiveCfg = Release|Any CPU + {972064E3-2562-4100-ACA8-B55814B4D09B}.Release|x86.Build.0 = Release|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Debug|x64.ActiveCfg = Debug|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Debug|x64.Build.0 = Debug|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Debug|x86.ActiveCfg = Debug|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Debug|x86.Build.0 = Debug|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Release|Any CPU.Build.0 = Release|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Release|x64.ActiveCfg = Release|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Release|x64.Build.0 = Release|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Release|x86.ActiveCfg = Release|Any CPU + {06B9D580-DD25-4119-82BE-5F5B9E7F365E}.Release|x86.Build.0 = Release|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Debug|x64.ActiveCfg = Debug|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Debug|x64.Build.0 = Debug|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Debug|x86.ActiveCfg = Debug|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Debug|x86.Build.0 = Debug|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Release|Any CPU.Build.0 = Release|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Release|x64.ActiveCfg = Release|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Release|x64.Build.0 = Release|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Release|x86.ActiveCfg = Release|Any CPU + {D9872E91-EF1D-4181-82C9-584224ADE368}.Release|x86.Build.0 = Release|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Debug|Any CPU.Build.0 = Debug|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Debug|x64.ActiveCfg = Debug|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Debug|x64.Build.0 = Debug|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Debug|x86.ActiveCfg = Debug|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Debug|x86.Build.0 = Debug|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Release|Any CPU.ActiveCfg = Release|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Release|Any CPU.Build.0 = Release|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Release|x64.ActiveCfg = Release|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Release|x64.Build.0 = Release|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Release|x86.ActiveCfg = Release|Any CPU + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D}.Release|x86.Build.0 = Release|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Debug|x64.ActiveCfg = Debug|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Debug|x64.Build.0 = Debug|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Debug|x86.ActiveCfg = Debug|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Debug|x86.Build.0 = Debug|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Release|Any CPU.Build.0 = Release|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Release|x64.ActiveCfg = Release|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Release|x64.Build.0 = Release|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Release|x86.ActiveCfg = Release|Any CPU + {EE45763C-753D-4228-8E5D-A71F8BDB3D89}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -419,12 +490,6 @@ Global {AA10418F-3291-4011-8BF5-84F315F472B5} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} {051BE5E3-073C-4CD2-92AB-7742B2931409} = {2B456D08-F72B-4EB8-B663-B6D78FC04BF8} {B46DA84E-8442-4988-9B43-6A83812A35B7} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {710E0641-FFF4-4994-A7FA-B22A550A8F20} = {2B456D08-F72B-4EB8-B663-B6D78FC04BF8} - {5F6D1661-652E-4DF3-8A81-6EBE4208CE1A} = {2B456D08-F72B-4EB8-B663-B6D78FC04BF8} - {AA10418F-3291-4011-8BF5-84F315F472B5} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {1C342888-3514-4ECE-9820-1C7BD59EA29F} = {2B456D08-F72B-4EB8-B663-B6D78FC04BF8} - {051BE5E3-073C-4CD2-92AB-7742B2931409} = {2B456D08-F72B-4EB8-B663-B6D78FC04BF8} - {B46DA84E-8442-4988-9B43-6A83812A35B7} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} {0730A71E-CC07-4445-AC56-606B59BBF51F} = {40FEAA2F-DDF0-4FA3-942A-0D39B722DDE7} {4641895A-5E44-4158-91C9-B3718398229E} = {40FEAA2F-DDF0-4FA3-942A-0D39B722DDE7} {B5C4C2EA-5439-457D-9487-924A42E4D74D} = {F826BA61-60A9-45B6-AF29-FD1A6E313EF0} @@ -444,21 +509,15 @@ Global {0358D319-1D91-4EDE-A424-6A26734B32CB} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} {F254FDB7-6997-4894-9E82-C4583F605394} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} {3CAC9760-6D6E-424C-AC49-E60118D8ADD4} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {3CCA24C1-04AC-48C0-A60A-D43FE7479529} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {28DD5565-0546-48B0-973A-B27E1C9AD032} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {3615A580-A595-4B64-A8C7-FD361E712BEA} = {0256853E-1FDA-45C6-9641-87306D378508} - {FB1A66FE-1CB9-4121-A9F7-1A1459D3C9CC} = {2B456D08-F72B-4EB8-B663-B6D78FC04BF8} - {551F655B-F33C-4CD6-851F-4DFB89FA96A0} = {2B456D08-F72B-4EB8-B663-B6D78FC04BF8} - {6716895A-A00E-4BAC-92DF-4F8C859BC51E} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {C0AB577F-0227-45E6-A3AC-E7ABEFC4ED60} = {2B456D08-F72B-4EB8-B663-B6D78FC04BF8} - {C606C348-2232-4431-98F3-998B22792A38} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {75C0BD33-80E2-4061-A778-08C1FBECEA7D} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {0358D319-1D91-4EDE-A424-6A26734B32CB} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} - {F254FDB7-6997-4894-9E82-C4583F605394} = {0968A626-BA09-4B0D-B45F-855CD0F16F6C} {CE32EDC9-F78C-45C6-A298-C437DA5EA438} = {F0A1281A-B512-49D2-8362-21EE32B3674F} {6BAE8654-7D3D-4E29-8314-9AB28E81CC1E} = {F0A1281A-B512-49D2-8362-21EE32B3674F} {52EBE728-0F8E-4159-B420-338CE38C4281} = {F0A1281A-B512-49D2-8362-21EE32B3674F} {5FAEC63D-FF6B-4228-8883-7F1FAC6EAF61} = {F0A1281A-B512-49D2-8362-21EE32B3674F} + {972064E3-2562-4100-ACA8-B55814B4D09B} = {F0A1281A-B512-49D2-8362-21EE32B3674F} + {06B9D580-DD25-4119-82BE-5F5B9E7F365E} = {F0A1281A-B512-49D2-8362-21EE32B3674F} + {D9872E91-EF1D-4181-82C9-584224ADE368} = {F0A1281A-B512-49D2-8362-21EE32B3674F} + {E0AD50A3-2518-4060-8BB9-5649B04B3A6D} = {F0A1281A-B512-49D2-8362-21EE32B3674F} + {EE45763C-753D-4228-8E5D-A71F8BDB3D89} = {F0A1281A-B512-49D2-8362-21EE32B3674F} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {48207B50-7D05-4B10-B585-890FE0F4FCE1} diff --git a/version.props b/version.props index 0c1a867e07..f0098cfbf2 100644 --- a/version.props +++ b/version.props @@ -37,7 +37,7 @@ - 0 + t000 $(AspNetCoreMajorVersion).$(AspNetCoreMinorVersion).$(AspNetCorePatchVersion) $(PreReleaseLabel)-$(BuildNumberSuffix) $(PreReleaseBrandingLabel) Build $(BuildNumberSuffix) From 6d442c1e3d7875132c662a9e8c537e30cea585b8 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Wed, 12 Dec 2018 08:16:00 -0800 Subject: [PATCH 021/297] Upgrade Kestrel to target netcoreapp3.0 #3754 (#4405) --- .../src/Adapter/Internal/AdaptedPipeline.cs | 21 ------------------ .../src/Adapter/Internal/LoggingStream.cs | 20 ----------------- .../Core/src/Adapter/Internal/RawStream.cs | 10 --------- .../src/Internal/Http/HttpRequestStream.cs | 5 ----- .../src/Internal/Http/HttpResponseStream.cs | 5 ----- .../src/Internal/Http/HttpUpgradeStream.cs | 10 --------- .../Core/src/Internal/Http/MessageBody.cs | 8 ------- .../src/Internal/HttpsConnectionAdapter.cs | 22 ------------------- .../Internal/Infrastructure/WrappingStream.cs | 12 +--------- ...soft.AspNetCore.Server.Kestrel.Core.csproj | 2 +- .../Core/test/HttpRequestStreamTests.cs | 14 +----------- ...spNetCore.Server.Kestrel.Core.Tests.csproj | 4 ++-- ...Microsoft.AspNetCore.Server.Kestrel.csproj | 2 +- .../Kestrel/test/GeneratedCodeTests.cs | 7 +----- ...oft.AspNetCore.Server.Kestrel.Tests.csproj | 4 ++-- ...rver.Kestrel.Transport.Abstractions.csproj | 2 +- ...Core.Server.Kestrel.Transport.Libuv.csproj | 4 ++-- ...erver.Kestrel.Transport.Libuv.Tests.csproj | 4 ++-- .../src/Internal/SocketReceiver.cs | 15 +------------ .../src/Internal/SocketSender.cs | 15 +------------ ...re.Server.Kestrel.Transport.Sockets.csproj | 2 +- ...pNetCore.Server.Kestrel.Performance.csproj | 2 +- .../PlatformBenchmarks.csproj | 2 +- .../Http2SampleApp/Http2SampleApp.csproj | 2 +- .../LargeResponseApp/LargeResponseApp.csproj | 2 +- .../samples/PlaintextApp/PlaintextApp.csproj | 2 +- .../samples/SampleApp/SampleApp.csproj | 4 ++-- .../SystemdTestApp/SystemdTestApp.csproj | 2 +- .../test/PassThroughConnectionAdapter.cs | 7 +----- .../FunctionalTests/Http2/HandshakeTests.cs | 6 ----- .../FunctionalTests/Http2/ShutdownTests.cs | 6 ----- .../Http2/TlsTests.cs | 6 ----- .../HttpsConnectionAdapterTests.cs | 18 --------------- .../InMemory.FunctionalTests.csproj | 4 ++-- .../Interop.FunctionalTests/ChromeTests.cs | 9 +------- .../Interop.FunctionalTests.csproj | 2 +- .../Libuv.BindTests/Libuv.BindTests.csproj | 4 ++-- .../Libuv.FunctionalTests.csproj | 4 ++-- .../Sockets.BindTests.csproj | 4 ++-- .../Sockets.FunctionalTests.csproj | 4 ++-- .../tools/CodeGenerator/CodeGenerator.csproj | 4 ++-- 41 files changed, 40 insertions(+), 242 deletions(-) diff --git a/src/Servers/Kestrel/Core/src/Adapter/Internal/AdaptedPipeline.cs b/src/Servers/Kestrel/Core/src/Adapter/Internal/AdaptedPipeline.cs index eb65aac253..4b591a717d 100644 --- a/src/Servers/Kestrel/Core/src/Adapter/Internal/AdaptedPipeline.cs +++ b/src/Servers/Kestrel/Core/src/Adapter/Internal/AdaptedPipeline.cs @@ -74,27 +74,13 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal } else if (buffer.IsSingleSegment) { -#if NETCOREAPP2_1 await stream.WriteAsync(buffer.First); -#elif NETSTANDARD2_0 - var array = buffer.First.GetArray(); - await stream.WriteAsync(array.Array, array.Offset, array.Count); -#else -#error TFMs need to be updated -#endif } else { foreach (var memory in buffer) { -#if NETCOREAPP2_1 await stream.WriteAsync(memory); -#elif NETSTANDARD2_0 - var array = memory.GetArray(); - await stream.WriteAsync(array.Array, array.Offset, array.Count); -#else -#error TFMs need to be updated -#endif } } } @@ -131,14 +117,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal { var outputBuffer = Input.Writer.GetMemory(MinAllocBufferSize); -#if NETCOREAPP2_1 var bytesRead = await stream.ReadAsync(outputBuffer); -#elif NETSTANDARD2_0 - var array = outputBuffer.GetArray(); - var bytesRead = await stream.ReadAsync(array.Array, array.Offset, array.Count); -#else -#error TFMs need to be updated -#endif Input.Writer.Advance(bytesRead); if (bytesRead == 0) diff --git a/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs b/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs index 42722f2413..d7d5e85590 100644 --- a/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs +++ b/src/Servers/Kestrel/Core/src/Adapter/Internal/LoggingStream.cs @@ -83,17 +83,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal return read; } -#if NETCOREAPP2_1 public override int Read(Span destination) { int read = _inner.Read(destination); Log("Read", destination.Slice(0, read)); return read; } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public async override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { @@ -102,17 +97,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal return read; } -#if NETCOREAPP2_1 public override async ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { int read = await _inner.ReadAsync(destination, cancellationToken); Log("ReadAsync", destination.Span.Slice(0, read)); return read; } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override long Seek(long offset, SeekOrigin origin) { @@ -130,16 +120,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal _inner.Write(buffer, offset, count); } -#if NETCOREAPP2_1 public override void Write(ReadOnlySpan source) { Log("Write", source); _inner.Write(source); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { @@ -147,16 +132,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal return _inner.WriteAsync(buffer, offset, count, cancellationToken); } -#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { Log("WriteAsync", source.Span); return _inner.WriteAsync(source, cancellationToken); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif private void Log(string method, ReadOnlySpan buffer) { diff --git a/src/Servers/Kestrel/Core/src/Adapter/Internal/RawStream.cs b/src/Servers/Kestrel/Core/src/Adapter/Internal/RawStream.cs index 137b87ea04..837bc8ec05 100644 --- a/src/Servers/Kestrel/Core/src/Adapter/Internal/RawStream.cs +++ b/src/Servers/Kestrel/Core/src/Adapter/Internal/RawStream.cs @@ -69,15 +69,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal return ReadAsyncInternal(new Memory(buffer, offset, count)).AsTask(); } -#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { return ReadAsyncInternal(destination); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override void Write(byte[] buffer, int offset, int count) { @@ -94,16 +89,11 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Adapter.Internal await _output.FlushAsync(cancellationToken); } -#if NETCOREAPP2_1 public override async ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { _output.Write(source.Span); await _output.FlushAsync(cancellationToken); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override void Flush() { diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs index 3451bcdb30..a160d9180e 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpRequestStream.cs @@ -111,17 +111,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return ReadAsyncInternal(new Memory(buffer, offset, count), cancellationToken).AsTask(); } -#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { ValidateState(cancellationToken); return ReadAsyncInternal(destination, cancellationToken); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif private async ValueTask ReadAsyncInternal(Memory buffer, CancellationToken cancellationToken) { diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs index 79d31367c8..2d50902e31 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpResponseStream.cs @@ -112,17 +112,12 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return _httpResponseControl.WriteAsync(new ReadOnlyMemory(buffer, offset, count), cancellationToken); } -#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { ValidateState(cancellationToken); return new ValueTask(_httpResponseControl.WriteAsync(source, cancellationToken)); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public void StartAcceptingWrites() { diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/HttpUpgradeStream.cs b/src/Servers/Kestrel/Core/src/Internal/Http/HttpUpgradeStream.cs index 0b89d00ed1..4557e6609d 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/HttpUpgradeStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/HttpUpgradeStream.cs @@ -145,15 +145,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return _requestStream.ReadAsync(buffer, offset, count, cancellationToken); } -#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) { return _requestStream.ReadAsync(destination, cancellationToken); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override Task CopyToAsync(Stream destination, int bufferSize, CancellationToken cancellationToken) { @@ -165,15 +160,10 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http return _responseStream.WriteAsync(buffer, offset, count, cancellationToken); } -#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) { return _responseStream.WriteAsync(source, cancellationToken); } -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override long Seek(long offset, SeekOrigin origin) { diff --git a/src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs b/src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs index 750a490793..30248cac50 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Http/MessageBody.cs @@ -113,15 +113,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Http // REVIEW: This *could* be slower if 2 things are true // - The WriteAsync(ReadOnlyMemory) isn't overridden on the destination // - We change the Kestrel Memory Pool to not use pinned arrays but instead use native memory - -#if NETCOREAPP2_1 await destination.WriteAsync(memory, cancellationToken); -#elif NETSTANDARD2_0 - var array = memory.GetArray(); - await destination.WriteAsync(array.Array, array.Offset, array.Count, cancellationToken); -#else -#error TFMs need to be updated -#endif } } diff --git a/src/Servers/Kestrel/Core/src/Internal/HttpsConnectionAdapter.cs b/src/Servers/Kestrel/Core/src/Internal/HttpsConnectionAdapter.cs index 4abeabc80a..5b365c9bc3 100644 --- a/src/Servers/Kestrel/Core/src/Internal/HttpsConnectionAdapter.cs +++ b/src/Servers/Kestrel/Core/src/Internal/HttpsConnectionAdapter.cs @@ -131,7 +131,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal try { -#if NETCOREAPP2_1 // Adapt to the SslStream signature ServerCertificateSelectionCallback selector = null; if (_serverCertificateSelector != null) @@ -172,22 +171,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal } await sslStream.AuthenticateAsServerAsync(sslOptions, CancellationToken.None); -#elif NETSTANDARD2_0 // No ALPN support - var serverCert = _serverCertificate; - if (_serverCertificateSelector != null) - { - context.Features.Set(sslStream); - serverCert = _serverCertificateSelector(context.ConnectionContext, null); - if (serverCert != null) - { - EnsureCertificateIsAllowedForServerAuth(serverCert); - } - } - await sslStream.AuthenticateAsServerAsync(serverCert, certificateRequired, - _options.SslProtocols, _options.CheckCertificateRevocation); -#else -#error TFMs need to be updated -#endif } catch (OperationCanceledException) { @@ -206,13 +189,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Https.Internal timeoutFeature.CancelTimeout(); } -#if NETCOREAPP2_1 feature.ApplicationProtocol = sslStream.NegotiatedApplicationProtocol.Protocol; context.Features.Set(feature); -#elif NETSTANDARD2_0 // No ALPN support -#else -#error TFMs need to be updated -#endif feature.ClientCertificate = ConvertToX509Certificate2(sslStream.RemoteCertificate); feature.CipherAlgorithm = sslStream.CipherAlgorithm; feature.CipherStrength = sslStream.CipherStrength; diff --git a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs index 0be1c97d7e..6f1b13c39b 100644 --- a/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs +++ b/src/Servers/Kestrel/Core/src/Internal/Infrastructure/WrappingStream.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -68,13 +68,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure public override Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => _inner.ReadAsync(buffer, offset, count, cancellationToken); -#if NETCOREAPP2_1 public override ValueTask ReadAsync(Memory destination, CancellationToken cancellationToken = default) => _inner.ReadAsync(destination, cancellationToken); -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override int ReadByte() => _inner.ReadByte(); @@ -91,13 +86,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Internal.Infrastructure public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) => _inner.WriteAsync(buffer, offset, count, cancellationToken); -#if NETCOREAPP2_1 public override ValueTask WriteAsync(ReadOnlyMemory source, CancellationToken cancellationToken = default) => _inner.WriteAsync(source, cancellationToken); -#elif NETSTANDARD2_0 -#else -#error TFMs need to be updated -#endif public override void WriteByte(byte value) => _inner.WriteByte(value); diff --git a/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj b/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj index 90d916537e..04fd9fff4f 100644 --- a/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj +++ b/src/Servers/Kestrel/Core/src/Microsoft.AspNetCore.Server.Kestrel.Core.csproj @@ -2,7 +2,7 @@ Core components of ASP.NET Core Kestrel cross-platform web server. - netstandard2.0;netcoreapp2.1 + netcoreapp3.0 true aspnetcore;kestrel true diff --git a/src/Servers/Kestrel/Core/test/HttpRequestStreamTests.cs b/src/Servers/Kestrel/Core/test/HttpRequestStreamTests.cs index a9b0f97268..ee3c21a042 100644 --- a/src/Servers/Kestrel/Core/test/HttpRequestStreamTests.cs +++ b/src/Servers/Kestrel/Core/test/HttpRequestStreamTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -85,18 +85,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Core.Tests await Assert.ThrowsAsync(() => stream.WriteAsync(new byte[1], 0, 1)); } -#if NET461 - [Fact] - public void BeginWriteThrows() - { - var stream = new HttpRequestStream(Mock.Of()); - Assert.Throws(() => stream.BeginWrite(new byte[1], 0, 1, null, null)); - } -#elif NETCOREAPP2_2 -#else -#error Target framework needs to be updated -#endif - [Fact] // Read-only streams should support Flush according to https://github.com/dotnet/corefx/pull/27327#pullrequestreview-98384813 public void FlushDoesNotThrow() diff --git a/src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj b/src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj index 1ba8b542d1..1db176d5eb 100644 --- a/src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj +++ b/src/Servers/Kestrel/Core/test/Microsoft.AspNetCore.Server.Kestrel.Core.Tests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 true diff --git a/src/Servers/Kestrel/Kestrel/src/Microsoft.AspNetCore.Server.Kestrel.csproj b/src/Servers/Kestrel/Kestrel/src/Microsoft.AspNetCore.Server.Kestrel.csproj index 60e282fe82..7394ffae00 100644 --- a/src/Servers/Kestrel/Kestrel/src/Microsoft.AspNetCore.Server.Kestrel.csproj +++ b/src/Servers/Kestrel/Kestrel/src/Microsoft.AspNetCore.Server.Kestrel.csproj @@ -2,7 +2,7 @@ ASP.NET Core Kestrel cross-platform web server. - netstandard2.0 + netcoreapp3.0 true aspnetcore;kestrel CS1591;$(NoWarn) diff --git a/src/Servers/Kestrel/Kestrel/test/GeneratedCodeTests.cs b/src/Servers/Kestrel/Kestrel/test/GeneratedCodeTests.cs index e561f0cc21..f91bee1dd6 100644 --- a/src/Servers/Kestrel/Kestrel/test/GeneratedCodeTests.cs +++ b/src/Servers/Kestrel/Kestrel/test/GeneratedCodeTests.cs @@ -1,7 +1,6 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NETCOREAPP2_2 using System; using System.IO; using System.Linq; @@ -57,7 +56,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests } } } -#elif NET461 -#else -#error Target framework needs to be updated -#endif diff --git a/src/Servers/Kestrel/Kestrel/test/Microsoft.AspNetCore.Server.Kestrel.Tests.csproj b/src/Servers/Kestrel/Kestrel/test/Microsoft.AspNetCore.Server.Kestrel.Tests.csproj index ab8048acb8..1a91bad913 100644 --- a/src/Servers/Kestrel/Kestrel/test/Microsoft.AspNetCore.Server.Kestrel.Tests.csproj +++ b/src/Servers/Kestrel/Kestrel/test/Microsoft.AspNetCore.Server.Kestrel.Tests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 diff --git a/src/Servers/Kestrel/Transport.Abstractions/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.csproj b/src/Servers/Kestrel/Transport.Abstractions/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.csproj index e6d51dac8f..39c53a73ff 100644 --- a/src/Servers/Kestrel/Transport.Abstractions/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.csproj +++ b/src/Servers/Kestrel/Transport.Abstractions/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Abstractions.csproj @@ -2,7 +2,7 @@ Transport abstractions for the ASP.NET Core Kestrel cross-platform web server. - netstandard2.0 + netcoreapp3.0 true aspnetcore;kestrel CS1570;CS1571;CS1572;CS1573;CS1574;CS1591;$(NoWarn) diff --git a/src/Servers/Kestrel/Transport.Libuv/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.csproj b/src/Servers/Kestrel/Transport.Libuv/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.csproj index 001e97cdb6..b7b4f6d53e 100644 --- a/src/Servers/Kestrel/Transport.Libuv/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.csproj +++ b/src/Servers/Kestrel/Transport.Libuv/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.csproj @@ -1,8 +1,8 @@ - + Libuv transport for the ASP.NET Core Kestrel cross-platform web server. - netstandard2.0 + netcoreapp3.0 true aspnetcore;kestrel true diff --git a/src/Servers/Kestrel/Transport.Libuv/test/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests.csproj b/src/Servers/Kestrel/Transport.Libuv/test/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests.csproj index 17c05a6cd7..bb263e89a3 100644 --- a/src/Servers/Kestrel/Transport.Libuv/test/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests.csproj +++ b/src/Servers/Kestrel/Transport.Libuv/test/Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Tests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 true true diff --git a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketReceiver.cs b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketReceiver.cs index 3c3451cbcc..1888ab8755 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketReceiver.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketReceiver.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -15,13 +15,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal public SocketAwaitableEventArgs WaitForDataAsync() { -#if NETCOREAPP2_1 _awaitableEventArgs.SetBuffer(Memory.Empty); -#elif NETSTANDARD2_0 - _awaitableEventArgs.SetBuffer(Array.Empty(), 0, 0); -#else -#error TFMs need to be updated -#endif if (!_socket.ReceiveAsync(_awaitableEventArgs)) { @@ -33,15 +27,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal public SocketAwaitableEventArgs ReceiveAsync(Memory buffer) { -#if NETCOREAPP2_1 _awaitableEventArgs.SetBuffer(buffer); -#elif NETSTANDARD2_0 - var segment = buffer.GetArray(); - _awaitableEventArgs.SetBuffer(segment.Array, segment.Offset, segment.Count); -#else -#error TFMs need to be updated -#endif if (!_socket.ReceiveAsync(_awaitableEventArgs)) { _awaitableEventArgs.Complete(); diff --git a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketSender.cs b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketSender.cs index 4dba6aedb4..62583df05d 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketSender.cs +++ b/src/Servers/Kestrel/Transport.Sockets/src/Internal/SocketSender.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -26,13 +26,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal return SendAsync(buffers.First); } -#if NETCOREAPP2_1 if (!_awaitableEventArgs.MemoryBuffer.Equals(Memory.Empty)) -#elif NETSTANDARD2_0 - if (_awaitableEventArgs.Buffer != null) -#else -#error TFMs need to be updated -#endif { _awaitableEventArgs.SetBuffer(null, 0, 0); } @@ -55,15 +49,8 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.Internal _awaitableEventArgs.BufferList = null; } -#if NETCOREAPP2_1 _awaitableEventArgs.SetBuffer(MemoryMarshal.AsMemory(memory)); -#elif NETSTANDARD2_0 - var segment = memory.GetArray(); - _awaitableEventArgs.SetBuffer(segment.Array, segment.Offset, segment.Count); -#else -#error TFMs need to be updated -#endif if (!_socket.SendAsync(_awaitableEventArgs)) { _awaitableEventArgs.Complete(); diff --git a/src/Servers/Kestrel/Transport.Sockets/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj b/src/Servers/Kestrel/Transport.Sockets/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj index 82dde8daa8..2df07062fd 100644 --- a/src/Servers/Kestrel/Transport.Sockets/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj +++ b/src/Servers/Kestrel/Transport.Sockets/src/Microsoft.AspNetCore.Server.Kestrel.Transport.Sockets.csproj @@ -2,7 +2,7 @@ Managed socket transport for the ASP.NET Core Kestrel cross-platform web server. - netstandard2.0;netcoreapp2.1 + netcoreapp3.0 true aspnetcore;kestrel true diff --git a/src/Servers/Kestrel/perf/Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.csproj b/src/Servers/Kestrel/perf/Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.csproj index 8b6637c1d6..09655f7ca8 100644 --- a/src/Servers/Kestrel/perf/Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.csproj +++ b/src/Servers/Kestrel/perf/Kestrel.Performance/Microsoft.AspNetCore.Server.Kestrel.Performance.csproj @@ -1,7 +1,7 @@ - netcoreapp2.2 + netcoreapp3.0 Exe true true diff --git a/src/Servers/Kestrel/perf/PlatformBenchmarks/PlatformBenchmarks.csproj b/src/Servers/Kestrel/perf/PlatformBenchmarks/PlatformBenchmarks.csproj index 4460a67388..a1895bec47 100644 --- a/src/Servers/Kestrel/perf/PlatformBenchmarks/PlatformBenchmarks.csproj +++ b/src/Servers/Kestrel/perf/PlatformBenchmarks/PlatformBenchmarks.csproj @@ -1,4 +1,4 @@ - + netcoreapp3.0 diff --git a/src/Servers/Kestrel/samples/Http2SampleApp/Http2SampleApp.csproj b/src/Servers/Kestrel/samples/Http2SampleApp/Http2SampleApp.csproj index b367dd576a..c7eb03c2c1 100644 --- a/src/Servers/Kestrel/samples/Http2SampleApp/Http2SampleApp.csproj +++ b/src/Servers/Kestrel/samples/Http2SampleApp/Http2SampleApp.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2;net461 + netcoreapp3.0 false true diff --git a/src/Servers/Kestrel/samples/LargeResponseApp/LargeResponseApp.csproj b/src/Servers/Kestrel/samples/LargeResponseApp/LargeResponseApp.csproj index 6d4786c5b5..976d4df073 100644 --- a/src/Servers/Kestrel/samples/LargeResponseApp/LargeResponseApp.csproj +++ b/src/Servers/Kestrel/samples/LargeResponseApp/LargeResponseApp.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2;net461 + netcoreapp3.0 false true diff --git a/src/Servers/Kestrel/samples/PlaintextApp/PlaintextApp.csproj b/src/Servers/Kestrel/samples/PlaintextApp/PlaintextApp.csproj index 6d4786c5b5..976d4df073 100644 --- a/src/Servers/Kestrel/samples/PlaintextApp/PlaintextApp.csproj +++ b/src/Servers/Kestrel/samples/PlaintextApp/PlaintextApp.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2;net461 + netcoreapp3.0 false true diff --git a/src/Servers/Kestrel/samples/SampleApp/SampleApp.csproj b/src/Servers/Kestrel/samples/SampleApp/SampleApp.csproj index 9e8a0e6269..1e7a08eff7 100644 --- a/src/Servers/Kestrel/samples/SampleApp/SampleApp.csproj +++ b/src/Servers/Kestrel/samples/SampleApp/SampleApp.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 false true diff --git a/src/Servers/Kestrel/samples/SystemdTestApp/SystemdTestApp.csproj b/src/Servers/Kestrel/samples/SystemdTestApp/SystemdTestApp.csproj index 41aa0ed783..b651cc6cf9 100644 --- a/src/Servers/Kestrel/samples/SystemdTestApp/SystemdTestApp.csproj +++ b/src/Servers/Kestrel/samples/SystemdTestApp/SystemdTestApp.csproj @@ -1,7 +1,7 @@  - netcoreapp2.2;net461 + netcoreapp3.0 false true diff --git a/src/Servers/Kestrel/shared/test/PassThroughConnectionAdapter.cs b/src/Servers/Kestrel/shared/test/PassThroughConnectionAdapter.cs index 351a2c9e93..9f81ceec5f 100644 --- a/src/Servers/Kestrel/shared/test/PassThroughConnectionAdapter.cs +++ b/src/Servers/Kestrel/shared/test/PassThroughConnectionAdapter.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; @@ -140,7 +140,6 @@ namespace Microsoft.AspNetCore.Testing _innerStream.Close(); } -#if NETCOREAPP2_2 public override int Read(Span buffer) { return _innerStream.Read(buffer); @@ -165,10 +164,6 @@ namespace Microsoft.AspNetCore.Testing { _innerStream.CopyTo(destination, bufferSize); } -#elif NET461 -#else -#error TFMs need to be updated -#endif } } } diff --git a/src/Servers/Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs b/src/Servers/Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs index 0b81846e92..446be393dc 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/Http2/HandshakeTests.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NETCOREAPP2_2 - using System; using System.Net; using System.Net.Http; @@ -95,7 +93,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2 } } } -#elif NET461 // No ALPN support -#else -#error TFMs need updating -#endif \ No newline at end of file diff --git a/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs b/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs index d1f06974e6..cb7c5a1ee4 100644 --- a/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs +++ b/src/Servers/Kestrel/test/FunctionalTests/Http2/ShutdownTests.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NETCOREAPP2_2 - using System.Collections.Generic; using System.Net; using System.Net.Http; @@ -146,7 +144,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.FunctionalTests.Http2 } } } -#elif NET461 // No ALPN support -#else -#error TFMs need updating -#endif \ No newline at end of file diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/TlsTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/TlsTests.cs index f366f1dd0f..85c05798a6 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/TlsTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/TlsTests.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NETCOREAPP2_2 - using System.Collections.Generic; using System.IO; using System.IO.Pipelines; @@ -126,7 +124,3 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests.Http2 } } } -#elif NET461 // No ALPN support -#else -#error TFMs need updating -#endif \ No newline at end of file diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionAdapterTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionAdapterTests.cs index 572e717b80..ae9434642d 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionAdapterTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/HttpsConnectionAdapterTests.cs @@ -182,13 +182,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests { Assert.NotNull(connection); Assert.NotNull(connection.Features.Get()); -#if NETCOREAPP2_2 Assert.Equal("localhost", name); -#elif NET461 - Assert.Null(name); -#else -#error TFMs need to be updated -#endif selectorCalled++; return _x509Certificate2; } @@ -224,13 +218,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests { Assert.NotNull(connection); Assert.NotNull(connection.Features.Get()); -#if NETCOREAPP2_2 Assert.Equal("localhost", name); -#elif NET461 - Assert.Null(name); -#else -#error TFMs need to be updated -#endif selectorCalled++; if (selectorCalled == 1) { @@ -314,13 +302,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.InMemory.FunctionalTests { Assert.NotNull(connection); Assert.NotNull(connection.Features.Get()); -#if NETCOREAPP2_2 Assert.Equal("localhost", name); -#elif NET461 - Assert.Null(name); -#else -#error TFMs need to be updated -#endif selectorCalled++; return _x509Certificate2; } diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj b/src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj index 0e665b5fcd..293b468728 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/InMemory.FunctionalTests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 true InMemory.FunctionalTests diff --git a/src/Servers/Kestrel/test/Interop.FunctionalTests/ChromeTests.cs b/src/Servers/Kestrel/test/Interop.FunctionalTests/ChromeTests.cs index 1e402ba8bf..4c8551899c 100644 --- a/src/Servers/Kestrel/test/Interop.FunctionalTests/ChromeTests.cs +++ b/src/Servers/Kestrel/test/Interop.FunctionalTests/ChromeTests.cs @@ -1,8 +1,6 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -#if NETCOREAPP2_2 - using System; using System.IO; using System.Net; @@ -135,8 +133,3 @@ namespace Interop.FunctionalTests } } } - -#elif NET461 // No ALPN support -#else -#error TFMs need updating -#endif diff --git a/src/Servers/Kestrel/test/Interop.FunctionalTests/Interop.FunctionalTests.csproj b/src/Servers/Kestrel/test/Interop.FunctionalTests/Interop.FunctionalTests.csproj index acfdb652fe..b420aac5f5 100644 --- a/src/Servers/Kestrel/test/Interop.FunctionalTests/Interop.FunctionalTests.csproj +++ b/src/Servers/Kestrel/test/Interop.FunctionalTests/Interop.FunctionalTests.csproj @@ -1,7 +1,7 @@ - netcoreapp2.2 + netcoreapp3.0 true Interop.FunctionalTests CS8002;$(WarningsNotAsErrors) diff --git a/src/Servers/Kestrel/test/Libuv.BindTests/Libuv.BindTests.csproj b/src/Servers/Kestrel/test/Libuv.BindTests/Libuv.BindTests.csproj index 492ee2f12a..690d9f5d9b 100644 --- a/src/Servers/Kestrel/test/Libuv.BindTests/Libuv.BindTests.csproj +++ b/src/Servers/Kestrel/test/Libuv.BindTests/Libuv.BindTests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 true Libuv.BindTests diff --git a/src/Servers/Kestrel/test/Libuv.FunctionalTests/Libuv.FunctionalTests.csproj b/src/Servers/Kestrel/test/Libuv.FunctionalTests/Libuv.FunctionalTests.csproj index 70253c4aba..30392ae11e 100644 --- a/src/Servers/Kestrel/test/Libuv.FunctionalTests/Libuv.FunctionalTests.csproj +++ b/src/Servers/Kestrel/test/Libuv.FunctionalTests/Libuv.FunctionalTests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 $(DefineConstants);MACOS true diff --git a/src/Servers/Kestrel/test/Sockets.BindTests/Sockets.BindTests.csproj b/src/Servers/Kestrel/test/Sockets.BindTests/Sockets.BindTests.csproj index cabf3e90b0..b0622e4eb3 100644 --- a/src/Servers/Kestrel/test/Sockets.BindTests/Sockets.BindTests.csproj +++ b/src/Servers/Kestrel/test/Sockets.BindTests/Sockets.BindTests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 true Sockets.BindTests diff --git a/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj b/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj index b297d34d66..56a6b3c42e 100644 --- a/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj +++ b/src/Servers/Kestrel/test/Sockets.FunctionalTests/Sockets.FunctionalTests.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2;net461 + netcoreapp3.0 $(DefineConstants);MACOS true Sockets.FunctionalTests diff --git a/src/Servers/Kestrel/tools/CodeGenerator/CodeGenerator.csproj b/src/Servers/Kestrel/tools/CodeGenerator/CodeGenerator.csproj index d4c557726d..634bac96d1 100644 --- a/src/Servers/Kestrel/tools/CodeGenerator/CodeGenerator.csproj +++ b/src/Servers/Kestrel/tools/CodeGenerator/CodeGenerator.csproj @@ -1,7 +1,7 @@ - + - netcoreapp2.2 + netcoreapp3.0 Exe false true From 12966c63a600ffca6c3eb4fb62a90a8e2dc1bec0 Mon Sep 17 00:00:00 2001 From: Chris Ross Date: Wed, 12 Dec 2018 10:04:36 -0800 Subject: [PATCH 022/297] Change DataProtection projects to target netcoreapp3.0 #3754 (#4473) --- build/artifacts.props | 1 - eng/ProjectReferences.props | 1 - ...NetCore.DataProtection.Abstractions.csproj | 2 +- ...e.DataProtection.Abstractions.Tests.csproj | 2 +- ...etCore.DataProtection.AzureKeyVault.csproj | 2 +- ....DataProtection.AzureKeyVault.Tests.csproj | 2 +- ...NetCore.DataProtection.AzureStorage.csproj | 2 +- ...e.DataProtection.AzureStorage.Tests.csproj | 2 +- ...ft.AspNetCore.Cryptography.Internal.csproj | 2 +- ...NetCore.Cryptography.Internal.Tests.csproj | 2 +- ...pNetCore.Cryptography.KeyDerivation.csproj | 2 +- ...re.Cryptography.KeyDerivation.Tests.csproj | 2 +- src/DataProtection/DataProtection.sln | 15 -- ...Microsoft.AspNetCore.DataProtection.csproj | 2 +- ...oft.AspNetCore.DataProtection.Tests.csproj | 2 +- ....DataProtection.EntityFrameworkCore.csproj | 2 +- ...Protection.EntityFrameworkCore.Test.csproj | 2 +- ...spNetCore.DataProtection.Extensions.csproj | 2 +- ...ore.DataProtection.Extensions.Tests.csproj | 2 +- ...e.DataProtection.StackExchangeRedis.csproj | 2 +- ...Protection.StackExchangeRedis.Tests.csproj | 2 +- .../src/CompatibilityDataProtector.cs | 133 --------------- .../SystemWeb/src/DataProtectionStartup.cs | 102 ------------ ...AspNetCore.DataProtection.SystemWeb.csproj | 22 --- .../src/Properties/Resources.Designer.cs | 58 ------- .../SystemWeb/src/Resources.resx | 126 -------------- .../SystemWeb/src/baseline.netframework.json | 157 ------------------ .../SystemWeb/src/web.config.transform | 14 -- .../CustomEncryptorSample.csproj | 2 +- .../EntityFrameworkCoreSample.csproj | 2 +- .../KeyManagementSample.csproj | 2 +- .../samples/NonDISample/NonDISample.csproj | 2 +- src/DataProtection/samples/Redis/Redis.csproj | 2 +- 33 files changed, 23 insertions(+), 652 deletions(-) delete mode 100644 src/DataProtection/SystemWeb/src/CompatibilityDataProtector.cs delete mode 100644 src/DataProtection/SystemWeb/src/DataProtectionStartup.cs delete mode 100644 src/DataProtection/SystemWeb/src/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj delete mode 100644 src/DataProtection/SystemWeb/src/Properties/Resources.Designer.cs delete mode 100644 src/DataProtection/SystemWeb/src/Resources.resx delete mode 100644 src/DataProtection/SystemWeb/src/baseline.netframework.json delete mode 100644 src/DataProtection/SystemWeb/src/web.config.transform diff --git a/build/artifacts.props b/build/artifacts.props index dbe6135b65..b69363a093 100644 --- a/build/artifacts.props +++ b/build/artifacts.props @@ -115,7 +115,6 @@ - diff --git a/eng/ProjectReferences.props b/eng/ProjectReferences.props index 080f4c9659..c7d5ab8130 100644 --- a/eng/ProjectReferences.props +++ b/eng/ProjectReferences.props @@ -12,7 +12,6 @@ - diff --git a/src/DataProtection/Abstractions/src/Microsoft.AspNetCore.DataProtection.Abstractions.csproj b/src/DataProtection/Abstractions/src/Microsoft.AspNetCore.DataProtection.Abstractions.csproj index 021b3fde2c..2beeb5f0bb 100644 --- a/src/DataProtection/Abstractions/src/Microsoft.AspNetCore.DataProtection.Abstractions.csproj +++ b/src/DataProtection/Abstractions/src/Microsoft.AspNetCore.DataProtection.Abstractions.csproj @@ -5,7 +5,7 @@ Commonly used types: Microsoft.AspNetCore.DataProtection.IDataProtectionProvider Microsoft.AspNetCore.DataProtection.IDataProtector - netstandard2.0 + netcoreapp3.0 true aspnetcore;dataprotection diff --git a/src/DataProtection/Abstractions/test/Microsoft.AspNetCore.DataProtection.Abstractions.Tests.csproj b/src/DataProtection/Abstractions/test/Microsoft.AspNetCore.DataProtection.Abstractions.Tests.csproj index 781387c466..0f17586d23 100644 --- a/src/DataProtection/Abstractions/test/Microsoft.AspNetCore.DataProtection.Abstractions.Tests.csproj +++ b/src/DataProtection/Abstractions/test/Microsoft.AspNetCore.DataProtection.Abstractions.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 diff --git a/src/DataProtection/AzureKeyVault/src/Microsoft.AspNetCore.DataProtection.AzureKeyVault.csproj b/src/DataProtection/AzureKeyVault/src/Microsoft.AspNetCore.DataProtection.AzureKeyVault.csproj index 42aa2edb13..58167df456 100644 --- a/src/DataProtection/AzureKeyVault/src/Microsoft.AspNetCore.DataProtection.AzureKeyVault.csproj +++ b/src/DataProtection/AzureKeyVault/src/Microsoft.AspNetCore.DataProtection.AzureKeyVault.csproj @@ -2,7 +2,7 @@ Microsoft Azure KeyVault key encryption support. - netstandard2.0 + netcoreapp3.0 true aspnetcore;dataprotection;azure;keyvault false diff --git a/src/DataProtection/AzureKeyVault/test/Microsoft.AspNetCore.DataProtection.AzureKeyVault.Tests.csproj b/src/DataProtection/AzureKeyVault/test/Microsoft.AspNetCore.DataProtection.AzureKeyVault.Tests.csproj index 879b9042a1..17b9fe4ac8 100644 --- a/src/DataProtection/AzureKeyVault/test/Microsoft.AspNetCore.DataProtection.AzureKeyVault.Tests.csproj +++ b/src/DataProtection/AzureKeyVault/test/Microsoft.AspNetCore.DataProtection.AzureKeyVault.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 true diff --git a/src/DataProtection/AzureStorage/src/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj b/src/DataProtection/AzureStorage/src/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj index d65f55a425..d7042db87a 100644 --- a/src/DataProtection/AzureStorage/src/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj +++ b/src/DataProtection/AzureStorage/src/Microsoft.AspNetCore.DataProtection.AzureStorage.csproj @@ -2,7 +2,7 @@ Microsoft Azure Blob storrage support as key store. - netstandard2.0 + netcoreapp3.0 true true aspnetcore;dataprotection;azure;blob diff --git a/src/DataProtection/AzureStorage/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Tests.csproj b/src/DataProtection/AzureStorage/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Tests.csproj index f84e84974e..ed16b18390 100644 --- a/src/DataProtection/AzureStorage/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Tests.csproj +++ b/src/DataProtection/AzureStorage/test/Microsoft.AspNetCore.DataProtection.AzureStorage.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 true diff --git a/src/DataProtection/Cryptography.Internal/src/Microsoft.AspNetCore.Cryptography.Internal.csproj b/src/DataProtection/Cryptography.Internal/src/Microsoft.AspNetCore.Cryptography.Internal.csproj index ff4ef3babe..9859f30a11 100644 --- a/src/DataProtection/Cryptography.Internal/src/Microsoft.AspNetCore.Cryptography.Internal.csproj +++ b/src/DataProtection/Cryptography.Internal/src/Microsoft.AspNetCore.Cryptography.Internal.csproj @@ -2,7 +2,7 @@ Infrastructure for ASP.NET Core cryptographic packages. Applications and libraries should not reference this package directly. - netstandard2.0 + netcoreapp3.0 $(NoWarn);CS1591 true true diff --git a/src/DataProtection/Cryptography.Internal/test/Microsoft.AspNetCore.Cryptography.Internal.Tests.csproj b/src/DataProtection/Cryptography.Internal/test/Microsoft.AspNetCore.Cryptography.Internal.Tests.csproj index 29e8a7c294..1fa55228db 100644 --- a/src/DataProtection/Cryptography.Internal/test/Microsoft.AspNetCore.Cryptography.Internal.Tests.csproj +++ b/src/DataProtection/Cryptography.Internal/test/Microsoft.AspNetCore.Cryptography.Internal.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 true diff --git a/src/DataProtection/Cryptography.KeyDerivation/src/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj b/src/DataProtection/Cryptography.KeyDerivation/src/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj index 3b869383e6..69982996dc 100644 --- a/src/DataProtection/Cryptography.KeyDerivation/src/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj +++ b/src/DataProtection/Cryptography.KeyDerivation/src/Microsoft.AspNetCore.Cryptography.KeyDerivation.csproj @@ -2,7 +2,7 @@ ASP.NET Core utilities for key derivation. - netstandard2.0;netcoreapp3.0 + netcoreapp3.0 true true aspnetcore;dataprotection diff --git a/src/DataProtection/Cryptography.KeyDerivation/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests.csproj b/src/DataProtection/Cryptography.KeyDerivation/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests.csproj index e7a1be7ece..5d3ff930af 100644 --- a/src/DataProtection/Cryptography.KeyDerivation/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests.csproj +++ b/src/DataProtection/Cryptography.KeyDerivation/test/Microsoft.AspNetCore.Cryptography.KeyDerivation.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 true diff --git a/src/DataProtection/DataProtection.sln b/src/DataProtection/DataProtection.sln index 5300acb57a..48b89d6e00 100644 --- a/src/DataProtection/DataProtection.sln +++ b/src/DataProtection/DataProtection.sln @@ -65,8 +65,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NonDISample", "samples\NonD EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Redis", "samples\Redis\Redis.csproj", "{E578D5C2-76AD-4A9B-A4F0-3A74D7ACD98E}" EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SystemWeb", "SystemWeb", "{AA4BAE43-BD74-4292-8468-46F4DF60F9C7}" -EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.AspNetCore.DataProtection.SystemWeb", "SystemWeb\src\Microsoft.AspNetCore.DataProtection.SystemWeb.csproj", "{A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}" EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "EntityFrameworkCore", "EntityFrameworkCore", "{64FD02D7-B6F4-4C77-A3F8-E6BD6404168E}" @@ -352,18 +350,6 @@ Global {E578D5C2-76AD-4A9B-A4F0-3A74D7ACD98E}.Release|x64.Build.0 = Release|Any CPU {E578D5C2-76AD-4A9B-A4F0-3A74D7ACD98E}.Release|x86.ActiveCfg = Release|Any CPU {E578D5C2-76AD-4A9B-A4F0-3A74D7ACD98E}.Release|x86.Build.0 = Release|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Debug|x64.ActiveCfg = Debug|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Debug|x64.Build.0 = Debug|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Debug|x86.ActiveCfg = Debug|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Debug|x86.Build.0 = Debug|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Release|Any CPU.Build.0 = Release|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Release|x64.ActiveCfg = Release|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Release|x64.Build.0 = Release|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Release|x86.ActiveCfg = Release|Any CPU - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7}.Release|x86.Build.0 = Release|Any CPU {8A7D0D2D-A5F1-4DF7-BBAA-9A0EFDBB5224}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {8A7D0D2D-A5F1-4DF7-BBAA-9A0EFDBB5224}.Debug|Any CPU.Build.0 = Debug|Any CPU {8A7D0D2D-A5F1-4DF7-BBAA-9A0EFDBB5224}.Debug|x64.ActiveCfg = Debug|Any CPU @@ -412,7 +398,6 @@ Global {03406538-75CB-4655-B210-643FE11A2B00} = {9DF098B3-C8ED-471C-AE03-52E3196C1811} {C5C425C8-5626-409B-9A81-4DC496CE41F4} = {9DF098B3-C8ED-471C-AE03-52E3196C1811} {E578D5C2-76AD-4A9B-A4F0-3A74D7ACD98E} = {9DF098B3-C8ED-471C-AE03-52E3196C1811} - {A65DAFB6-E03F-4140-892F-D7CA3B8D81D7} = {AA4BAE43-BD74-4292-8468-46F4DF60F9C7} {8A7D0D2D-A5F1-4DF7-BBAA-9A0EFDBB5224} = {64FD02D7-B6F4-4C77-A3F8-E6BD6404168E} {74CE0E8B-DE23-4B53-8D02-69D6FB849ADC} = {64FD02D7-B6F4-4C77-A3F8-E6BD6404168E} EndGlobalSection diff --git a/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj b/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj index 18aa5ddc40..c843a00dd4 100644 --- a/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj +++ b/src/DataProtection/DataProtection/src/Microsoft.AspNetCore.DataProtection.csproj @@ -2,7 +2,7 @@ ASP.NET Core logic to protect and unprotect data, similar to DPAPI. - netstandard2.0 + netcoreapp3.0 $(NoWarn);CS1591 true true diff --git a/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests.csproj b/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests.csproj index 3886642178..2dd82b92b4 100644 --- a/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests.csproj +++ b/src/DataProtection/DataProtection/test/Microsoft.AspNetCore.DataProtection.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 true diff --git a/src/DataProtection/EntityFrameworkCore/src/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.csproj b/src/DataProtection/EntityFrameworkCore/src/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.csproj index 85f5e47c55..f0713f0ecb 100644 --- a/src/DataProtection/EntityFrameworkCore/src/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.csproj +++ b/src/DataProtection/EntityFrameworkCore/src/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.csproj @@ -2,7 +2,7 @@ Support for storing keys using Entity Framework Core. - netstandard2.0 + netcoreapp3.0 true true aspnetcore;dataprotection;entityframeworkcore diff --git a/src/DataProtection/EntityFrameworkCore/test/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj b/src/DataProtection/EntityFrameworkCore/test/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj index f08eb96c9b..6d3e504879 100644 --- a/src/DataProtection/EntityFrameworkCore/test/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj +++ b/src/DataProtection/EntityFrameworkCore/test/Microsoft.AspNetCore.DataProtection.EntityFrameworkCore.Test.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 diff --git a/src/DataProtection/Extensions/src/Microsoft.AspNetCore.DataProtection.Extensions.csproj b/src/DataProtection/Extensions/src/Microsoft.AspNetCore.DataProtection.Extensions.csproj index c106a52961..7a4c008f78 100644 --- a/src/DataProtection/Extensions/src/Microsoft.AspNetCore.DataProtection.Extensions.csproj +++ b/src/DataProtection/Extensions/src/Microsoft.AspNetCore.DataProtection.Extensions.csproj @@ -2,7 +2,7 @@ Additional APIs for ASP.NET Core data protection. - netstandard2.0 + netcoreapp3.0 true aspnetcore;dataprotection diff --git a/src/DataProtection/Extensions/test/Microsoft.AspNetCore.DataProtection.Extensions.Tests.csproj b/src/DataProtection/Extensions/test/Microsoft.AspNetCore.DataProtection.Extensions.Tests.csproj index 19284dddfd..1df9abdd17 100644 --- a/src/DataProtection/Extensions/test/Microsoft.AspNetCore.DataProtection.Extensions.Tests.csproj +++ b/src/DataProtection/Extensions/test/Microsoft.AspNetCore.DataProtection.Extensions.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 diff --git a/src/DataProtection/StackExchangeRedis/src/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj b/src/DataProtection/StackExchangeRedis/src/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj index 6e2143d602..a53d924f3c 100644 --- a/src/DataProtection/StackExchangeRedis/src/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj +++ b/src/DataProtection/StackExchangeRedis/src/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.csproj @@ -2,7 +2,7 @@ Support for storing data protection keys in Redis. - netstandard2.0 + netcoreapp3.0 true true aspnetcore;dataprotection;redis diff --git a/src/DataProtection/StackExchangeRedis/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests.csproj b/src/DataProtection/StackExchangeRedis/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests.csproj index 964abdb650..ff9e397e77 100644 --- a/src/DataProtection/StackExchangeRedis/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests.csproj +++ b/src/DataProtection/StackExchangeRedis/test/Microsoft.AspNetCore.DataProtection.StackExchangeRedis.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.0;net461 + netcoreapp3.0 diff --git a/src/DataProtection/SystemWeb/src/CompatibilityDataProtector.cs b/src/DataProtection/SystemWeb/src/CompatibilityDataProtector.cs deleted file mode 100644 index 739afe83bd..0000000000 --- a/src/DataProtection/SystemWeb/src/CompatibilityDataProtector.cs +++ /dev/null @@ -1,133 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel; -using System.Configuration; -using System.Security.Cryptography; - -namespace Microsoft.AspNetCore.DataProtection.SystemWeb -{ - /// - /// A that can be used by ASP.NET 4.x to interact with ASP.NET Core's - /// DataProtection stack. This type is for internal use only and shouldn't be directly used by - /// developers. - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public sealed class CompatibilityDataProtector : DataProtector - { - private static readonly Lazy _lazyProtectionProvider = new Lazy(CreateProtectionProvider); - - [ThreadStatic] - private static bool _suppressPrimaryPurpose; - - private readonly Lazy _lazyProtector; - private readonly Lazy _lazyProtectorSuppressedPrimaryPurpose; - - public CompatibilityDataProtector(string applicationName, string primaryPurpose, string[] specificPurposes) - : base("application-name", "primary-purpose", null) // we feed dummy values to the base ctor - { - // We don't want to evaluate the IDataProtectionProvider factory quite yet, - // as we'd rather defer failures to the call to Protect so that we can bubble - // up a good error message to the developer. - - _lazyProtector = new Lazy(() => _lazyProtectionProvider.Value.CreateProtector(primaryPurpose, specificPurposes)); - - // System.Web always provides "User.MachineKey.Protect" as the primary purpose for calls - // to MachineKey.Protect. Only in this case should we allow suppressing the primary - // purpose, as then we can easily map calls to MachineKey.Protect(userData, purposes) - // into calls to provider.GetProtector(purposes).Protect(userData). - if (primaryPurpose == "User.MachineKey.Protect") - { - _lazyProtectorSuppressedPrimaryPurpose = new Lazy(() => _lazyProtectionProvider.Value.CreateProtector(specificPurposes)); - } - else - { - _lazyProtectorSuppressedPrimaryPurpose = _lazyProtector; - } - } - - // We take care of flowing purposes ourselves. - protected override bool PrependHashedPurposeToPlaintext { get; } = false; - - // Retrieves the appropriate protector (potentially with a suppressed primary purpose) for this operation. - private IDataProtector Protector => ((_suppressPrimaryPurpose) ? _lazyProtectorSuppressedPrimaryPurpose : _lazyProtector).Value; - - private static IDataProtectionProvider CreateProtectionProvider() - { - // Read from the startup type we need to use, then create it - const string APPSETTINGS_KEY = "aspnet:dataProtectionStartupType"; - string startupTypeName = ConfigurationManager.AppSettings[APPSETTINGS_KEY]; - if (String.IsNullOrEmpty(startupTypeName)) - { - // fall back to default startup type if one hasn't been specified in config - startupTypeName = typeof(DataProtectionStartup).AssemblyQualifiedName; - } - Type startupType = Type.GetType(startupTypeName, throwOnError: true); - var startupInstance = (DataProtectionStartup)Activator.CreateInstance(startupType); - - // Use it to initialize the system. - return startupInstance.InternalConfigureServicesAndCreateProtectionProvider(); - } - - public override bool IsReprotectRequired(byte[] encryptedData) - { - // Nobody ever calls this. - return false; - } - - protected override byte[] ProviderProtect(byte[] userData) - { - try - { - return Protector.Protect(userData); - } - catch (Exception ex) - { - // System.Web special-cases ConfigurationException errors and allows them to bubble - // up to the developer without being homogenized. Since a call to Protect should - // never fail, any exceptions here really do imply a misconfiguration. - -#pragma warning disable CS0618 // Type or member is obsolete - throw new ConfigurationException(Resources.DataProtector_ProtectFailed, ex); -#pragma warning restore CS0618 // Type or member is obsolete - } - } - - protected override byte[] ProviderUnprotect(byte[] encryptedData) - { - return Protector.Unprotect(encryptedData); - } - - /// - /// Invokes a delegate where calls to - /// and will ignore the primary - /// purpose and instead use only the sub-purposes. - /// - public static byte[] RunWithSuppressedPrimaryPurpose(Func callback, object state, byte[] input) - { - if (_suppressPrimaryPurpose) - { - return callback(state, input); // already suppressed - just forward call - } - - try - { - try - { - _suppressPrimaryPurpose = true; - return callback(state, input); - } - finally - { - _suppressPrimaryPurpose = false; - } - } - catch - { - // defeat exception filters - throw; - } - } - } -} diff --git a/src/DataProtection/SystemWeb/src/DataProtectionStartup.cs b/src/DataProtection/SystemWeb/src/DataProtectionStartup.cs deleted file mode 100644 index f3760df207..0000000000 --- a/src/DataProtection/SystemWeb/src/DataProtectionStartup.cs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Configuration; -using System.Web; -using System.Web.Configuration; -using Microsoft.AspNetCore.DataProtection.Infrastructure; -using Microsoft.Extensions.DependencyInjection; - -namespace Microsoft.AspNetCore.DataProtection.SystemWeb -{ - /// - /// Allows controlling the configuration of the ASP.NET Core Data Protection system. - /// - /// - /// Developers should not call these APIs directly. Instead, developers should subclass - /// this type and override the - /// method or methods - /// as appropriate. - /// - public class DataProtectionStartup - { - /// - /// Configures services used by the Data Protection system. - /// - /// A mutable collection of services. - /// - /// Developers may override this method to change the default behaviors of - /// the Data Protection system. - /// - public virtual void ConfigureServices(IServiceCollection services) - { - // InternalConfigureServices already takes care of default configuration. - // The reason we don't configure default logic in this method is that we don't - // want to punish the developer for forgetting to call base.ConfigureServices - // from within his own override. - } - - /// - /// Creates a new instance of an . - /// - /// A collection of services from which to create the . - /// An . - /// - /// Developers should generally override the - /// method instead of this method. - /// - public virtual IDataProtectionProvider CreateDataProtectionProvider(IServiceProvider services) - { - return services.GetDataProtectionProvider(); - } - - /// - /// Provides a default implementation of required services, calls the developer's - /// configuration overrides, then creates an . - /// - internal IDataProtectionProvider InternalConfigureServicesAndCreateProtectionProvider() - { - // Configure the default implementation, passing in our custom discriminator - var services = new ServiceCollection(); - services.AddDataProtection(); - services.AddSingleton(new SystemWebApplicationDiscriminator()); - - // Run user-specified configuration and get an instance of the provider - ConfigureServices(services); - var provider = CreateDataProtectionProvider(services.BuildServiceProvider()); - if (provider == null) - { - throw new InvalidOperationException(Resources.Startup_CreateProviderReturnedNull); - } - - // And we're done! - return provider; - } - - private sealed class SystemWebApplicationDiscriminator : IApplicationDiscriminator - { - private readonly Lazy _lazyDiscriminator = new Lazy(GetAppDiscriminatorCore); - - public string Discriminator => _lazyDiscriminator.Value; - - private static string GetAppDiscriminatorCore() - { - // Try reading the discriminator from defined - // at the web app root. If the value was set explicitly (even if the value is empty), - // honor it as the discriminator. - var machineKeySection = (MachineKeySection)WebConfigurationManager.GetWebApplicationSection("system.web/machineKey"); - if (machineKeySection.ElementInformation.Properties["applicationName"].ValueOrigin != PropertyValueOrigin.Default) - { - return machineKeySection.ApplicationName; - } - else - { - // Otherwise, fall back to the IIS metabase config path. - // This is unique per machine. - return HttpRuntime.AppDomainAppId; - } - } - } - } -} diff --git a/src/DataProtection/SystemWeb/src/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj b/src/DataProtection/SystemWeb/src/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj deleted file mode 100644 index 603fe68cc8..0000000000 --- a/src/DataProtection/SystemWeb/src/Microsoft.AspNetCore.DataProtection.SystemWeb.csproj +++ /dev/null @@ -1,22 +0,0 @@ - - - - A component to allow the ASP.NET Core data protection stack to work with the ASP.NET 4.x <machineKey> element. - net461 - $(NoWarn);CS1591 - true - aspnet;aspnetcore;dataprotection - - - - - - - - - - - - - - diff --git a/src/DataProtection/SystemWeb/src/Properties/Resources.Designer.cs b/src/DataProtection/SystemWeb/src/Properties/Resources.Designer.cs deleted file mode 100644 index ddc7e53910..0000000000 --- a/src/DataProtection/SystemWeb/src/Properties/Resources.Designer.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -namespace Microsoft.AspNetCore.DataProtection.SystemWeb -{ - using System.Globalization; - using System.Reflection; - using System.Resources; - - internal static class Resources - { - private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.AspNetCore.DataProtection.SystemWeb.Resources", typeof(Resources).GetTypeInfo().Assembly); - - /// - /// A call to Protect failed. This most likely means that the data protection system is misconfigured. See the inner exception for more information. - /// - internal static string DataProtector_ProtectFailed - { - get => GetString("DataProtector_ProtectFailed"); - } - - /// - /// A call to Protect failed. This most likely means that the data protection system is misconfigured. See the inner exception for more information. - /// - internal static string FormatDataProtector_ProtectFailed() - => GetString("DataProtector_ProtectFailed"); - - /// - /// The CreateDataProtectionProvider method returned null. - /// - internal static string Startup_CreateProviderReturnedNull - { - get => GetString("Startup_CreateProviderReturnedNull"); - } - - /// - /// The CreateDataProtectionProvider method returned null. - /// - internal static string FormatStartup_CreateProviderReturnedNull() - => GetString("Startup_CreateProviderReturnedNull"); - - private static string GetString(string name, params string[] formatterNames) - { - var value = _resourceManager.GetString(name); - - System.Diagnostics.Debug.Assert(value != null); - - if (formatterNames != null) - { - for (var i = 0; i < formatterNames.Length; i++) - { - value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); - } - } - - return value; - } - } -} diff --git a/src/DataProtection/SystemWeb/src/Resources.resx b/src/DataProtection/SystemWeb/src/Resources.resx deleted file mode 100644 index 0923e71d3c..0000000000 --- a/src/DataProtection/SystemWeb/src/Resources.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - A call to Protect failed. This most likely means that the data protection system is misconfigured. See the inner exception for more information. - - - The CreateDataProtectionProvider method returned null. - - \ No newline at end of file diff --git a/src/DataProtection/SystemWeb/src/baseline.netframework.json b/src/DataProtection/SystemWeb/src/baseline.netframework.json deleted file mode 100644 index c068f832bb..0000000000 --- a/src/DataProtection/SystemWeb/src/baseline.netframework.json +++ /dev/null @@ -1,157 +0,0 @@ -{ - "AssemblyIdentity": "Microsoft.AspNetCore.DataProtection.SystemWeb, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60", - "Types": [ - { - "Name": "Microsoft.AspNetCore.DataProtection.SystemWeb.CompatibilityDataProtector", - "Visibility": "Public", - "Kind": "Class", - "Sealed": true, - "BaseType": "System.Security.Cryptography.DataProtector", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "get_PrependHashedPurposeToPlaintext", - "Parameters": [], - "ReturnType": "System.Boolean", - "Virtual": true, - "Override": true, - "Visibility": "Protected", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "IsReprotectRequired", - "Parameters": [ - { - "Name": "encryptedData", - "Type": "System.Byte[]" - } - ], - "ReturnType": "System.Boolean", - "Virtual": true, - "Override": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ProviderProtect", - "Parameters": [ - { - "Name": "userData", - "Type": "System.Byte[]" - } - ], - "ReturnType": "System.Byte[]", - "Virtual": true, - "Override": true, - "Visibility": "Protected", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "ProviderUnprotect", - "Parameters": [ - { - "Name": "encryptedData", - "Type": "System.Byte[]" - } - ], - "ReturnType": "System.Byte[]", - "Virtual": true, - "Override": true, - "Visibility": "Protected", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "RunWithSuppressedPrimaryPurpose", - "Parameters": [ - { - "Name": "callback", - "Type": "System.Func" - }, - { - "Name": "state", - "Type": "System.Object" - }, - { - "Name": "input", - "Type": "System.Byte[]" - } - ], - "ReturnType": "System.Byte[]", - "Static": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [ - { - "Name": "applicationName", - "Type": "System.String" - }, - { - "Name": "primaryPurpose", - "Type": "System.String" - }, - { - "Name": "specificPurposes", - "Type": "System.String[]" - } - ], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - }, - { - "Name": "Microsoft.AspNetCore.DataProtection.SystemWeb.DataProtectionStartup", - "Visibility": "Public", - "Kind": "Class", - "ImplementedInterfaces": [], - "Members": [ - { - "Kind": "Method", - "Name": "ConfigureServices", - "Parameters": [ - { - "Name": "services", - "Type": "Microsoft.Extensions.DependencyInjection.IServiceCollection" - } - ], - "ReturnType": "System.Void", - "Virtual": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Method", - "Name": "CreateDataProtectionProvider", - "Parameters": [ - { - "Name": "services", - "Type": "System.IServiceProvider" - } - ], - "ReturnType": "Microsoft.AspNetCore.DataProtection.IDataProtectionProvider", - "Virtual": true, - "Visibility": "Public", - "GenericParameter": [] - }, - { - "Kind": "Constructor", - "Name": ".ctor", - "Parameters": [], - "Visibility": "Public", - "GenericParameter": [] - } - ], - "GenericParameters": [] - } - ] -} \ No newline at end of file diff --git a/src/DataProtection/SystemWeb/src/web.config.transform b/src/DataProtection/SystemWeb/src/web.config.transform deleted file mode 100644 index 8d5a699252..0000000000 --- a/src/DataProtection/SystemWeb/src/web.config.transform +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - diff --git a/src/DataProtection/samples/CustomEncryptorSample/CustomEncryptorSample.csproj b/src/DataProtection/samples/CustomEncryptorSample/CustomEncryptorSample.csproj index de4c5e9e38..c4afb59727 100644 --- a/src/DataProtection/samples/CustomEncryptorSample/CustomEncryptorSample.csproj +++ b/src/DataProtection/samples/CustomEncryptorSample/CustomEncryptorSample.csproj @@ -1,7 +1,7 @@ - net461;netcoreapp3.0 + netcoreapp3.0 exe diff --git a/src/DataProtection/samples/EntityFrameworkCoreSample/EntityFrameworkCoreSample.csproj b/src/DataProtection/samples/EntityFrameworkCoreSample/EntityFrameworkCoreSample.csproj index 1254c35689..c6e228f0e0 100644 --- a/src/DataProtection/samples/EntityFrameworkCoreSample/EntityFrameworkCoreSample.csproj +++ b/src/DataProtection/samples/EntityFrameworkCoreSample/EntityFrameworkCoreSample.csproj @@ -2,7 +2,7 @@ exe - net461;netcoreapp3.0 + netcoreapp3.0 diff --git a/src/DataProtection/samples/KeyManagementSample/KeyManagementSample.csproj b/src/DataProtection/samples/KeyManagementSample/KeyManagementSample.csproj index 5ec8e7b074..a996ad452a 100644 --- a/src/DataProtection/samples/KeyManagementSample/KeyManagementSample.csproj +++ b/src/DataProtection/samples/KeyManagementSample/KeyManagementSample.csproj @@ -1,7 +1,7 @@ - net461;netcoreapp3.0 + netcoreapp3.0 exe diff --git a/src/DataProtection/samples/NonDISample/NonDISample.csproj b/src/DataProtection/samples/NonDISample/NonDISample.csproj index 04956556af..8dd5fd3f1a 100644 --- a/src/DataProtection/samples/NonDISample/NonDISample.csproj +++ b/src/DataProtection/samples/NonDISample/NonDISample.csproj @@ -1,7 +1,7 @@ - net461;netcoreapp3.0 + netcoreapp3.0 exe diff --git a/src/DataProtection/samples/Redis/Redis.csproj b/src/DataProtection/samples/Redis/Redis.csproj index fe41c02daf..f30e056234 100644 --- a/src/DataProtection/samples/Redis/Redis.csproj +++ b/src/DataProtection/samples/Redis/Redis.csproj @@ -1,7 +1,7 @@  - net461;netcoreapp3.0 + netcoreapp3.0 exe From 226f2c0c2c74035404150c03b8261871182205ee Mon Sep 17 00:00:00 2001 From: Justin Kotalik Date: Wed, 12 Dec 2018 13:09:15 -0500 Subject: [PATCH 023/297] Adds MinimumReadThreshold to StreamPipeReader. (#4372) --- src/Http/Http/src/StreamPipeReader.cs | 73 ++++++----- src/Http/Http/src/StreamPipeReaderOptions.cs | 31 +++++ .../Http/test/FlushResultCancellationTests.cs | 2 +- src/Http/Http/test/PipeTest.cs | 9 +- src/Http/Http/test/StreamPipeReaderTests.cs | 121 ++++++++++++++---- 5 files changed, 181 insertions(+), 55 deletions(-) create mode 100644 src/Http/Http/src/StreamPipeReaderOptions.cs diff --git a/src/Http/Http/src/StreamPipeReader.cs b/src/Http/Http/src/StreamPipeReader.cs index b74ea5ac34..032ee6b728 100644 --- a/src/Http/Http/src/StreamPipeReader.cs +++ b/src/Http/Http/src/StreamPipeReader.cs @@ -20,6 +20,7 @@ namespace Microsoft.AspNetCore.Http public class StreamPipeReader : PipeReader { private readonly int _minimumSegmentSize; + private readonly int _minimumReadThreshold; private readonly Stream _readingStream; private readonly MemoryPool _pool; @@ -35,11 +36,51 @@ namespace Microsoft.AspNetCore.Http private bool _examinedEverything; private object _lock = new object(); + /// + /// Creates a new StreamPipeReader. + /// + /// The stream to read from. + public StreamPipeReader(Stream readingStream) + : this(readingStream, StreamPipeReaderOptions.DefaultOptions) + { + } + + + /// + /// Creates a new StreamPipeReader. + /// + /// The stream to read from. + /// The options to use. + public StreamPipeReader(Stream readingStream, StreamPipeReaderOptions options) + { + _readingStream = readingStream ?? throw new ArgumentNullException(nameof(readingStream)); + + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + if (options.MinimumReadThreshold <= 0) + { + throw new ArgumentOutOfRangeException(nameof(options.MinimumReadThreshold)); + } + + _minimumSegmentSize = options.MinimumSegmentSize; + _minimumReadThreshold = Math.Min(options.MinimumReadThreshold, options.MinimumSegmentSize); + _pool = options.MemoryPool; + } + + /// + public override void AdvanceTo(SequencePosition consumed) + { + AdvanceTo(consumed, consumed); + } + private CancellationTokenSource InternalTokenSource { get { - lock(_lock) + lock (_lock) { if (_internalTokenSource == null) { @@ -52,34 +93,6 @@ namespace Microsoft.AspNetCore.Http { _internalTokenSource = value; } - - } - - /// - /// Creates a new StreamPipeReader. - /// - /// The stream to read from. - public StreamPipeReader(Stream readingStream) : this(readingStream, minimumSegmentSize: 4096) - { - } - - /// - /// Creates a new StreamPipeReader. - /// - /// The stream to read from. - /// The minimum segment size to return from ReadAsync. - /// - public StreamPipeReader(Stream readingStream, int minimumSegmentSize, MemoryPool pool = null) - { - _minimumSegmentSize = minimumSegmentSize; - _readingStream = readingStream; - _pool = pool ?? MemoryPool.Shared; - } - - /// - public override void AdvanceTo(SequencePosition consumed) - { - AdvanceTo(consumed, consumed); } /// @@ -309,7 +322,7 @@ namespace Microsoft.AspNetCore.Http _readHead.SetMemory(_pool.Rent(GetSegmentSize())); _readTail = _readHead; } - else if (_readTail.WritableBytes == 0) + else if (_readTail.WritableBytes < _minimumReadThreshold) { CreateNewTailSegment(); } diff --git a/src/Http/Http/src/StreamPipeReaderOptions.cs b/src/Http/Http/src/StreamPipeReaderOptions.cs new file mode 100644 index 0000000000..5c43f1cfb0 --- /dev/null +++ b/src/Http/Http/src/StreamPipeReaderOptions.cs @@ -0,0 +1,31 @@ +using System; +using System.Buffers; +using System.Collections.Generic; +using System.Text; + +namespace Microsoft.AspNetCore.Http +{ + public class StreamPipeReaderOptions + { + public static StreamPipeReaderOptions DefaultOptions = new StreamPipeReaderOptions(); + public const int DefaultMinimumSegmentSize = 4096; + public const int DefaultMinimumReadThreshold = 256; + + public StreamPipeReaderOptions() + { + } + + public StreamPipeReaderOptions(int minimumSegmentSize, int minimumReadThreshold, MemoryPool memoryPool) + { + MinimumSegmentSize = minimumSegmentSize; + MinimumReadThreshold = minimumReadThreshold; + MemoryPool = memoryPool; + } + + public int MinimumSegmentSize { get; set; } = DefaultMinimumSegmentSize; + + public int MinimumReadThreshold { get; set; } = DefaultMinimumReadThreshold; + + public MemoryPool MemoryPool { get; set; } = MemoryPool.Shared; + } +} diff --git a/src/Http/Http/test/FlushResultCancellationTests.cs b/src/Http/Http/test/FlushResultCancellationTests.cs index 1251b60ebe..9f02b9a538 100644 --- a/src/Http/Http/test/FlushResultCancellationTests.cs +++ b/src/Http/Http/test/FlushResultCancellationTests.cs @@ -1,4 +1,4 @@ -// Copyright (c) .NET Foundation. All rights reserved. +// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; diff --git a/src/Http/Http/test/PipeTest.cs b/src/Http/Http/test/PipeTest.cs index 30049fe6c0..c94b4a5827 100644 --- a/src/Http/Http/test/PipeTest.cs +++ b/src/Http/Http/test/PipeTest.cs @@ -23,7 +23,7 @@ namespace Microsoft.AspNetCore.Http.Tests { MemoryStream = new MemoryStream(); Writer = new StreamPipeWriter(MemoryStream, MinimumSegmentSize, new TestMemoryPool()); - Reader = new StreamPipeReader(MemoryStream, MinimumSegmentSize, new TestMemoryPool()); + Reader = new StreamPipeReader(MemoryStream, new StreamPipeReaderOptions(MinimumSegmentSize, minimumReadThreshold: 256, new TestMemoryPool())); } public void Dispose() @@ -49,6 +49,13 @@ namespace Microsoft.AspNetCore.Http.Tests MemoryStream.Write(data, 0, data.Length); } + public void Append(byte[] data) + { + var originalPosition = MemoryStream.Position; + MemoryStream.Write(data, 0, data.Length); + MemoryStream.Position = originalPosition; + } + public byte[] ReadWithoutFlush() { MemoryStream.Position = 0; diff --git a/src/Http/Http/test/StreamPipeReaderTests.cs b/src/Http/Http/test/StreamPipeReaderTests.cs index ed750488c1..4f4cbf5b23 100644 --- a/src/Http/Http/test/StreamPipeReaderTests.cs +++ b/src/Http/Http/test/StreamPipeReaderTests.cs @@ -58,7 +58,7 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task ReadWithAdvance() { - Write(new byte[10000]); + WriteByteArray(9000); var readResult = await Reader.ReadAsync(); Reader.AdvanceTo(readResult.Buffer.End); @@ -71,8 +71,9 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task ReadWithAdvanceDifferentSegmentSize() { - Reader = new StreamPipeReader(MemoryStream, 4095, new TestMemoryPool()); - Write(new byte[10000]); + CreateReader(minimumSegmentSize: 4095); + + WriteByteArray(9000); var readResult = await Reader.ReadAsync(); Reader.AdvanceTo(readResult.Buffer.End); @@ -85,8 +86,9 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task ReadWithAdvanceSmallSegments() { - Reader = new StreamPipeReader(MemoryStream, 16, new TestMemoryPool()); - Write(new byte[128]); + CreateReader(); + + WriteByteArray(128); var readResult = await Reader.ReadAsync(); Reader.AdvanceTo(readResult.Buffer.End); @@ -251,8 +253,9 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task AdvanceMultipleSegments() { - Reader = new StreamPipeReader(MemoryStream, 16, new TestMemoryPool()); - Write(new byte[128]); + CreateReader(); + + WriteByteArray(128); var result = await Reader.ReadAsync(); Assert.Equal(16, result.Buffer.Length); @@ -269,8 +272,9 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task AdvanceMultipleSegmentsEdgeCase() { - Reader = new StreamPipeReader(MemoryStream, 16, new TestMemoryPool()); - Write(new byte[128]); + CreateReader(); + + WriteByteArray(128); var result = await Reader.ReadAsync(); Reader.AdvanceTo(result.Buffer.Start, result.Buffer.End); @@ -288,7 +292,7 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task CompleteReaderWithoutAdvanceDoesNotThrow() { - Write(new byte[100]); + WriteByteArray(100); await Reader.ReadAsync(); Reader.Complete(); } @@ -296,7 +300,7 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task AdvanceAfterCompleteThrows() { - Write(new byte[100]); + WriteByteArray(100); var buffer = (await Reader.ReadAsync()).Buffer; Reader.Complete(); @@ -309,7 +313,7 @@ namespace Microsoft.AspNetCore.Http.Tests public async Task ReadBetweenBlocks() { var blockSize = 16; - Reader = new StreamPipeReader(MemoryStream, blockSize, new TestMemoryPool()); + CreateReader(); WriteWithoutPosition(Enumerable.Repeat((byte)'a', blockSize - 5).ToArray()); Write(Encoding.ASCII.GetBytes("Hello World")); @@ -364,7 +368,7 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public void ReadAsyncWithDataReadyReturnsTaskWithValue() { - Write(new byte[20]); + WriteByteArray(20); var task = Reader.ReadAsync(); Assert.True(IsTaskWithResult(task)); } @@ -380,8 +384,9 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task AdvancePastMinReadSizeReadAsyncReturnsMoreData() { - Reader = new StreamPipeReader(MemoryStream, 16, new TestMemoryPool()); - Write(new byte[32]); + CreateReader(); + + WriteByteArray(32); var result = await Reader.ReadAsync(); Assert.Equal(16, result.Buffer.Length); @@ -393,7 +398,7 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task ExamineEverythingResetsAfterSuccessfulRead() { - Write(Encoding.ASCII.GetBytes(new string('a', 10000))); + WriteByteArray(10000); var readResult = await Reader.ReadAsync(); Reader.AdvanceTo(readResult.Buffer.Start, readResult.Buffer.End); @@ -408,10 +413,10 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task ReadMultipleTimesAdvanceFreesAppropriately() { - var blockSize = 16; var pool = new TestMemoryPool(); - Reader = new StreamPipeReader(MemoryStream, blockSize, pool); - Write(Encoding.ASCII.GetBytes(new string('a', 10000))); + CreateReader(memoryPool: pool); + + WriteByteArray(2000); for (var i = 0; i < 99; i++) { @@ -428,8 +433,9 @@ namespace Microsoft.AspNetCore.Http.Tests public async Task AsyncReadWorks() { MemoryStream = new AsyncStream(); - Reader = new StreamPipeReader(MemoryStream, 16, new TestMemoryPool()); - Write(Encoding.ASCII.GetBytes(new string('a', 10000))); + CreateReader(); + + WriteByteArray(2000); for (var i = 0; i < 99; i++) { @@ -445,7 +451,8 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task ConsumePartialBufferWorks() { - Reader = new StreamPipeReader(MemoryStream, 16, new TestMemoryPool()); + CreateReader(); + Write(Encoding.ASCII.GetBytes(new string('a', 8))); var readResult = await Reader.ReadAsync(); Reader.AdvanceTo(readResult.Buffer.GetPosition(4), readResult.Buffer.End); @@ -460,7 +467,8 @@ namespace Microsoft.AspNetCore.Http.Tests [Fact] public async Task ConsumePartialBufferBetweenMultipleSegmentsWorks() { - Reader = new StreamPipeReader(MemoryStream, 16, new TestMemoryPool()); + CreateReader(); + Write(Encoding.ASCII.GetBytes(new string('a', 8))); var readResult = await Reader.ReadAsync(); Reader.AdvanceTo(readResult.Buffer.GetPosition(4), readResult.Buffer.End); @@ -477,11 +485,78 @@ namespace Microsoft.AspNetCore.Http.Tests Reader.AdvanceTo(readResult.Buffer.End); } + [Fact] + public async Task SetMinimumReadThresholdSegmentAdvancesCorrectly() + { + CreateReader(minimumReadThreshold: 8); + + WriteByteArray(9); + var readResult = await Reader.ReadAsync(); + Reader.AdvanceTo(readResult.Buffer.Start, readResult.Buffer.End); + + AppendByteArray(9); + readResult = await Reader.ReadAsync(); + + foreach (var segment in readResult.Buffer) + { + Assert.Equal(9, segment.Length); + } + Assert.False(readResult.Buffer.IsSingleSegment); + } + + [Fact] + public async Task SetMinimumReadThresholdToMiminumSegmentSizeOnlyGetNewBlockWhenDataIsWritten() + { + CreateReader(minimumReadThreshold: 16); + WriteByteArray(0); + + var readResult = await Reader.ReadAsync(); + Reader.AdvanceTo(readResult.Buffer.Start, readResult.Buffer.End); + + WriteByteArray(16); + readResult = await Reader.ReadAsync(); + + Assert.Equal(16, readResult.Buffer.Length); + Assert.True(readResult.Buffer.IsSingleSegment); + } + + [Fact] + public void SetMinimumReadThresholdOfZeroThrows() + { + Assert.Throws(() => new StreamPipeReader(MemoryStream, + new StreamPipeReaderOptions(minimumSegmentSize: 4096, minimumReadThreshold: 0, new TestMemoryPool()))); + } + + [Fact] + public void SetOptionsToNullThrows() + { + Assert.Throws(() => new StreamPipeReader(MemoryStream, null)); + } + + private void CreateReader(int minimumSegmentSize = 16, int minimumReadThreshold = 4, MemoryPool memoryPool = null) + { + Reader = new StreamPipeReader(MemoryStream, + new StreamPipeReaderOptions( + minimumSegmentSize, + minimumReadThreshold, + memoryPool ?? new TestMemoryPool())); + } + private bool IsTaskWithResult(ValueTask task) { return task == new ValueTask(task.Result); } + private void WriteByteArray(int size) + { + Write(new byte[size]); + } + + private void AppendByteArray(int size) + { + Append(new byte[size]); + } + private class AsyncStream : MemoryStream { private static byte[] bytes = Encoding.ASCII.GetBytes("Hello World"); From 98f2973880136e4badda09004be051e633f002d9 Mon Sep 17 00:00:00 2001 From: Ajay Bhargav Baaskaran Date: Wed, 12 Dec 2018 10:41:06 -0800 Subject: [PATCH 024/297] Removed unnecessary projects (#4586) --- build/artifacts.props | 5 - src/Razor/NuGetPackageVerifier.json | 6 +- src/Razor/Razor.sln | 156 - .../AssemblyInfo.cs | 1 - .../CodeGenerationBenchmark.cs | 58 - .../MSN.cshtml | 3983 ----------------- ...rosoft.AspNetCore.Razor.Performance.csproj | 28 - .../TagHelperSerializationBenchmark.cs | 54 - .../readme.md | 11 - .../taghelpers.json | 1 - src/Razor/build.cmd | 3 + src/Razor/build.sh | 7 + src/Razor/build/MPack.targets | 97 - src/Razor/build/VSIX.targets | 121 - src/Razor/build/repo.targets | 2 - .../Properties/AssemblyInfo.cs | 12 - .../Microsoft.AspNetCore.Razor.Tools.csproj | 11 +- .../Shared}/RazorDiagnosticJsonConverter.cs | 0 .../TagHelperDescriptorJsonConverter.cs | 0 .../DefaultErrorReporter.cs | 41 - .../DefaultErrorReporterFactory.cs | 19 - .../Editor/EditorSettings.cs | 53 - .../Editor/EditorSettingsChangedEventArgs.cs | 17 - .../Editor/WorkspaceEditorSettings.cs | 15 - .../ErrorReporter.cs | 18 - ...portCustomProjectEngineFactoryAttribute.cs | 28 - .../FallbackProjectEngineFactory.cs | 37 - .../ForegroundDispatcher.cs | 37 - .../ICustomProjectEngineFactoryMetadata.cs | 12 - .../IFallbackProjectEngineFactory.cs | 10 - .../IProjectEngineFactory.cs | 13 - ...osoft.CodeAnalysis.Razor.Workspaces.csproj | 18 - .../ProjectSystem/DefaultProjectSnapshot.cs | 184 - .../DefaultProjectSnapshotManager.cs | 463 -- .../DefaultProjectSnapshotManagerFactory.cs | 53 - .../DefaultProjectSnapshotWorker.cs | 62 - .../DefaultProjectSnapshotWorkerFactory.cs | 32 - .../FallbackRazorConfiguration.cs | 88 - .../ProjectSystem/FallbackRazorExtension.cs | 23 - .../ProjectSystem/HostProject.cs | 31 - .../ProjectSystem/ProjectChangeEventArgs.cs | 20 - .../ProjectSystem/ProjectChangeKind.cs | 13 - .../ProjectExtensibilityAssembly.cs | 42 - .../ProjectSystem/ProjectSnapshot.cs | 26 - .../ProjectSnapshotChangeTrigger.cs | 10 - .../ProjectSystem/ProjectSnapshotManager.cs | 16 - .../ProjectSnapshotManagerBase.cs | 36 - .../ProjectSnapshotManagerExtensions.cs | 25 - .../ProjectSnapshotUpdateContext.cs | 45 - .../ProjectSystem/ProjectSnapshotWorker.cs | 14 - .../ProjectSnapshotWorkerQueue.cs | 203 - .../ProjectSystemRazorConfiguration.cs | 43 - .../ProjectSystemRazorExtension.cs | 23 - .../WorkspaceProjectSnapshotChangeTrigger.cs | 85 - .../Properties/AssemblyInfo.cs | 17 - .../Properties/Resources.Designer.cs | 86 - .../RazorProjectEngineFactoryService.cs | 23 - .../Resources.resx | 132 - .../TagHelperResolutionResult.cs | 24 - .../TagHelperResolver.cs | 59 - .../Properties/AssemblyInfo.cs | 5 - .../GeneratedDocument.cs | 10 - ...Microsoft.CodeAnalysis.Remote.Razor.csproj | 28 - .../Properties/AssemblyInfo.cs | 7 - .../RazorLanguageService.cs | 68 - .../RazorServiceBase.cs | 74 - .../RazorServices.cs | 22 - .../RemoteTagHelperResolver.cs | 80 - .../AcceptedCharacters.cs | 22 - .../AttributeCompletionContext.cs | 73 - .../AttributeCompletionResult.cs | 41 - .../BackgroundParser.cs | 405 -- .../BlockKind.cs | 26 - .../BraceSmartIndenter.cs | 259 -- .../BraceSmartIndenterFactory.cs | 12 - .../BufferGraphExtensions.cs | 22 - .../ClassifiedSpan.cs | 29 - .../ContextChangeEventArgs.cs | 17 - .../ContextChangeKind.cs | 13 - .../DefaultBraceSmartIndenterFactory.cs | 47 - ...DefaultBraceSmartIndenterFactoryFactory.cs | 47 - .../DefaultCodeDocumentProvider.cs | 62 - .../DefaultEditorSettingsManager.cs | 67 - .../DefaultImportDocumentManager.cs | 170 - .../DefaultImportDocumentManagerFactory.cs | 47 - .../DefaultProjectEngineFactoryService.cs | 196 - ...faultProjectEngineFactoryServiceFactory.cs | 48 - .../DefaultRazorDocumentManager.cs | 144 - .../DefaultRazorEditorFactoryService.cs | 151 - .../DefaultRazorIndentationFactsService.cs | 150 - .../DefaultRazorSyntaxFactsService.cs | 141 - .../DefaultTagHelperCompletionService.cs | 299 -- .../DefaultTagHelperFactsService.cs | 166 - .../DefaultTagHelperResolver.cs | 43 - .../DefaultTagHelperResolverFactory.cs | 20 - .../DefaultTextBufferCodeDocumentProvider.cs | 32 - .../DefaultTextBufferProvider.cs | 71 - .../DefaultVisualStudioDocumentTracker.cs | 231 - ...faultVisualStudioDocumentTrackerFactory.cs | 105 - ...sualStudioDocumentTrackerFactoryFactory.cs | 70 - .../DefaultVisualStudioRazorParser.cs | 445 -- .../DefaultVisualStudioRazorParserFactory.cs | 66 - ...ltVisualStudioRazorParserFactoryFactory.cs | 47 - .../DefaultWorkspaceEditorSettings.cs | 94 - .../DefaultWorkspaceEditorSettingsFactory.cs | 47 - .../DocumentStructureChangedEventArgs.cs | 37 - .../EditorSettingsManager.cs | 17 - .../ElementCompletionContext.cs | 59 - .../ElementCompletionResult.cs | 41 - .../FileChangeEventArgs.cs | 20 - .../FileChangeKind.cs | 12 - .../FileChangeTracker.cs | 18 - .../FileChangeTrackerFactory.cs | 12 - .../ImportChangedEventArgs.cs | 24 - .../ImportDocumentManager.cs | 17 - .../LegacyProjectEngineFactory_1_0.cs | 32 - .../LegacyProjectEngineFactory_1_1.cs | 32 - .../LegacyProjectEngineFactory_2_0.cs | 31 - .../LegacyProjectEngineFactory_2_1.cs | 33 - ...Microsoft.VisualStudio.Editor.Razor.csproj | 19 - .../Properties/AssemblyInfo.cs | 12 - .../Properties/Resources.Designer.cs | 44 - .../RazorCodeDocumentProvider.cs | 13 - .../RazorDirectiveCompletionProvider.cs | 218 - .../RazorDocumentManager.cs | 17 - .../RazorEditorFactoryService.cs | 16 - .../RazorIndentationFactsService.cs | 14 - .../RazorSyntaxFactsService.cs | 17 - .../RazorSyntaxFactsServiceExtensions.cs | 37 - .../RazorSyntaxTreePartialParser.cs | 79 - .../RazorTextBufferProvider.cs | 14 - .../RazorTextViewConnectionListener.cs | 73 - .../Resources.resx | 123 - .../SpanKind.cs | 15 - .../TagHelperCompletionService.cs | 12 - .../TagHelperFactsService.cs | 19 - .../TagHelperSpan.cs | 29 - .../TextBufferCodeDocumentProvider.cs | 13 - .../TextBufferExtensions.cs | 21 - .../TextBufferProjectService.cs | 18 - .../TextContentChangedEventArgsExtensions.cs | 38 - .../TextSnapshotProjectItem.cs | 65 - .../VisualStudioCompletionBroker.cs | 13 - .../VisualStudioDocumentTracker.cs | 40 - .../VisualStudioDocumentTrackerFactory.cs | 13 - .../VisualStudioRazorParser.cs | 26 - .../VisualStudioRazorParserFactory.cs | 12 - .../VisualStudioWorkspaceAccessor.cs | 13 - .../DefaultFileChangeTracker.cs | 141 - .../DefaultFileChangeTrackerFactory.cs | 53 - .../DefaultFileChangeTrackerFactoryFactory.cs | 50 - .../DefaultRazorEngineDirectiveResolver.cs | 41 - .../DefaultRazorEngineDocumentGenerator.cs | 39 - .../DefaultVisualStudioWorkspaceAccessor.cs | 118 - .../Editor/DefaultTextBufferProjectService.cs | 125 - .../DefaultVisualStudioCompletionBroker.cs | 36 - ...aultVisualStudioCompletionBrokerFactory.cs | 41 - .../IRazorEngineDirectiveResolver.cs | 18 - .../IRazorEngineDocumentGenerator.cs | 16 - ...VisualStudio.LanguageServices.Razor.csproj | 117 - .../OOPTagHelperResolver.cs | 156 - .../OOPTagHelperResolverFactory.cs | 23 - .../ProjectSystem/DefaultRazorProjectHost.cs | 266 -- .../ProjectSystem/FallbackRazorProjectHost.cs | 146 - .../IUnconfiguredProjectCommonServices.cs | 32 - .../ManageProjectSystemSchema.cs | 16 - .../ProjectSystem/RazorProjectHostBase.cs | 190 - .../ProjectSystem/Rules/RazorConfiguration.cs | 212 - .../Rules/RazorConfiguration.xaml | 29 - .../ProjectSystem/Rules/RazorExtension.cs | 235 - .../ProjectSystem/Rules/RazorExtension.xaml | 37 - .../ProjectSystem/Rules/RazorGeneral.cs | 235 - .../ProjectSystem/Rules/RazorGeneral.xaml | 36 - .../Rules/RazorProjectProperties.cs | 34 - .../UnconfiguredProjectCommonServices.cs | 96 - .../Properties/AssemblyInfo.cs | 8 - .../Properties/Resources.Designer.cs | 58 - .../RazorEngineDocument.cs | 12 - .../Resources.resx | 126 - .../JsonConverterCollectionExtensions.cs | 27 - .../Serialization/ProjectSnapshotHandle.cs | 29 - .../ProjectSnapshotHandleJsonConverter.cs | 73 - .../ProjectSnapshotJsonConverter.cs | 40 - .../RazorConfigurationJsonConverter.cs | 53 - .../RazorExtensionJsonConverter.cs | 45 - .../Serialization/SerializedRazorExtension.cs | 23 - .../VisualStudioErrorReporter.cs | 85 - .../VisualStudioErrorReporterFactory.cs | 35 - .../VisualStudioForegroundDispatcher.cs | 21 - ...tionUpdatesProjectSnapshotChangeTrigger.cs | 103 - .../DefaultFileChangeTracker.cs | 130 - .../DefaultFileChangeTrackerFactory.cs | 35 - .../DefaultFileChangeTrackerFactoryFactory.cs | 40 - ...DefaultVisualStudioMacWorkspaceAccessor.cs | 86 - .../Editor/DefaultTextBufferProjectService.cs | 104 - .../DefaultVisualStudioCompletionBroker.cs | 41 - ...aultVisualStudioCompletionBrokerFactory.cs | 27 - ...alStudio.Mac.LanguageServices.Razor.csproj | 18 - .../ProjectBuildChangeTrigger.cs | 112 - .../ProjectSystem/DefaultDotNetProjectHost.cs | 155 - .../ProjectSystem/DefaultRazorProjectHost.cs | 180 - .../ProjectSystem/DotNetProjectHost.cs | 14 - .../ProjectSystem/DotNetProjectHostFactory.cs | 57 - .../ProjectSystem/FallbackRazorProjectHost.cs | 99 - .../ProjectSystem/RazorProjectHostBase.cs | 169 - .../Properties/AssemblyInfo.cs | 8 - .../Properties/Resources.Designer.cs | 88 - .../Resources.resx | 133 - .../VisualStudioErrorReporter.cs | 54 - .../VisualStudioErrorReporterFactory.cs | 20 - .../VisualStudioForegroundDispatcher.cs | 20 - .../VisualStudioMacWorkspaceAccessor.cs | 14 - ...alysis.Razor.Workspaces.Test.Common.csproj | 16 - .../TestRazorLanguageServices.cs | 48 - .../TestServices.cs | 47 - .../TestWorkspace.cs | 26 - .../TestWorkspaceServices.cs | 85 - ....CodeAnalysis.Razor.Workspaces.Test.csproj | 30 - .../DefaultProjectSnapshotTest.cs | 109 - ...rkspaceProjectSnapshotChangeTriggerTest.cs | 236 - .../xunit.runner.json | 4 - ...sualStudio.Editor.Razor.Test.Common.csproj | 20 - .../Properties/AssemblyInfo.cs | 9 - .../StringTextSnapshot.cs | 223 - .../Xunit/ForegroundDispatcherTestBase.cs | 52 - .../Xunit/ForegroundFactAttribute.cs | 15 - .../Xunit/ForegroundFactDiscoverer.cs | 25 - .../Xunit/ForegroundFactTestCase.cs | 117 - .../Xunit/ForegroundTheoryAttribute.cs | 15 - .../Xunit/ForegroundTheoryDiscoverer.cs | 25 - .../BraceSmartIndenterIntegrationTest.cs | 88 - .../BraceSmartIndenterTest.cs | 299 -- .../BraceSmartIndenterTestBase.cs | 78 - .../DefaultCodeDocumentProviderTest.cs | 83 - .../DefaultEditorSettingsManagerTest.cs | 61 - ...ultImportDocumentManagerIntegrationTest.cs | 83 - .../DefaultImportDocumentManagerTest.cs | 162 - .../DefaultProjectEngineFactoryServiceTest.cs | 238 - .../DefaultRazorDocumentManagerTest.cs | 226 - .../DefaultRazorEditorFactoryServiceTest.cs | 275 -- ...DefaultRazorIndentationFactsServiceTest.cs | 334 -- .../DefaultRazorSyntaxFactsServiceTest.cs | 120 - .../DefaultTagHelperCompletionServiceTest.cs | 1141 ----- .../DefaultTagHelperFactsServiceTest.cs | 388 -- ...faultTextBufferCodeDocumentProviderTest.cs | 70 - .../DefaultTextBufferProviderTest.cs | 159 - .../DefaultVisualStudioDocumentTrackerTest.cs | 324 -- ...tVisualStudioRazorParserIntegrationTest.cs | 712 --- .../DefaultVisualStudioRazorParserTest.cs | 276 -- .../DefaultWorkspaceEditorSettingsTest.cs | 99 - .../Infrastructure/TestEdit.cs | 31 - .../Infrastructure/TestTextBuffer.cs | 171 - .../Infrastructure/TestTextChange.cs | 50 - ...soft.VisualStudio.Editor.Razor.Test.csproj | 31 - .../RazorDirectiveCompletionProviderTest.cs | 378 -- .../RazorSyntaxFactsServiceExtensionsTest.cs | 107 - .../RazorSyntaxTreePartialParserTest.cs | 603 --- .../RazorTextViewConnectionListenerTest.cs | 51 - ...xtContentChangedEventArgsExtensionsTest.cs | 96 - .../xunit.runner.json | 4 - .../DefaultFileChangeTrackerTest.cs | 128 - ...efaultVisualStudioWorkspaceAccessorTest.cs | 150 - ...lStudio.LanguageServices.Razor.Test.csproj | 41 - .../OOPTagHelperResolverTest.cs | 177 - .../DefaultProjectSnapshotManagerTest.cs | 837 ---- .../DefaultRazorProjectHostTest.cs | 1025 ----- .../FallbackRazorProjectHostTest.cs | 373 -- .../ProjectSnapshotWorkerQueueTest.cs | 191 - .../ProjectSystem/TestAssemblyReference.cs | 68 - .../TestProjectChangeDescription.cs | 24 - .../ProjectSystem/TestProjectRuleSnapshot.cs | 61 - .../TestProjectSystemServices.cs | 862 ---- .../ProjectSystem/TestPropertyData.cs | 18 - .../ProjectSnapshotHandleSerializationTest.cs | 73 - .../RazorConfigurationSerializationTest.cs | 50 - .../RazorExtensionSerializationTest.cs | 38 - .../TagHelperDescriptorSerializationTest.cs | 237 - ...UpdatesProjectSnapshotChangeTriggerTest.cs | 125 - .../xunit.runner.json | 4 - .../DefaultDotNetProjectHostTest.cs | 34 - .../DefaultFileChangeTrackerTest.cs | 89 - .../DefaultRazorProjectHostTest.cs | 470 -- ...ultVisualStudioMacWorkspaceAccessorTest.cs | 33 - .../FallbackRazorProjectHostTest.cs | 62 - ...dio.Mac.LanguageServices.Razor.Test.csproj | 24 - .../ProjectBuildChangeTriggerTest.cs | 110 - .../xunit.runner.json | 4 - .../AddinMetadata.props | 9 - ...crosoft.VisualStudio.Mac.RazorAddin.csproj | 47 - .../Properties/_Manifest.addin.xml | 28 - .../RazorAddin.cs | 10 - .../RazorProjectExtension.cs | 59 - .../AboutDialogInfoAttribute.cs | 64 - .../Behaviors/ItemSelectedBehavior.cs | 58 - .../RazorDocumentInfoViewModel.cs | 49 - .../DocumentInfo/RazorDocumentInfoWindow.cs | 147 - .../RazorDocumentInfoWindowCommand.cs | 107 - .../RazorDocumentInfoWindowControl.xaml | 31 - .../RazorDocumentInfoWindowControl.xaml.cs | 19 - ...crosoft.VisualStudio.RazorExtension.csproj | 377 -- .../NotifyPropertyChanged.cs | 20 - .../Properties/AssemblyInfo.cs | 6 - .../RazorInfo/AssemblyViewModel.cs | 23 - .../RazorInfo/DirectiveViewModel.cs | 42 - .../RazorInfo/DocumentInfoViewModel.cs | 21 - .../RazorInfo/DocumentViewModel.cs | 18 - .../RazorInfo/ProjectInfoViewModel.cs | 46 - .../RazorInfo/ProjectSnapshotViewModel.cs | 36 - .../RazorInfo/ProjectViewModel.cs | 36 - .../RazorInfo/PropertyViewModel.cs | 21 - .../RazorInfo/RazorInfoToolWindow.cs | 150 - .../RazorInfo/RazorInfoToolWindowCommand.cs | 105 - .../RazorInfo/RazorInfoToolWindowControl.xaml | 266 -- .../RazorInfoToolWindowControl.xaml.cs | 16 - .../RazorInfo/RazorInfoViewModel.cs | 323 -- .../RazorInfo/TagHelperViewModel.cs | 26 - .../RazorPackage.cs | 47 - .../RazorPackage.vsct | 51 - .../RelayCommand.cs | 46 - .../Resources/RazorInfoToolWindowCommand.png | Bin 1172 -> 0 bytes .../Resources/RazorPackage.ico | Bin 428446 -> 0 bytes .../VSPackage.resx | 130 - .../WebConfiguration.png | Bin 7217 -> 0 bytes ...zorLanguageService.servicehub.service.json | 11 - ...rLanguageService64.servicehub.service.json | 11 - .../source.extension.vsixmanifest | 42 - 326 files changed, 12 insertions(+), 32913 deletions(-) delete mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/AssemblyInfo.cs delete mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/CodeGenerationBenchmark.cs delete mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml delete mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj delete mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/TagHelperSerializationBenchmark.cs delete mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/readme.md delete mode 100644 src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/taghelpers.json create mode 100644 src/Razor/build.cmd create mode 100644 src/Razor/build.sh delete mode 100644 src/Razor/build/MPack.targets delete mode 100644 src/Razor/build/VSIX.targets rename src/Razor/src/{Microsoft.VisualStudio.LanguageServices.Razor/Serialization => Microsoft.AspNetCore.Razor.Tools/Shared}/RazorDiagnosticJsonConverter.cs (100%) rename src/Razor/src/{Microsoft.VisualStudio.LanguageServices.Razor/Serialization => Microsoft.AspNetCore.Razor.Tools/Shared}/TagHelperDescriptorJsonConverter.cs (100%) delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporter.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettings.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettingsChangedEventArgs.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/WorkspaceEditorSettings.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ErrorReporter.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ExportCustomProjectEngineFactoryAttribute.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/FallbackProjectEngineFactory.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ICustomProjectEngineFactoryMetadata.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IFallbackProjectEngineFactory.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IProjectEngineFactory.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorker.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorExtension.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostProject.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeKind.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectExtensibilityAssembly.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotChangeTrigger.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerBase.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerExtensions.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotUpdateContext.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotWorker.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotWorkerQueue.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorConfiguration.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorExtension.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/WorkspaceProjectSnapshotChangeTrigger.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/Resources.Designer.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorProjectEngineFactoryService.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources.resx delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolver.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GeneratedDocument.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Properties/AssemblyInfo.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorLanguageService.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServices.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteTagHelperResolver.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AcceptedCharacters.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionContext.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionResult.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParser.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BlockKind.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenterFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BufferGraphExtensions.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ClassifiedSpan.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeEventArgs.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeKind.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultCodeDocumentProvider.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultEditorSettingsManager.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManager.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryServiceFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManager.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorEditorFactoryService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorSyntaxFactsService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperCompletionService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperFactsService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolver.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolverFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferCodeDocumentProvider.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTracker.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettings.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettingsFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DocumentStructureChangedEventArgs.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/EditorSettingsManager.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionContext.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionResult.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeEventArgs.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeKind.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeTracker.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeTrackerFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ImportChangedEventArgs.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ImportDocumentManager.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_1_0.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_1_1.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_2_0.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_2_1.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Properties/Resources.Designer.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorCodeDocumentProvider.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorDocumentManager.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorEditorFactoryService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorIndentationFactsService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxFactsService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxFactsServiceExtensions.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxTreePartialParser.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorTextBufferProvider.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorTextViewConnectionListener.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Resources.resx delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/SpanKind.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperCompletionService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperFactsService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperSpan.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferCodeDocumentProvider.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferExtensions.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferProjectService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextContentChangedEventArgsExtensions.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextSnapshotProjectItem.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioCompletionBroker.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioDocumentTracker.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioDocumentTrackerFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParser.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParserFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioWorkspaceAccessor.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTracker.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultRazorEngineDirectiveResolver.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultRazorEngineDocumentGenerator.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultVisualStudioWorkspaceAccessor.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultTextBufferProjectService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRazorEngineDirectiveResolver.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRazorEngineDocumentGenerator.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/OOPTagHelperResolver.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/OOPTagHelperResolverFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IUnconfiguredProjectCommonServices.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ManageProjectSystemSchema.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.xaml delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.xaml delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.xaml delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorProjectProperties.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/UnconfiguredProjectCommonServices.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Properties/AssemblyInfo.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Properties/Resources.Designer.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorEngineDocument.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Resources.resx delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/JsonConverterCollectionExtensions.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotHandle.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotHandleJsonConverter.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotJsonConverter.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorConfigurationJsonConverter.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorExtensionJsonConverter.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/SerializedRazorExtension.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioErrorReporter.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VsSolutionUpdatesProjectSnapshotChangeTrigger.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTracker.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultVisualStudioMacWorkspaceAccessor.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultTextBufferProjectService.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectBuildChangeTrigger.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DefaultDotNetProjectHost.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DotNetProjectHost.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DotNetProjectHostFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/AssemblyInfo.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/Resources.Designer.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Resources.resx delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporter.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioMacWorkspaceAccessor.cs delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common.csproj delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestRazorLanguageServices.cs delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestServices.cs delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestWorkspace.cs delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestWorkspaceServices.cs delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/WorkspaceProjectSnapshotChangeTriggerTest.cs delete mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/xunit.runner.json delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Microsoft.VisualStudio.Editor.Razor.Test.Common.csproj delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Properties/AssemblyInfo.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/StringTextSnapshot.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundDispatcherTestBase.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactAttribute.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactDiscoverer.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactTestCase.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundTheoryAttribute.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundTheoryDiscoverer.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterIntegrationTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterTestBase.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultCodeDocumentProviderTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultEditorSettingsManagerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultImportDocumentManagerIntegrationTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultImportDocumentManagerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultProjectEngineFactoryServiceTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorDocumentManagerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorEditorFactoryServiceTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorIndentationFactsServiceTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorSyntaxFactsServiceTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTagHelperCompletionServiceTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTagHelperFactsServiceTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTextBufferCodeDocumentProviderTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTextBufferProviderTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioDocumentTrackerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserIntegrationTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultWorkspaceEditorSettingsTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestEdit.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestTextBuffer.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestTextChange.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Microsoft.VisualStudio.Editor.Razor.Test.csproj delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorSyntaxFactsServiceExtensionsTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorSyntaxTreePartialParserTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorTextViewConnectionListenerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/TextContentChangedEventArgsExtensionsTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/xunit.runner.json delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/DefaultFileChangeTrackerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/DefaultVisualStudioWorkspaceAccessorTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/OOPTagHelperResolverTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultRazorProjectHostTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/FallbackRazorProjectHostTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotWorkerQueueTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestAssemblyReference.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectChangeDescription.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectRuleSnapshot.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectSystemServices.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestPropertyData.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/ProjectSnapshotHandleSerializationTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/RazorConfigurationSerializationTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/RazorExtensionSerializationTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/TagHelperDescriptorSerializationTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/VsSolutionUpdatesProjectSnapshotChangeTriggerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/xunit.runner.json delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultDotNetProjectHostTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultFileChangeTrackerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultRazorProjectHostTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultVisualStudioMacWorkspaceAccessorTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/FallbackRazorProjectHostTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test.csproj delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/ProjectBuildChangeTriggerTest.cs delete mode 100644 src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/xunit.runner.json delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/AddinMetadata.props delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/Microsoft.VisualStudio.Mac.RazorAddin.csproj delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/Properties/_Manifest.addin.xml delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/RazorAddin.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/RazorProjectExtension.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/AboutDialogInfoAttribute.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Behaviors/ItemSelectedBehavior.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindow.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowCommand.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowControl.xaml delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowControl.xaml.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/NotifyPropertyChanged.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Properties/AssemblyInfo.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/AssemblyViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DirectiveViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DocumentInfoViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DocumentViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectInfoViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectSnapshotViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/PropertyViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindow.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowCommand.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowControl.xaml delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowControl.xaml.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/TagHelperViewModel.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorPackage.vsct delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RelayCommand.cs delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Resources/RazorInfoToolWindowCommand.png delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Resources/RazorPackage.ico delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/VSPackage.resx delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/WebConfiguration.png delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/razorLanguageService.servicehub.service.json delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/razorLanguageService64.servicehub.service.json delete mode 100644 src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/source.extension.vsixmanifest diff --git a/build/artifacts.props b/build/artifacts.props index c9ce534c4f..07df0a68e1 100644 --- a/build/artifacts.props +++ b/build/artifacts.props @@ -148,9 +148,7 @@ - - @@ -177,9 +175,6 @@ - - - diff --git a/src/Razor/NuGetPackageVerifier.json b/src/Razor/NuGetPackageVerifier.json index aeabac8d86..a6b622a7e4 100644 --- a/src/Razor/NuGetPackageVerifier.json +++ b/src/Razor/NuGetPackageVerifier.json @@ -5,11 +5,7 @@ ], "packages": { "Microsoft.AspNetCore.Razor.TagHelpers.Testing.Sources": {}, - "RazorPageGenerator": {}, - "Microsoft.CodeAnalysis.Remote.Razor": {}, - "Microsoft.VisualStudio.Editor.Razor": {}, - "Microsoft.VisualStudio.LanguageServices.Razor": {}, - "Microsoft.VisualStudio.Mac.LanguageServices.Razor": {} + "RazorPageGenerator": {} } }, "Default": { // Rules to run for packages not listed in any other set. diff --git a/src/Razor/Razor.sln b/src/Razor/Razor.sln index 6ec8cff6c0..7fa54f113f 100644 --- a/src/Razor/Razor.sln +++ b/src/Razor/Razor.sln @@ -31,24 +31,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Runtime.Test", "test\Microsoft.AspNetCore.Razor.Runtime.Test\Microsoft.AspNetCore.Razor.Runtime.Test.csproj", "{277AB67E-9C8D-4799-A18C-C628E70A8664}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Workspaces", "src\Microsoft.CodeAnalysis.Razor.Workspaces\Microsoft.CodeAnalysis.Razor.Workspaces.csproj", "{0F265874-C592-448B-BC4F-3430AB03E0DC}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Remote.Razor", "src\Microsoft.CodeAnalysis.Remote.Razor\Microsoft.CodeAnalysis.Remote.Razor.csproj", "{4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tooling", "tooling", "{C0CC1E1F-1559-44DE-93A8-63259CEA2AAB}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.VisualStudio.RazorExtension", "tooling\Microsoft.VisualStudio.RazorExtension\Microsoft.VisualStudio.RazorExtension.csproj", "{D66B45B5-CBFD-4947-81F1-F30AB80EA992}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor", "src\Microsoft.CodeAnalysis.Razor\Microsoft.CodeAnalysis.Razor.csproj", "{42403DAF-F0BC-4F3A-B7F2-46D7013345D8}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Test", "test\Microsoft.CodeAnalysis.Razor.Test\Microsoft.CodeAnalysis.Razor.Test.csproj", "{7A8A1664-37CE-4376-81CA-1862CF5F91D9}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.Razor", "src\Microsoft.VisualStudio.LanguageServices.Razor\Microsoft.VisualStudio.LanguageServices.Razor.csproj", "{E5D92DB7-5CBF-410A-9685-FF76F71EC96F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RazorPageGenerator.Test", "test\RazorPageGenerator.Test\RazorPageGenerator.Test.csproj", "{96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.LanguageServices.Razor.Test", "test\Microsoft.VisualStudio.LanguageServices.Razor.Test\Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj", "{37E61BDB-658E-4F44-A499-D64CC6D35485}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions", "src\Microsoft.AspNetCore.Mvc.Razor.Extensions\Microsoft.AspNetCore.Mvc.Razor.Extensions.csproj", "{995F2FEB-65FA-4399-B1C0-16E0B3FBDB15}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Test.csproj", "{7CFD5646-A757-4498-9E01-9C8528ED60AE}" @@ -57,26 +45,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim", "test\Microsoft.AspNetCore.Razor.Test.MvcShim\Microsoft.AspNetCore.Razor.Test.MvcShim.csproj", "{8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Workspaces.Test", "test\Microsoft.CodeAnalysis.Razor.Workspaces.Test\Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj", "{C61AAE12-5007-4205-A220-68F354A7F235}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X", "src\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.csproj", "{F1538809-7347-45D2-A7AC-C1D89CF0BBD4}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test", "test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test\Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test.csproj", "{296D4516-0323-4D28-955D-B0324E4F10BE}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X", "test\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X\Microsoft.AspNetCore.Razor.Test.MvcShim.Version1_X.csproj", "{AC5CA24B-B81E-4B20-B193-2E3983B1896C}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Editor.Razor", "src\Microsoft.VisualStudio.Editor.Razor\Microsoft.VisualStudio.Editor.Razor.csproj", "{0BCDE75A-A438-46C7-95E9-391F029D07C5}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Editor.Razor.Test", "test\Microsoft.VisualStudio.Editor.Razor.Test\Microsoft.VisualStudio.Editor.Razor.Test.csproj", "{AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Editor.Razor.Test.Common", "test\Microsoft.VisualStudio.Editor.Razor.Test.Common\Microsoft.VisualStudio.Editor.Razor.Test.Common.csproj", "{FC684D4F-D23C-407C-9C68-E10EF3B38560}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Mac.RazorAddin", "tooling\Microsoft.VisualStudio.Mac.RazorAddin\Microsoft.VisualStudio.Mac.RazorAddin.csproj", "{FAF9986F-E086-4513-9D52-F7BF5FFCF31D}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Mac.LanguageServices.Razor", "src\Microsoft.VisualStudio.Mac.LanguageServices.Razor\Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj", "{95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test", "test\Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test\Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test.csproj", "{B8A3E4CA-D54A-441F-A3BF-E00F060CA042}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Design", "src\Microsoft.AspNetCore.Razor.Design\Microsoft.AspNetCore.Razor.Design.csproj", "{5257B25D-330A-4DCF-ACED-B4709CFBF916}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Design.Test", "test\Microsoft.AspNetCore.Razor.Design.Test\Microsoft.AspNetCore.Razor.Design.Test.csproj", "{1D90F276-E1CA-4FDF-A173-EB889E7D3150}" @@ -85,12 +59,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor. EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Test", "test\Microsoft.AspNetCore.Razor.Test\Microsoft.AspNetCore.Razor.Test.csproj", "{323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}" EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Performance", "benchmarks\Microsoft.AspNetCore.Razor.Performance\Microsoft.AspNetCore.Razor.Performance.csproj", "{6205467F-E381-4C42-AEEC-763BD62B3D5E}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "benchmarks", "benchmarks", "{C2C98051-0F39-47F2-80B6-E72B29159F2C}" -EndProject -Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common", "test\Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common\Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common.csproj", "{933101DA-C4CC-401A-AA01-2784E1025B7F}" -EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.AspNetCore.Razor.Tools", "src\Microsoft.AspNetCore.Razor.Tools\Microsoft.AspNetCore.Razor.Tools.csproj", "{3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}" EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.NET.Sdk.Razor", "src\Microsoft.NET.Sdk.Razor\Microsoft.NET.Sdk.Razor.csproj", "{7D9ECCEE-71D1-4A42-ABEE-876AFA1B4FC9}" @@ -155,28 +123,6 @@ Global {277AB67E-9C8D-4799-A18C-C628E70A8664}.Release|Any CPU.Build.0 = Release|Any CPU {277AB67E-9C8D-4799-A18C-C628E70A8664}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {277AB67E-9C8D-4799-A18C-C628E70A8664}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {0F265874-C592-448B-BC4F-3430AB03E0DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0F265874-C592-448B-BC4F-3430AB03E0DC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0F265874-C592-448B-BC4F-3430AB03E0DC}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {0F265874-C592-448B-BC4F-3430AB03E0DC}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {0F265874-C592-448B-BC4F-3430AB03E0DC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0F265874-C592-448B-BC4F-3430AB03E0DC}.Release|Any CPU.Build.0 = Release|Any CPU - {0F265874-C592-448B-BC4F-3430AB03E0DC}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {0F265874-C592-448B-BC4F-3430AB03E0DC}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.Debug|Any CPU.Build.0 = Debug|Any CPU - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.Release|Any CPU.ActiveCfg = Release|Any CPU - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.Release|Any CPU.Build.0 = Release|Any CPU - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.Release|Any CPU.Build.0 = Release|Any CPU - {D66B45B5-CBFD-4947-81F1-F30AB80EA992}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {42403DAF-F0BC-4F3A-B7F2-46D7013345D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {42403DAF-F0BC-4F3A-B7F2-46D7013345D8}.Debug|Any CPU.Build.0 = Debug|Any CPU {42403DAF-F0BC-4F3A-B7F2-46D7013345D8}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -193,14 +139,6 @@ Global {7A8A1664-37CE-4376-81CA-1862CF5F91D9}.Release|Any CPU.Build.0 = Release|Any CPU {7A8A1664-37CE-4376-81CA-1862CF5F91D9}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {7A8A1664-37CE-4376-81CA-1862CF5F91D9}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.Release|Any CPU.Build.0 = Release|Any CPU - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.Debug|Any CPU.Build.0 = Debug|Any CPU {96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -209,14 +147,6 @@ Global {96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.Release|Any CPU.Build.0 = Release|Any CPU {96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {37E61BDB-658E-4F44-A499-D64CC6D35485}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {37E61BDB-658E-4F44-A499-D64CC6D35485}.Debug|Any CPU.Build.0 = Debug|Any CPU - {37E61BDB-658E-4F44-A499-D64CC6D35485}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {37E61BDB-658E-4F44-A499-D64CC6D35485}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {37E61BDB-658E-4F44-A499-D64CC6D35485}.Release|Any CPU.ActiveCfg = Release|Any CPU - {37E61BDB-658E-4F44-A499-D64CC6D35485}.Release|Any CPU.Build.0 = Release|Any CPU - {37E61BDB-658E-4F44-A499-D64CC6D35485}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {37E61BDB-658E-4F44-A499-D64CC6D35485}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {995F2FEB-65FA-4399-B1C0-16E0B3FBDB15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {995F2FEB-65FA-4399-B1C0-16E0B3FBDB15}.Debug|Any CPU.Build.0 = Debug|Any CPU {995F2FEB-65FA-4399-B1C0-16E0B3FBDB15}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -249,14 +179,6 @@ Global {8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.Release|Any CPU.Build.0 = Release|Any CPU {8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {8F165A3F-A18C-4649-AA08-C0E1BA5F5C90}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {C61AAE12-5007-4205-A220-68F354A7F235}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {C61AAE12-5007-4205-A220-68F354A7F235}.Debug|Any CPU.Build.0 = Debug|Any CPU - {C61AAE12-5007-4205-A220-68F354A7F235}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {C61AAE12-5007-4205-A220-68F354A7F235}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {C61AAE12-5007-4205-A220-68F354A7F235}.Release|Any CPU.ActiveCfg = Release|Any CPU - {C61AAE12-5007-4205-A220-68F354A7F235}.Release|Any CPU.Build.0 = Release|Any CPU - {C61AAE12-5007-4205-A220-68F354A7F235}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {C61AAE12-5007-4205-A220-68F354A7F235}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {F1538809-7347-45D2-A7AC-C1D89CF0BBD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {F1538809-7347-45D2-A7AC-C1D89CF0BBD4}.Debug|Any CPU.Build.0 = Debug|Any CPU {F1538809-7347-45D2-A7AC-C1D89CF0BBD4}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -281,54 +203,6 @@ Global {AC5CA24B-B81E-4B20-B193-2E3983B1896C}.Release|Any CPU.Build.0 = Release|Any CPU {AC5CA24B-B81E-4B20-B193-2E3983B1896C}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {AC5CA24B-B81E-4B20-B193-2E3983B1896C}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {0BCDE75A-A438-46C7-95E9-391F029D07C5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {0BCDE75A-A438-46C7-95E9-391F029D07C5}.Debug|Any CPU.Build.0 = Debug|Any CPU - {0BCDE75A-A438-46C7-95E9-391F029D07C5}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {0BCDE75A-A438-46C7-95E9-391F029D07C5}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {0BCDE75A-A438-46C7-95E9-391F029D07C5}.Release|Any CPU.ActiveCfg = Release|Any CPU - {0BCDE75A-A438-46C7-95E9-391F029D07C5}.Release|Any CPU.Build.0 = Release|Any CPU - {0BCDE75A-A438-46C7-95E9-391F029D07C5}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {0BCDE75A-A438-46C7-95E9-391F029D07C5}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.Debug|Any CPU.Build.0 = Debug|Any CPU - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.Release|Any CPU.ActiveCfg = Release|Any CPU - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.Release|Any CPU.Build.0 = Release|Any CPU - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {FC684D4F-D23C-407C-9C68-E10EF3B38560}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FC684D4F-D23C-407C-9C68-E10EF3B38560}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FC684D4F-D23C-407C-9C68-E10EF3B38560}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {FC684D4F-D23C-407C-9C68-E10EF3B38560}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {FC684D4F-D23C-407C-9C68-E10EF3B38560}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FC684D4F-D23C-407C-9C68-E10EF3B38560}.Release|Any CPU.Build.0 = Release|Any CPU - {FC684D4F-D23C-407C-9C68-E10EF3B38560}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {FC684D4F-D23C-407C-9C68-E10EF3B38560}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.Release|Any CPU.Build.0 = Release|Any CPU - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.Release|Any CPU.Build.0 = Release|Any CPU - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.Debug|Any CPU.Build.0 = Debug|Any CPU - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.Release|Any CPU.ActiveCfg = Release|Any CPU - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.Release|Any CPU.Build.0 = Release|Any CPU - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {5257B25D-330A-4DCF-ACED-B4709CFBF916}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5257B25D-330A-4DCF-ACED-B4709CFBF916}.Debug|Any CPU.Build.0 = Debug|Any CPU {5257B25D-330A-4DCF-ACED-B4709CFBF916}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -361,22 +235,6 @@ Global {323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.Release|Any CPU.Build.0 = Release|Any CPU {323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU {323553F0-14AB-4FBD-9CF0-1CC0BE8056F8}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Debug|Any CPU.Build.0 = Debug|Any CPU - {6205467F-E381-4C42-AEEC-763BD62B3D5E}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {6205467F-E381-4C42-AEEC-763BD62B3D5E}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Release|Any CPU.ActiveCfg = Release|Any CPU - {6205467F-E381-4C42-AEEC-763BD62B3D5E}.Release|Any CPU.Build.0 = Release|Any CPU - {6205467F-E381-4C42-AEEC-763BD62B3D5E}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {6205467F-E381-4C42-AEEC-763BD62B3D5E}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU - {933101DA-C4CC-401A-AA01-2784E1025B7F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {933101DA-C4CC-401A-AA01-2784E1025B7F}.Debug|Any CPU.Build.0 = Debug|Any CPU - {933101DA-C4CC-401A-AA01-2784E1025B7F}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU - {933101DA-C4CC-401A-AA01-2784E1025B7F}.DebugNoVSIX|Any CPU.Build.0 = Debug|Any CPU - {933101DA-C4CC-401A-AA01-2784E1025B7F}.Release|Any CPU.ActiveCfg = Release|Any CPU - {933101DA-C4CC-401A-AA01-2784E1025B7F}.Release|Any CPU.Build.0 = Release|Any CPU - {933101DA-C4CC-401A-AA01-2784E1025B7F}.ReleaseNoVSIX|Any CPU.ActiveCfg = Release|Any CPU - {933101DA-C4CC-401A-AA01-2784E1025B7F}.ReleaseNoVSIX|Any CPU.Build.0 = Release|Any CPU {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.Debug|Any CPU.Build.0 = Debug|Any CPU {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB}.DebugNoVSIX|Any CPU.ActiveCfg = Debug|Any CPU @@ -420,34 +278,20 @@ Global {932F3C9C-A6C0-40D3-BA50-9309886242FC} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {969357A4-CCF1-46D9-B002-9AA072AFC75C} = {92463391-81BE-462B-AC3C-78C6C760741F} {277AB67E-9C8D-4799-A18C-C628E70A8664} = {92463391-81BE-462B-AC3C-78C6C760741F} - {0F265874-C592-448B-BC4F-3430AB03E0DC} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} - {4EAD959D-73B2-4FB2-B46F-16CEB1EF49D4} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} - {D66B45B5-CBFD-4947-81F1-F30AB80EA992} = {C0CC1E1F-1559-44DE-93A8-63259CEA2AAB} {42403DAF-F0BC-4F3A-B7F2-46D7013345D8} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {7A8A1664-37CE-4376-81CA-1862CF5F91D9} = {92463391-81BE-462B-AC3C-78C6C760741F} - {E5D92DB7-5CBF-410A-9685-FF76F71EC96F} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {96EB1BD4-B8E0-4F52-A068-BBCACA7E3F63} = {92463391-81BE-462B-AC3C-78C6C760741F} - {37E61BDB-658E-4F44-A499-D64CC6D35485} = {92463391-81BE-462B-AC3C-78C6C760741F} {995F2FEB-65FA-4399-B1C0-16E0B3FBDB15} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {7CFD5646-A757-4498-9E01-9C8528ED60AE} = {92463391-81BE-462B-AC3C-78C6C760741F} {078AEF36-F319-4CE2-BAA2-5B58A6536B46} = {92463391-81BE-462B-AC3C-78C6C760741F} {8F165A3F-A18C-4649-AA08-C0E1BA5F5C90} = {92463391-81BE-462B-AC3C-78C6C760741F} - {C61AAE12-5007-4205-A220-68F354A7F235} = {92463391-81BE-462B-AC3C-78C6C760741F} {F1538809-7347-45D2-A7AC-C1D89CF0BBD4} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {296D4516-0323-4D28-955D-B0324E4F10BE} = {92463391-81BE-462B-AC3C-78C6C760741F} {AC5CA24B-B81E-4B20-B193-2E3983B1896C} = {92463391-81BE-462B-AC3C-78C6C760741F} - {0BCDE75A-A438-46C7-95E9-391F029D07C5} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} - {AA888DB9-340E-4E06-A2A4-25BFEE1AC2B7} = {92463391-81BE-462B-AC3C-78C6C760741F} - {FC684D4F-D23C-407C-9C68-E10EF3B38560} = {92463391-81BE-462B-AC3C-78C6C760741F} - {FAF9986F-E086-4513-9D52-F7BF5FFCF31D} = {C0CC1E1F-1559-44DE-93A8-63259CEA2AAB} - {95B18DEE-8B45-4CF0-B9F8-CCBAF3B5251A} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} - {B8A3E4CA-D54A-441F-A3BF-E00F060CA042} = {92463391-81BE-462B-AC3C-78C6C760741F} {5257B25D-330A-4DCF-ACED-B4709CFBF916} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {1D90F276-E1CA-4FDF-A173-EB889E7D3150} = {92463391-81BE-462B-AC3C-78C6C760741F} {043B9497-C0BA-4770-9210-4456D2F81CE0} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {323553F0-14AB-4FBD-9CF0-1CC0BE8056F8} = {92463391-81BE-462B-AC3C-78C6C760741F} - {6205467F-E381-4C42-AEEC-763BD62B3D5E} = {C2C98051-0F39-47F2-80B6-E72B29159F2C} - {933101DA-C4CC-401A-AA01-2784E1025B7F} = {92463391-81BE-462B-AC3C-78C6C760741F} {3E7F2D49-3B45-45A8-9893-F73EC1EEBAAB} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {7D9ECCEE-71D1-4A42-ABEE-876AFA1B4FC9} = {3C0D6505-79B3-49D0-B4C3-176F0F1836ED} {6EA56B2B-89EC-4C38-A384-97D203375B06} = {92463391-81BE-462B-AC3C-78C6C760741F} diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/AssemblyInfo.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/AssemblyInfo.cs deleted file mode 100644 index 32248e0d1b..0000000000 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/AssemblyInfo.cs +++ /dev/null @@ -1 +0,0 @@ -[assembly: BenchmarkDotNet.Attributes.AspNetCoreBenchmark] diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/CodeGenerationBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/CodeGenerationBenchmark.cs deleted file mode 100644 index c35e1db42f..0000000000 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/CodeGenerationBenchmark.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using BenchmarkDotNet.Attributes; -using Microsoft.AspNetCore.Mvc.Razor.Extensions; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.AspNetCore.Razor.Performance -{ - public class CodeGenerationBenchmark - { - public CodeGenerationBenchmark() - { - var current = new DirectoryInfo(AppContext.BaseDirectory); - while (current != null && !File.Exists(Path.Combine(current.FullName, "MSN.cshtml"))) - { - current = current.Parent; - } - - var root = current; - var fileSystem = RazorProjectFileSystem.Create(root.FullName); - - ProjectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, b => RazorExtensions.Register(b)); ; - - MSN = fileSystem.GetItem(Path.Combine(root.FullName, "MSN.cshtml")); - } - - public RazorProjectEngine ProjectEngine { get; } - - public RazorProjectItem MSN { get; } - - [Benchmark(Description = "Razor Design Time Code Generation of MSN.com")] - public void CodeGeneration_DesignTime_LargeStaticFile() - { - var codeDocument = ProjectEngine.ProcessDesignTime(MSN); - var generated = codeDocument.GetCSharpDocument(); - - if (generated.Diagnostics.Count != 0) - { - throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics)); - } - } - - [Benchmark(Description = "Razor Runtime Code Generation of MSN.com")] - public void CodeGeneration_Runtime_LargeStaticFile() - { - var codeDocument = ProjectEngine.Process(MSN); - var generated = codeDocument.GetCSharpDocument(); - - if (generated.Diagnostics.Count != 0) - { - throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics)); - } - } - } -} diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml deleted file mode 100644 index 7b3d7a3a08..0000000000 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/MSN.cshtml +++ /dev/null @@ -1,3983 +0,0 @@ - - - - - - - - MSN.com - Hotmail, Outlook, Skype, Bing, Latest News, Photos & Videos - - - - - - - - - - - - - - - -
- - - - - -
- - - - -
- -
- - - - - -
- -
- - - -
-
-
- - -
- -
- - - - -
-
-
- - - -
- -
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
-
- - - -
- - - - -
- -
-
- -
-
-
-
- - - -
- - - - - - -
- -
-
- -
-
- -
-
- - -
- -
- - -
- - - - - -
- -
- - -
-
- - -
-
-
-
- - -
- -
- - -
- - - - - -
- -
-
- - - - - - - - -
-
- - - - -
- -
-
- - -
-
- -
-
- - -
- -
- - -
- - - - - -
- -
-
- - -
- -
-
-
- - - - - - - - - -
- - - - - - -

Powered by

-
-
-
- -
-
-
- -
- -
-
- -
- -
- - - -
- -
-
- - -
-
- - - - - - - -
-

Add or Remove a Section

- -
- - - - - - - - - - - - - - - - - - - -
-
- -
- -
- - -
-
- - - - - -
-
- -

Take a moment to like MSN!

-

Join millions of fans to get the best online content on Facebook

-
-
-
- -
-
-
- -
- -
-

Send Feedback

- - -
-
-

We appreciate your input!

-
-
-
- -
    -
  • I'm having problems with Top Destinations

  • -
  • I'm having issues searching

  • -
  • I'm having problems with Featured Apps

  • -
  • I see an error in the content

  • -
  • Other

  • -
-
-
- - -
-
-
- - -
-

Please give an overall site rating:

-
    -
  • -
  • -
  • -
  • -
  • -
-
-
-
- - -
- - File Directly to TFS - - - -
- - - - - \ No newline at end of file diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj deleted file mode 100644 index 60fc7c6b47..0000000000 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/Microsoft.AspNetCore.Razor.Performance.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - netcoreapp2.1 - Exe - true - true - false - - - - - - - - - - Serialization\%(FileName)%(Extension) - - - - - - - - - - diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/TagHelperSerializationBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/TagHelperSerializationBenchmark.cs deleted file mode 100644 index f1dcabe640..0000000000 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/TagHelperSerializationBenchmark.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; -using BenchmarkDotNet.Attributes; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.LanguageServices.Razor.Serialization; -using Newtonsoft.Json; - -namespace Microsoft.AspNetCore.Razor.Performance -{ - public class TagHelperSerializationBenchmark - { - private readonly byte[] _tagHelperBuffer; - - public TagHelperSerializationBenchmark() - { - var current = new DirectoryInfo(AppContext.BaseDirectory); - while (current != null && !File.Exists(Path.Combine(current.FullName, "taghelpers.json"))) - { - current = current.Parent; - } - - var tagHelperFilePath = Path.Combine(current.FullName, "taghelpers.json"); - _tagHelperBuffer = File.ReadAllBytes(tagHelperFilePath); - } - - [Benchmark(Description = "Razor TagHelper Serialization")] - public void TagHelper_Serialization_RoundTrip() - { - var serializer = new JsonSerializer(); - serializer.Converters.Add(new RazorDiagnosticJsonConverter()); - serializer.Converters.Add(new TagHelperDescriptorJsonConverter()); - - // Deserialize from json file. - IReadOnlyList tagHelpers; - using (var stream = new MemoryStream(_tagHelperBuffer)) - using (var reader = new JsonTextReader(new StreamReader(stream))) - { - tagHelpers = serializer.Deserialize>(reader); - } - - // Serialize back to json. - using (var stream = new MemoryStream()) - using (var writer = new StreamWriter(stream, Encoding.UTF8, bufferSize: 4096)) - { - serializer.Serialize(writer, tagHelpers); - } - } - } -} diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/readme.md b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/readme.md deleted file mode 100644 index 38ce0ff71a..0000000000 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/readme.md +++ /dev/null @@ -1,11 +0,0 @@ -Compile the solution in Release mode (so binaries are available in release) - -To run a specific benchmark add it as parameter. -``` -dotnet run -c Release -``` - -If you run without any parameters, you'll be offered the list of all benchmarks and get to choose. -``` -dotnet run -c Release -``` \ No newline at end of file diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/taghelpers.json b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/taghelpers.json deleted file mode 100644 index 27dcb16038..0000000000 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Performance/taghelpers.json +++ /dev/null @@ -1 +0,0 @@ -[{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper","TagMatchingRules":[{"TagName":"*","Attributes":[{"Name":"asp-prerender-module","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-prerender-module","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.SpaServices","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-prerender-module","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.ModuleName","Diagnostics":[],"Metadata":{"Common.PropertyName":"ModuleName"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-prerender-export","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.ExportName","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExportName"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-prerender-data","IndexerNamePrefix":null,"TypeName":"System.Object","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"object Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.CustomDataParameter","Diagnostics":[],"Metadata":{"Common.PropertyName":"CustomDataParameter"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-prerender-timeout","IndexerNamePrefix":null,"TypeName":"System.Int32","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"int Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper.TimeoutMillisecondsParameter","Diagnostics":[],"Metadata":{"Common.PropertyName":"TimeoutMillisecondsParameter"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.SpaServices.Prerendering.PrerenderTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper","TagMatchingRules":[{"TagName":"a","Attributes":[{"Name":"asp-action","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-controller","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-controller","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-area","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-area","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-page","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-page-handler","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page-handler","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-fragment","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fragment","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-host","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-host","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-protocol","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-protocol","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-route","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-route","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-all-route-data","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-all-route-data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"asp-route-","NameComparison":1,"Value":null,"ValueComparison":0,"DisplayName":"asp-route-...","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-action","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Action","Diagnostics":[],"Metadata":{"Common.PropertyName":"Action"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-controller","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Controller","Diagnostics":[],"Metadata":{"Common.PropertyName":"Controller"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-area","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Area","Diagnostics":[],"Metadata":{"Common.PropertyName":"Area"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Page","Diagnostics":[],"Metadata":{"Common.PropertyName":"Page"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page-handler","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.PageHandler","Diagnostics":[],"Metadata":{"Common.PropertyName":"PageHandler"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-protocol","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Protocol","Diagnostics":[],"Metadata":{"Common.PropertyName":"Protocol"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-host","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Host","Diagnostics":[],"Metadata":{"Common.PropertyName":"Host"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fragment","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Fragment","Diagnostics":[],"Metadata":{"Common.PropertyName":"Fragment"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.Route","Diagnostics":[],"Metadata":{"Common.PropertyName":"Route"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":true,"IsEnum":false,"IsStringProperty":false,"Name":"asp-all-route-data","IndexerNamePrefix":"asp-route-","TypeName":"System.Collections.Generic.IDictionary","IndexerTypeName":"System.String","HasIndexer":true,"Documentation":null,"DisplayName":"System.Collections.Generic.IDictionary Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper.RouteValues","Diagnostics":[],"Metadata":{"Common.PropertyName":"RouteValues"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.AnchorTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper","TagMatchingRules":[{"TagName":"cache","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"priority","IndexerNamePrefix":null,"TypeName":"Microsoft.Extensions.Caching.Memory.CacheItemPriority?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.Extensions.Caching.Memory.CacheItemPriority? Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.Priority","Diagnostics":[],"Metadata":{"Common.PropertyName":"Priority"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryBy","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryBy"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-header","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByHeader","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByHeader"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-query","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByQuery","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByQuery"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByRoute","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByRoute"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-cookie","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByCookie","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByCookie"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"vary-by-user","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.VaryByUser","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByUser"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-on","IndexerNamePrefix":null,"TypeName":"System.DateTimeOffset?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.DateTimeOffset? Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.ExpiresOn","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresOn"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-after","IndexerNamePrefix":null,"TypeName":"System.TimeSpan?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.TimeSpan? Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.ExpiresAfter","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresAfter"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-sliding","IndexerNamePrefix":null,"TypeName":"System.TimeSpan?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.TimeSpan? Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.ExpiresSliding","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresSliding"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"enabled","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper.Enabled","Diagnostics":[],"Metadata":{"Common.PropertyName":"Enabled"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.CacheTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper","TagMatchingRules":[{"TagName":"distributed-cache","Attributes":[{"Name":"name","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"name","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"name","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.Name","Diagnostics":[],"Metadata":{"Common.PropertyName":"Name"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryBy","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryBy"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-header","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByHeader","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByHeader"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-query","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByQuery","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByQuery"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByRoute","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByRoute"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"vary-by-cookie","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByCookie","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByCookie"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"vary-by-user","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.VaryByUser","Diagnostics":[],"Metadata":{"Common.PropertyName":"VaryByUser"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-on","IndexerNamePrefix":null,"TypeName":"System.DateTimeOffset?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.DateTimeOffset? Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.ExpiresOn","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresOn"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-after","IndexerNamePrefix":null,"TypeName":"System.TimeSpan?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.TimeSpan? Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.ExpiresAfter","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresAfter"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"expires-sliding","IndexerNamePrefix":null,"TypeName":"System.TimeSpan?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.TimeSpan? Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.ExpiresSliding","Diagnostics":[],"Metadata":{"Common.PropertyName":"ExpiresSliding"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"enabled","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper.Enabled","Diagnostics":[],"Metadata":{"Common.PropertyName":"Enabled"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.DistributedCacheTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper","TagMatchingRules":[{"TagName":"environment","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"names","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper.Names","Diagnostics":[],"Metadata":{"Common.PropertyName":"Names"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper.Include","Diagnostics":[],"Metadata":{"Common.PropertyName":"Include"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper.Exclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"Exclude"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.EnvironmentTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper","TagMatchingRules":[{"TagName":"button","Attributes":[{"Name":"asp-action","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-controller","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-controller","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-area","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-area","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-page","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-page-handler","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page-handler","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-fragment","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fragment","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-route","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-route","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-all-route-data","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-all-route-data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"asp-route-","NameComparison":1,"Value":null,"ValueComparison":0,"DisplayName":"asp-route-...","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-action","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-controller","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-controller","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-area","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-area","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-page","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-page-handler","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page-handler","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-fragment","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fragment","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-route","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-route","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-all-route-data","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-all-route-data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"image","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-route-","NameComparison":1,"Value":null,"ValueComparison":0,"DisplayName":"asp-route-...","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-action","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-controller","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-controller","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-area","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-area","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-page","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-page-handler","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-page-handler","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-fragment","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fragment","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-route","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-route","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-all-route-data","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-all-route-data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"type","NameComparison":0,"Value":"submit","ValueComparison":1,"DisplayName":"type","Diagnostics":[],"HasErrors":false},{"Name":"asp-route-","NameComparison":1,"Value":null,"ValueComparison":0,"DisplayName":"asp-route-...","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-action","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Action","Diagnostics":[],"Metadata":{"Common.PropertyName":"Action"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-controller","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Controller","Diagnostics":[],"Metadata":{"Common.PropertyName":"Controller"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-area","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Area","Diagnostics":[],"Metadata":{"Common.PropertyName":"Area"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Page","Diagnostics":[],"Metadata":{"Common.PropertyName":"Page"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page-handler","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.PageHandler","Diagnostics":[],"Metadata":{"Common.PropertyName":"PageHandler"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fragment","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Fragment","Diagnostics":[],"Metadata":{"Common.PropertyName":"Fragment"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.Route","Diagnostics":[],"Metadata":{"Common.PropertyName":"Route"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":true,"IsEnum":false,"IsStringProperty":false,"Name":"asp-all-route-data","IndexerNamePrefix":"asp-route-","TypeName":"System.Collections.Generic.IDictionary","IndexerTypeName":"System.String","HasIndexer":true,"Documentation":null,"DisplayName":"System.Collections.Generic.IDictionary Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper.RouteValues","Diagnostics":[],"Metadata":{"Common.PropertyName":"RouteValues"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.FormActionTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper","TagMatchingRules":[{"TagName":"form","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-action","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Action","Diagnostics":[],"Metadata":{"Common.PropertyName":"Action"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-controller","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Controller","Diagnostics":[],"Metadata":{"Common.PropertyName":"Controller"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-area","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Area","Diagnostics":[],"Metadata":{"Common.PropertyName":"Area"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Page","Diagnostics":[],"Metadata":{"Common.PropertyName":"Page"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-page-handler","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.PageHandler","Diagnostics":[],"Metadata":{"Common.PropertyName":"PageHandler"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-antiforgery","IndexerNamePrefix":null,"TypeName":"System.Boolean?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.Boolean? Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Antiforgery","Diagnostics":[],"Metadata":{"Common.PropertyName":"Antiforgery"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fragment","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Fragment","Diagnostics":[],"Metadata":{"Common.PropertyName":"Fragment"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-route","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Route","Diagnostics":[],"Metadata":{"Common.PropertyName":"Route"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"method","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.Method","Diagnostics":[],"Metadata":{"Common.PropertyName":"Method"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":true,"IsEnum":false,"IsStringProperty":false,"Name":"asp-all-route-data","IndexerNamePrefix":"asp-route-","TypeName":"System.Collections.Generic.IDictionary","IndexerTypeName":"System.String","HasIndexer":true,"Documentation":null,"DisplayName":"System.Collections.Generic.IDictionary Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper.RouteValues","Diagnostics":[],"Metadata":{"Common.PropertyName":"RouteValues"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.FormTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper","TagMatchingRules":[{"TagName":"img","Attributes":[{"Name":"asp-append-version","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-append-version","Diagnostics":[],"HasErrors":false},{"Name":"src","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"src","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper.Src","Diagnostics":[],"Metadata":{"Common.PropertyName":"Src"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-append-version","IndexerNamePrefix":null,"TypeName":"System.Boolean","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"bool Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper.AppendVersion","Diagnostics":[],"Metadata":{"Common.PropertyName":"AppendVersion"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.ImageTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper","TagMatchingRules":[{"TagName":"input","Attributes":[{"Name":"asp-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-format","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.Format","Diagnostics":[],"Metadata":{"Common.PropertyName":"Format"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"type","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.InputTypeName","Diagnostics":[],"Metadata":{"Common.PropertyName":"InputTypeName"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"value","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.Value","Diagnostics":[],"Metadata":{"Common.PropertyName":"Value"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper","TagMatchingRules":[{"TagName":"label","Attributes":[{"Name":"asp-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.LabelTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper","TagMatchingRules":[{"TagName":"link","Attributes":[{"Name":"asp-href-include","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-href-include","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-href-exclude","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-href-exclude","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-href","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-href-include","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-href-include","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-href-exclude","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-href-exclude","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-test-class","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-test-class","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-test-property","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-test-property","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-fallback-test-value","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-test-value","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"asp-append-version","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-append-version","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"href","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.Href","Diagnostics":[],"Metadata":{"Common.PropertyName":"Href"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-href-include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.HrefInclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"HrefInclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-href-exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.HrefExclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"HrefExclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-href","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackHref","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackHref"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-append-version","IndexerNamePrefix":null,"TypeName":"System.Boolean?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.Boolean? Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.AppendVersion","Diagnostics":[],"Metadata":{"Common.PropertyName":"AppendVersion"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-href-include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackHrefInclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackHrefInclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-href-exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackHrefExclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackHrefExclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-test-class","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackTestClass","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackTestClass"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-test-property","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackTestProperty","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackTestProperty"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-test-value","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper.FallbackTestValue","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackTestValue"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.LinkTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper","TagMatchingRules":[{"TagName":"option","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"value","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper.Value","Diagnostics":[],"Metadata":{"Common.PropertyName":"Value"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.OptionTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper","TagMatchingRules":[{"TagName":"form","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.RenderAtEndOfFormTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper","TagMatchingRules":[{"TagName":"script","Attributes":[{"Name":"asp-src-include","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-src-include","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-src-exclude","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-src-exclude","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-fallback-src","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-fallback-src-include","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-src-include","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-fallback-src-exclude","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-src-exclude","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-fallback-test","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-fallback-test","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"asp-append-version","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-append-version","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"src","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.Src","Diagnostics":[],"Metadata":{"Common.PropertyName":"Src"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-src-include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.SrcInclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"SrcInclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-src-exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.SrcExclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"SrcExclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-src","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.FallbackSrc","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackSrc"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-append-version","IndexerNamePrefix":null,"TypeName":"System.Boolean?","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.Boolean? Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.AppendVersion","Diagnostics":[],"Metadata":{"Common.PropertyName":"AppendVersion"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-src-include","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.FallbackSrcInclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackSrcInclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-src-exclude","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.FallbackSrcExclude","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackSrcExclude"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":true,"Name":"asp-fallback-test","IndexerNamePrefix":null,"TypeName":"System.String","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"string Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper.FallbackTestExpression","Diagnostics":[],"Metadata":{"Common.PropertyName":"FallbackTestExpression"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.ScriptTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper","TagMatchingRules":[{"TagName":"select","Attributes":[{"Name":"asp-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"select","Attributes":[{"Name":"asp-items","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-items","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false},{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-items","IndexerNamePrefix":null,"TypeName":"System.Collections.Generic.IEnumerable","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"System.Collections.Generic.IEnumerable Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper.Items","Diagnostics":[],"Metadata":{"Common.PropertyName":"Items"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.SelectTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper","TagMatchingRules":[{"TagName":"textarea","Attributes":[{"Name":"asp-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.TextAreaTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper","TagMatchingRules":[{"TagName":"span","Attributes":[{"Name":"asp-validation-for","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-validation-for","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":false,"IsStringProperty":false,"Name":"asp-validation-for","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.ViewFeatures.ModelExpression Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper.For","Diagnostics":[],"Metadata":{"Common.PropertyName":"For"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationMessageTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper","TagMatchingRules":[{"TagName":"div","Attributes":[{"Name":"asp-validation-summary","NameComparison":0,"Value":null,"ValueComparison":0,"DisplayName":"asp-validation-summary","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.TagHelpers","BoundAttributes":[{"Kind":"ITagHelper","IsIndexerStringProperty":false,"IsEnum":true,"IsStringProperty":false,"Name":"asp-validation-summary","IndexerNamePrefix":null,"TypeName":"Microsoft.AspNetCore.Mvc.Rendering.ValidationSummary","IndexerTypeName":null,"HasIndexer":false,"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.Rendering.ValidationSummary Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper.ValidationSummary","Diagnostics":[],"Metadata":{"Common.PropertyName":"ValidationSummary"},"HasErrors":false}],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.TagHelpers.ValidationSummaryTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper","TagMatchingRules":[{"TagName":"body","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.Razor","BoundAttributes":[],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper","TagMatchingRules":[{"TagName":"head","Attributes":[],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.Razor","BoundAttributes":[],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.HeadTagHelper"},"HasErrors":false},{"Kind":"ITagHelper","Name":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper","TagMatchingRules":[{"TagName":"*","Attributes":[{"Name":"itemid","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"itemid","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"a","Attributes":[{"Name":"href","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"applet","Attributes":[{"Name":"archive","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"archive","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"area","Attributes":[{"Name":"href","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"audio","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"base","Attributes":[{"Name":"href","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"blockquote","Attributes":[{"Name":"cite","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"cite","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"button","Attributes":[{"Name":"formaction","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"formaction","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"del","Attributes":[{"Name":"cite","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"cite","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"embed","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"form","Attributes":[{"Name":"action","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"action","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"html","Attributes":[{"Name":"manifest","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"manifest","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"iframe","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"img","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"img","Attributes":[{"Name":"srcset","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"srcset","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"input","Attributes":[{"Name":"formaction","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"formaction","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"ins","Attributes":[{"Name":"cite","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"cite","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"link","Attributes":[{"Name":"href","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"href","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"menuitem","Attributes":[{"Name":"icon","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"icon","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"object","Attributes":[{"Name":"archive","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"archive","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"object","Attributes":[{"Name":"data","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"data","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"q","Attributes":[{"Name":"cite","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"cite","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"script","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"source","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"source","Attributes":[{"Name":"srcset","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"srcset","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"track","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":2,"Diagnostics":[],"HasErrors":false},{"TagName":"video","Attributes":[{"Name":"src","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"src","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false},{"TagName":"video","Attributes":[{"Name":"poster","NameComparison":0,"Value":"~/","ValueComparison":2,"DisplayName":"poster","Diagnostics":[],"HasErrors":false}],"ParentTag":null,"TagStructure":0,"Diagnostics":[],"HasErrors":false}],"AssemblyName":"Microsoft.AspNetCore.Mvc.Razor","BoundAttributes":[],"AllowedChildTags":[],"Documentation":null,"DisplayName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper","TagOutputHint":null,"Diagnostics":[],"Metadata":{"Runtime.Name":"ITagHelper","Common.TypeName":"Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper"},"HasErrors":false}] \ No newline at end of file diff --git a/src/Razor/build.cmd b/src/Razor/build.cmd new file mode 100644 index 0000000000..f4169ea5e4 --- /dev/null +++ b/src/Razor/build.cmd @@ -0,0 +1,3 @@ +@ECHO OFF +SET RepoRoot="%~dp0..\.." +%RepoRoot%\build.cmd -LockFile %RepoRoot%\korebuild-lock.txt -Path %~dp0 %* diff --git a/src/Razor/build.sh b/src/Razor/build.sh new file mode 100644 index 0000000000..d5bb0cf631 --- /dev/null +++ b/src/Razor/build.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail + +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +repo_root="$DIR/../.." +"$repo_root/build.sh" --path "$DIR" --lockfile "$repo_root/korebuild-lock.txt" "$@" diff --git a/src/Razor/build/MPack.targets b/src/Razor/build/MPack.targets deleted file mode 100644 index 54ace6edf4..0000000000 --- a/src/Razor/build/MPack.targets +++ /dev/null @@ -1,97 +0,0 @@ - - - $(PackageDependsOn);GenerateMPack - $(GetArtifactInfoDependsOn);GetMPackArtifactInfo - Microsoft.VisualStudio.Mac.RazorAddin - $(RepositoryRoot)tooling\$(AddinName)\ - shipoob - - $(IntermediateDir)mpack\ - $(AddinDirectory)bin\$(Configuration)\net461\ - Microsoft.VisualStudio.Mac.LanguageServices.Razor - $(RepositoryRoot)src\$(LanguageServiceName)\bin\$(Configuration)\net461\ - $(AddinName)_$(AddinVersion) - $(MPackName).mpack - $(BuildDir)$(MPackFileName) - $(BuildDir)$(MPackName).zip - $(AddinDirectory)Properties\_Manifest.addin.xml - $(MPackIntermediateOutputPath)addin.info - - - - - - - - - MPackFile - $(AddinName) - $(AddinVersion) - $(MPackArtifactCategory) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Razor/build/VSIX.targets b/src/Razor/build/VSIX.targets deleted file mode 100644 index 09b73d8b89..0000000000 --- a/src/Razor/build/VSIX.targets +++ /dev/null @@ -1,121 +0,0 @@ - - - false - $(RestoreDependsOn);RestoreVSIX - $(PackageDependsOn);PackageVSIX - $(GetArtifactInfoDependsOn);GetVSIXArtifactInfo - Microsoft.VisualStudio.RazorExtension - $(BuildDir)$(VSIXName).vsix - $(BuildDir)$(VSIXName).json - $(RepositoryRoot)tooling\$(VSIXName)\$(VSIXName).csproj - $(BuildDir)$(VSIXName).pdb - shipoob - - - - - - - - - - VsixPackage - $(PackageVersion) - $(VSIXArtifactCategory) - $(VSIXName) - - - - SymbolsFile - $(VSIXArtifactCategory) - $(VSIXName).vsix - full - - - - VsixPackageManifestFile - $(VSIXArtifactCategory) - $(VSIXName).vsix - $(VSIXName) - - - - - - - - - - - - - - $(LogOutputDir)vsix-restore.rsp - - - - - - - - - - - - - - - - - - - - - - $(LogOutputDir)vsix.log - $(LogOutputDir)vsix-build.rsp - - - - - - - - - - - - - - - diff --git a/src/Razor/build/repo.targets b/src/Razor/build/repo.targets index 2e234b2b72..f9ef2f96ae 100644 --- a/src/Razor/build/repo.targets +++ b/src/Razor/build/repo.targets @@ -1,6 +1,4 @@  - - diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs index 7214d8baca..1a87602ce2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.Language/Properties/AssemblyInfo.cs @@ -2,24 +2,12 @@ // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.GenerateTool, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Language.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.TagHelperTool, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Tools.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("rzc, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Microsoft.AspNetCore.Razor.Tools.csproj b/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Microsoft.AspNetCore.Razor.Tools.csproj index e67f36e02f..8e48f98549 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Microsoft.AspNetCore.Razor.Tools.csproj +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Microsoft.AspNetCore.Razor.Tools.csproj @@ -1,4 +1,4 @@ - + Razor is a markup syntax for adding server-side logic to web pages. This assembly contains infrastructure supporting Razor MSBuild integration. @@ -12,15 +12,6 @@ false - - - Shared\TagHelperDescriptorJsonConverter.cs - - - Shared\RazorDiagnosticJsonConverter.cs - - - diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorDiagnosticJsonConverter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Shared/RazorDiagnosticJsonConverter.cs similarity index 100% rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorDiagnosticJsonConverter.cs rename to src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Shared/RazorDiagnosticJsonConverter.cs diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/TagHelperDescriptorJsonConverter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Shared/TagHelperDescriptorJsonConverter.cs similarity index 100% rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/TagHelperDescriptorJsonConverter.cs rename to src/Razor/src/Microsoft.AspNetCore.Razor.Tools/Shared/TagHelperDescriptorJsonConverter.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporter.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporter.cs deleted file mode 100644 index ff200966e8..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporter.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.CodeAnalysis.Razor -{ - internal class DefaultErrorReporter : ErrorReporter - { - public override void ReportError(Exception exception) - { - if (exception == null) - { - throw new ArgumentNullException(nameof(exception)); - } - - // Do nothing. - } - - public override void ReportError(Exception exception, ProjectSnapshot project) - { - if (exception == null) - { - throw new ArgumentNullException(nameof(exception)); - } - - // Do nothing. - } - - public override void ReportError(Exception exception, Project workspaceProject) - { - if (exception == null) - { - throw new ArgumentNullException(nameof(exception)); - } - - // Do nothing. - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs deleted file mode 100644 index e9c987d108..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DefaultErrorReporterFactory.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.Razor -{ - [Shared] - [ExportWorkspaceServiceFactory(typeof(ErrorReporter), ServiceLayer.Default)] - internal class DefaultErrorReporterFactory : IWorkspaceServiceFactory - { - public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) - { - return new DefaultErrorReporter(); - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettings.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettings.cs deleted file mode 100644 index 113238a878..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettings.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright(c) .NET Foundation.All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.Extensions.Internal; - -namespace Microsoft.CodeAnalysis.Razor.Editor -{ - public sealed class EditorSettings : IEquatable - { - public static readonly EditorSettings Default = new EditorSettings(indentWithTabs: false, indentSize: 4); - - public EditorSettings(bool indentWithTabs, int indentSize) - { - if (indentSize < 0) - { - throw new ArgumentOutOfRangeException(nameof(indentSize)); - } - - IndentWithTabs = indentWithTabs; - IndentSize = indentSize; - } - - public bool IndentWithTabs { get; } - - public int IndentSize { get; } - - public bool Equals(EditorSettings other) - { - if (other == null) - { - return false; - } - - return IndentWithTabs == other.IndentWithTabs && - IndentSize == other.IndentSize; - } - - public override bool Equals(object other) - { - return Equals(other as EditorSettings); - } - - public override int GetHashCode() - { - var combiner = HashCodeCombiner.Start(); - combiner.Add(IndentWithTabs); - combiner.Add(IndentSize); - - return combiner.CombinedHash; - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettingsChangedEventArgs.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettingsChangedEventArgs.cs deleted file mode 100644 index 573d56654a..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/EditorSettingsChangedEventArgs.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.CodeAnalysis.Razor.Editor -{ - public sealed class EditorSettingsChangedEventArgs : EventArgs - { - public EditorSettingsChangedEventArgs(EditorSettings settings) - { - Settings = settings; - } - - public EditorSettings Settings { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/WorkspaceEditorSettings.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/WorkspaceEditorSettings.cs deleted file mode 100644 index 6736dfc39d..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Editor/WorkspaceEditorSettings.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.Razor.Editor -{ - internal abstract class WorkspaceEditorSettings : ILanguageService - { - public abstract event EventHandler Changed; - - public abstract EditorSettings Current { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ErrorReporter.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ErrorReporter.cs deleted file mode 100644 index 4f0b0dab81..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ErrorReporter.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.CodeAnalysis.Razor -{ - internal abstract class ErrorReporter : IWorkspaceService - { - public abstract void ReportError(Exception exception); - - public abstract void ReportError(Exception exception, ProjectSnapshot project); - - public abstract void ReportError(Exception exception, Project workspaceProject); - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ExportCustomProjectEngineFactoryAttribute.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ExportCustomProjectEngineFactoryAttribute.cs deleted file mode 100644 index 923cb0a66e..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ExportCustomProjectEngineFactoryAttribute.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; - -namespace Microsoft.CodeAnalysis.Razor -{ - [MetadataAttribute] - [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)] - public class ExportCustomProjectEngineFactoryAttribute : ExportAttribute, ICustomProjectEngineFactoryMetadata - { - public ExportCustomProjectEngineFactoryAttribute(string configurationName) - : base(typeof(IProjectEngineFactory)) - { - if (configurationName == null) - { - throw new ArgumentNullException(nameof(configurationName)); - } - - ConfigurationName = configurationName; - } - - public string ConfigurationName { get; } - - public bool SupportsSerialization { get; set; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/FallbackProjectEngineFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/FallbackProjectEngineFactory.cs deleted file mode 100644 index 855acedde2..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/FallbackProjectEngineFactory.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor -{ - [Export(typeof(IFallbackProjectEngineFactory))] - internal class FallbackProjectEngineFactory : IFallbackProjectEngineFactory - { - public RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure) - { - if (configuration == null) - { - throw new ArgumentNullException(nameof(configuration)); - } - - if (fileSystem == null) - { - throw new ArgumentNullException(nameof(fileSystem)); - } - - // This is a very basic implementation that will provide reasonable support without crashing. - // If the user falls into this situation, ideally they can realize that something is wrong and take - // action. - // - // This has no support for: - // - Tag Helpers - // - Imports - // - Default Imports - // - and will have a very limited set of directives - return RazorProjectEngine.Create(configuration, fileSystem, configure); - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs deleted file mode 100644 index bf9b0f59a4..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ForegroundDispatcher.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Runtime.CompilerServices; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.Razor -{ - internal abstract class ForegroundDispatcher - { - public abstract bool IsForegroundThread { get; } - - public abstract TaskScheduler ForegroundScheduler { get; } - - public abstract TaskScheduler BackgroundScheduler { get; } - - public virtual void AssertForegroundThread([CallerMemberName] string caller = null) - { - if (!IsForegroundThread) - { - caller = caller == null ? Workspaces.Resources.ForegroundDispatcher_NoMethodNamePlaceholder : $"'{caller}'"; - throw new InvalidOperationException(Workspaces.Resources.FormatForegroundDispatcher_AssertForegroundThread(caller)); - } - } - - public virtual void AssertBackgroundThread([CallerMemberName] string caller = null) - { - if (IsForegroundThread) - { - caller = caller == null ? Workspaces.Resources.ForegroundDispatcher_NoMethodNamePlaceholder : $"'{caller}'"; - throw new InvalidOperationException(Workspaces.Resources.FormatForegroundDispatcher_AssertBackgroundThread(caller)); - } - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ICustomProjectEngineFactoryMetadata.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ICustomProjectEngineFactoryMetadata.cs deleted file mode 100644 index 3f93a6e605..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ICustomProjectEngineFactoryMetadata.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Razor -{ - public interface ICustomProjectEngineFactoryMetadata - { - string ConfigurationName { get; } - - bool SupportsSerialization { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IFallbackProjectEngineFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IFallbackProjectEngineFactory.cs deleted file mode 100644 index ccdc1b80c1..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IFallbackProjectEngineFactory.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Razor -{ - // Used to create the 'fallback' project engine when we don't have a custom implementation. - internal interface IFallbackProjectEngineFactory : IProjectEngineFactory - { - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IProjectEngineFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IProjectEngineFactory.cs deleted file mode 100644 index 903c47842b..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/IProjectEngineFactory.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor -{ - public interface IProjectEngineFactory - { - RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure); - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj deleted file mode 100644 index e7f29a2fb0..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Microsoft.CodeAnalysis.Razor.Workspaces.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure. - net46;netstandard2.0 - false - - - - - - - - - - - - diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs deleted file mode 100644 index b8646429c6..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshot.cs +++ /dev/null @@ -1,184 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - // All of the public state of this is immutable - we create a new instance and notify subscribers - // when it changes. - // - // However we use the private state to track things like dirty/clean. - // - // See the private constructors... When we update the snapshot we either are processing a Workspace - // change (Project) or updating the computed state (ProjectSnapshotUpdateContext). We don't do both - // at once. - internal class DefaultProjectSnapshot : ProjectSnapshot - { - public DefaultProjectSnapshot(HostProject hostProject, Project workspaceProject, VersionStamp? version = null) - { - if (hostProject == null) - { - throw new ArgumentNullException(nameof(hostProject)); - } - - HostProject = hostProject; - WorkspaceProject = workspaceProject; // Might be null - - FilePath = hostProject.FilePath; - Version = version ?? VersionStamp.Default; - } - - private DefaultProjectSnapshot(HostProject hostProject, DefaultProjectSnapshot other) - { - if (hostProject == null) - { - throw new ArgumentNullException(nameof(hostProject)); - } - - if (other == null) - { - throw new ArgumentNullException(nameof(other)); - } - - ComputedVersion = other.ComputedVersion; - - FilePath = other.FilePath; - TagHelpers = other.TagHelpers; - HostProject = hostProject; - WorkspaceProject = other.WorkspaceProject; - - Version = other.Version.GetNewerVersion(); - } - - private DefaultProjectSnapshot(Project workspaceProject, DefaultProjectSnapshot other) - { - if (workspaceProject == null) - { - throw new ArgumentNullException(nameof(workspaceProject)); - } - - if (other == null) - { - throw new ArgumentNullException(nameof(other)); - } - - ComputedVersion = other.ComputedVersion; - - FilePath = other.FilePath; - TagHelpers = other.TagHelpers; - HostProject = other.HostProject; - WorkspaceProject = workspaceProject; - - Version = other.Version.GetNewerVersion(); - } - - private DefaultProjectSnapshot(ProjectSnapshotUpdateContext update, DefaultProjectSnapshot other) - { - if (update == null) - { - throw new ArgumentNullException(nameof(update)); - } - - if (other == null) - { - throw new ArgumentNullException(nameof(other)); - } - - ComputedVersion = update.Version; - - FilePath = other.FilePath; - HostProject = other.HostProject; - TagHelpers = update.TagHelpers ?? Array.Empty(); - WorkspaceProject = other.WorkspaceProject; - - // This doesn't represent a new version of the underlying data. Keep the same version. - Version = other.Version; - } - - public override RazorConfiguration Configuration => HostProject.Configuration; - - public override string FilePath { get; } - - public override HostProject HostProject { get; } - - public override bool IsInitialized => WorkspaceProject != null; - - public override VersionStamp Version { get; } - - public override Project WorkspaceProject { get; } - - public override IReadOnlyList TagHelpers { get; } = Array.Empty(); - - // This is the version that the computed state is based on. - public VersionStamp? ComputedVersion { get; set; } - - // We know the project is dirty if we don't have a computed result, or it was computed for a different version. - // Since the PSM updates the snapshots synchronously, the snapshot can never be older than the computed state. - public bool IsDirty => ComputedVersion == null || ComputedVersion.Value != Version; - - public ProjectSnapshotUpdateContext CreateUpdateContext() - { - return new ProjectSnapshotUpdateContext(FilePath, HostProject, WorkspaceProject, Version); - } - - public DefaultProjectSnapshot WithHostProject(HostProject hostProject) - { - if (hostProject == null) - { - throw new ArgumentNullException(nameof(hostProject)); - } - - return new DefaultProjectSnapshot(hostProject, this); - } - - public DefaultProjectSnapshot RemoveWorkspaceProject() - { - // We want to get rid of all of the computed state since it's not really valid. - return new DefaultProjectSnapshot(HostProject, null, Version.GetNewerVersion()); - } - - public DefaultProjectSnapshot WithWorkspaceProject(Project workspaceProject) - { - if (workspaceProject == null) - { - throw new ArgumentNullException(nameof(workspaceProject)); - } - - return new DefaultProjectSnapshot(workspaceProject, this); - } - - public DefaultProjectSnapshot WithComputedUpdate(ProjectSnapshotUpdateContext update) - { - if (update == null) - { - throw new ArgumentNullException(nameof(update)); - } - - return new DefaultProjectSnapshot(update, this); - } - - public bool HasConfigurationChanged(DefaultProjectSnapshot original) - { - if (original == null) - { - throw new ArgumentNullException(nameof(original)); - } - - return !object.Equals(Configuration, original.Configuration); - } - - public bool HaveTagHelpersChanged(ProjectSnapshot original) - { - if (original == null) - { - throw new ArgumentNullException(nameof(original)); - } - - return !Enumerable.SequenceEqual(TagHelpers, original.TagHelpers); - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs deleted file mode 100644 index c246fa14d7..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManager.cs +++ /dev/null @@ -1,463 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - // The implementation of project snapshot manager abstracts over the Roslyn Project (WorkspaceProject) - // and information from the host's underlying project system (HostProject), to provide a unified and - // immutable view of the underlying project systems. - // - // The HostProject support all of the configuration that the Razor SDK exposes via the project system - // (language version, extensions, named configuration). - // - // The WorkspaceProject is needed to support our use of Roslyn Compilations for Tag Helpers and other - // C# based constructs. - // - // The implementation will create a ProjectSnapshot for each HostProject. Put another way, when we - // see a WorkspaceProject get created, we only care if we already have a HostProject for the same - // filepath. - // - // Our underlying HostProject infrastructure currently does not handle multiple TFMs (project with - // $(TargetFrameworks), so we just bind to the first WorkspaceProject we see for each HostProject. - internal class DefaultProjectSnapshotManager : ProjectSnapshotManagerBase - { - public override event EventHandler Changed; - - private readonly ErrorReporter _errorReporter; - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly ProjectSnapshotChangeTrigger[] _triggers; - private readonly ProjectSnapshotWorkerQueue _workerQueue; - private readonly ProjectSnapshotWorker _worker; - - private readonly Dictionary _projects; - - public DefaultProjectSnapshotManager( - ForegroundDispatcher foregroundDispatcher, - ErrorReporter errorReporter, - ProjectSnapshotWorker worker, - IEnumerable triggers, - Workspace workspace) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (errorReporter == null) - { - throw new ArgumentNullException(nameof(errorReporter)); - } - - if (worker == null) - { - throw new ArgumentNullException(nameof(worker)); - } - - if (triggers == null) - { - throw new ArgumentNullException(nameof(triggers)); - } - - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - _foregroundDispatcher = foregroundDispatcher; - _errorReporter = errorReporter; - _worker = worker; - _triggers = triggers.ToArray(); - Workspace = workspace; - - _projects = new Dictionary(FilePathComparer.Instance); - - _workerQueue = new ProjectSnapshotWorkerQueue(_foregroundDispatcher, this, worker); - - for (var i = 0; i < _triggers.Length; i++) - { - _triggers[i].Initialize(this); - } - } - - public override IReadOnlyList Projects - { - get - { - _foregroundDispatcher.AssertForegroundThread(); - return _projects.Values.ToArray(); - } - } - - public override Workspace Workspace { get; } - - public override void ProjectUpdated(ProjectSnapshotUpdateContext update) - { - if (update == null) - { - throw new ArgumentNullException(nameof(update)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - if (_projects.TryGetValue(update.WorkspaceProject.FilePath, out var original)) - { - if (!original.IsInitialized) - { - // If the project has been uninitialized, just ignore the update. - return; - } - - // This is an update to the project's computed values, so everything should be overwritten - var snapshot = original.WithComputedUpdate(update); - _projects[update.WorkspaceProject.FilePath] = snapshot; - - if (snapshot.IsDirty) - { - // It's possible that the snapshot can still be dirty if we got a project update while computing state in - // the background. We need to trigger the background work to asynchronously compute the effect of the updates. - NotifyBackgroundWorker(snapshot.CreateUpdateContext()); - } - - if (!object.Equals(snapshot.ComputedVersion, original.ComputedVersion)) - { - NotifyListeners(new ProjectChangeEventArgs(snapshot, ProjectChangeKind.TagHelpersChanged)); - } - } - } - - public override void HostProjectAdded(HostProject hostProject) - { - if (hostProject == null) - { - throw new ArgumentNullException(nameof(hostProject)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - // We don't expect to see a HostProject initialized multiple times for the same path. Just ignore it. - if (_projects.ContainsKey(hostProject.FilePath)) - { - return; - } - - // It's possible that Workspace has already created a project for this, but it's not deterministic - // So if possible find a WorkspaceProject. - var workspaceProject = GetWorkspaceProject(hostProject.FilePath); - - var snapshot = new DefaultProjectSnapshot(hostProject, workspaceProject); - _projects[hostProject.FilePath] = snapshot; - - if (snapshot.IsInitialized && snapshot.IsDirty) - { - // Start computing background state if the project is fully initialized. - NotifyBackgroundWorker(snapshot.CreateUpdateContext()); - } - - // We need to notify listeners about every project add. - NotifyListeners(new ProjectChangeEventArgs(snapshot, ProjectChangeKind.Added)); - } - - public override void HostProjectChanged(HostProject hostProject) - { - if (hostProject == null) - { - throw new ArgumentNullException(nameof(hostProject)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - if (_projects.TryGetValue(hostProject.FilePath, out var original)) - { - // Doing an update to the project should keep computed values, but mark the project as dirty if the - // underlying project is newer. - var snapshot = original.WithHostProject(hostProject); - _projects[hostProject.FilePath] = snapshot; - - if (snapshot.IsInitialized && snapshot.IsDirty) - { - // Start computing background state if the project is fully initialized. - NotifyBackgroundWorker(snapshot.CreateUpdateContext()); - } - - // Notify listeners right away because if the HostProject changes then it's likely that the Razor - // configuration changed. - NotifyListeners(new ProjectChangeEventArgs(snapshot, ProjectChangeKind.Changed)); - } - } - - public override void HostProjectRemoved(HostProject hostProject) - { - if (hostProject == null) - { - throw new ArgumentNullException(nameof(hostProject)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - if (_projects.TryGetValue(hostProject.FilePath, out var snapshot)) - { - _projects.Remove(hostProject.FilePath); - - // We need to notify listeners about every project removal. - NotifyListeners(new ProjectChangeEventArgs(snapshot, ProjectChangeKind.Removed)); - } - } - - public override void HostProjectBuildComplete(HostProject hostProject) - { - if (hostProject == null) - { - throw new ArgumentNullException(nameof(hostProject)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - if (_projects.TryGetValue(hostProject.FilePath, out var original)) - { - var workspaceProject = GetWorkspaceProject(hostProject.FilePath); - if (workspaceProject == null) - { - // Host project was built prior to a workspace project being associated. We have nothing to do without - // a workspace project so we short circuit. - return; - } - - // Doing an update to the project should keep computed values, but mark the project as dirty if the - // underlying project is newer. - var snapshot = original.WithWorkspaceProject(workspaceProject); - - _projects[hostProject.FilePath] = snapshot; - - // Notify the background worker so it can trigger tag helper discovery. - NotifyBackgroundWorker(snapshot.CreateUpdateContext()); - } - } - - public override void WorkspaceProjectAdded(Project workspaceProject) - { - if (workspaceProject == null) - { - throw new ArgumentNullException(nameof(workspaceProject)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - if (!IsSupportedWorkspaceProject(workspaceProject)) - { - return; - } - - // The WorkspaceProject initialization never triggers a "Project Add" from out point of view, we - // only care if the new WorkspaceProject matches an existing HostProject. - if (_projects.TryGetValue(workspaceProject.FilePath, out var original)) - { - // If this is a multi-targeting project then we are only interested in a single workspace project. If we already - // found one in the past just ignore this one. - if (original.WorkspaceProject == null) - { - var snapshot = original.WithWorkspaceProject(workspaceProject); - _projects[workspaceProject.FilePath] = snapshot; - - if (snapshot.IsInitialized && snapshot.IsDirty) - { - // We don't need to notify listeners yet because we don't have any **new** computed state. - // - // However we do need to trigger the background work to asynchronously compute the effect of the updates. - NotifyBackgroundWorker(snapshot.CreateUpdateContext()); - } - - // Notify listeners right away since WorkspaceProject was just added, the project is now initialized. - NotifyListeners(new ProjectChangeEventArgs(snapshot, ProjectChangeKind.Changed)); - } - } - } - - public override void WorkspaceProjectChanged(Project workspaceProject) - { - if (workspaceProject == null) - { - throw new ArgumentNullException(nameof(workspaceProject)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - if (!IsSupportedWorkspaceProject(workspaceProject)) - { - return; - } - - // We also need to check the projectId here. If this is a multi-targeting project then we are only interested - // in a single workspace project. Just use the one that showed up first. - if (_projects.TryGetValue(workspaceProject.FilePath, out var original) && - (original.WorkspaceProject == null || - original.WorkspaceProject.Id == workspaceProject.Id)) - { - // Doing an update to the project should keep computed values, but mark the project as dirty if the - // underlying project is newer. - var snapshot = original.WithWorkspaceProject(workspaceProject); - _projects[workspaceProject.FilePath] = snapshot; - - if (snapshot.IsInitialized && snapshot.IsDirty) - { - // We don't need to notify listeners yet because we don't have any **new** computed state. However we do - // need to trigger the background work to asynchronously compute the effect of the updates. - NotifyBackgroundWorker(snapshot.CreateUpdateContext()); - } - - if (snapshot.HaveTagHelpersChanged(original)) - { - NotifyListeners(new ProjectChangeEventArgs(snapshot, ProjectChangeKind.TagHelpersChanged)); - } - } - } - - public override void WorkspaceProjectRemoved(Project workspaceProject) - { - if (workspaceProject == null) - { - throw new ArgumentNullException(nameof(workspaceProject)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - if (!IsSupportedWorkspaceProject(workspaceProject)) - { - return; - } - - if (_projects.TryGetValue(workspaceProject.FilePath, out var original)) - { - // We also need to check the projectId here. If this is a multi-targeting project then we are only interested - // in a single workspace project. Make sure the WorkspaceProject we're using is the one that's being removed. - if (original.WorkspaceProject?.Id != workspaceProject.Id) - { - return; - } - - DefaultProjectSnapshot snapshot; - - // So if the WorkspaceProject got removed, we should double check to make sure that there aren't others - // hanging around. This could happen if a project is multi-targeting and one of the TFMs is removed. - var otherWorkspaceProject = GetWorkspaceProject(workspaceProject.FilePath); - if (otherWorkspaceProject != null && otherWorkspaceProject.Id != workspaceProject.Id) - { - // OK there's another WorkspaceProject, use that. - // - // Doing an update to the project should keep computed values, but mark the project as dirty if the - // underlying project is newer. - snapshot = original.WithWorkspaceProject(otherWorkspaceProject); - _projects[workspaceProject.FilePath] = snapshot; - - if (snapshot.IsInitialized && snapshot.IsDirty) - { - // We don't need to notify listeners yet because we don't have any **new** computed state. However we do - // need to trigger the background work to asynchronously compute the effect of the updates. - NotifyBackgroundWorker(snapshot.CreateUpdateContext()); - } - - // Notify listeners of a change because it's a different WorkspaceProject. - NotifyListeners(new ProjectChangeEventArgs(snapshot, ProjectChangeKind.Changed)); - - return; - } - - snapshot = original.RemoveWorkspaceProject(); - _projects[workspaceProject.FilePath] = snapshot; - - // Notify listeners of a change because we've removed computed state. - NotifyListeners(new ProjectChangeEventArgs(snapshot, ProjectChangeKind.Changed)); - } - } - - public override void ReportError(Exception exception) - { - if (exception == null) - { - throw new ArgumentNullException(nameof(exception)); - } - - _errorReporter.ReportError(exception); - } - - public override void ReportError(Exception exception, ProjectSnapshot project) - { - if (exception == null) - { - throw new ArgumentNullException(nameof(exception)); - } - - _errorReporter.ReportError(exception, project); - } - - public override void ReportError(Exception exception, HostProject hostProject) - { - if (exception == null) - { - throw new ArgumentNullException(nameof(exception)); - } - - var project = hostProject?.FilePath == null ? null : this.GetProjectWithFilePath(hostProject.FilePath); - _errorReporter.ReportError(exception, project); - } - - public override void ReportError(Exception exception, Project workspaceProject) - { - if (exception == null) - { - throw new ArgumentNullException(nameof(exception)); - } - - _errorReporter.ReportError(exception, workspaceProject); - } - - // We're only interested in CSharp projects that have a FilePath. We rely on the FilePath to - // unify the Workspace Project with our HostProject concept. - private bool IsSupportedWorkspaceProject(Project workspaceProject) => workspaceProject.Language == LanguageNames.CSharp && workspaceProject.FilePath != null; - - private Project GetWorkspaceProject(string filePath) - { - var solution = Workspace.CurrentSolution; - if (solution == null) - { - return null; - } - - foreach (var workspaceProject in solution.Projects) - { - if (IsSupportedWorkspaceProject(workspaceProject) && - FilePathComparer.Instance.Equals(filePath, workspaceProject.FilePath)) - { - // We don't try to handle mulitple TFMs anwhere in Razor, just take the first WorkspaceProject that is a match. - return workspaceProject; - } - } - - return null; - } - - // virtual so it can be overridden in tests - protected virtual void NotifyBackgroundWorker(ProjectSnapshotUpdateContext context) - { - _foregroundDispatcher.AssertForegroundThread(); - - _workerQueue.Enqueue(context); - } - - // virtual so it can be overridden in tests - protected virtual void NotifyListeners(ProjectChangeEventArgs e) - { - _foregroundDispatcher.AssertForegroundThread(); - - var handler = Changed; - if (handler != null) - { - handler(this, e); - } - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs deleted file mode 100644 index d82d82cd7c..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotManagerFactory.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - [Shared] - [ExportLanguageServiceFactory(typeof(ProjectSnapshotManager), RazorLanguage.Name)] - internal class DefaultProjectSnapshotManagerFactory : ILanguageServiceFactory - { - private readonly IEnumerable _triggers; - private readonly ForegroundDispatcher _foregroundDispatcher; - - [ImportingConstructor] - public DefaultProjectSnapshotManagerFactory( - ForegroundDispatcher foregroundDispatcher, - [ImportMany] IEnumerable triggers) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (triggers == null) - { - throw new ArgumentNullException(nameof(triggers)); - } - - _foregroundDispatcher = foregroundDispatcher; - _triggers = triggers; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - return new DefaultProjectSnapshotManager( - _foregroundDispatcher, - languageServices.WorkspaceServices.GetRequiredService(), - languageServices.GetRequiredService(), - _triggers, - languageServices.WorkspaceServices.Workspace); - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorker.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorker.cs deleted file mode 100644 index 1b7480f940..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorker.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class DefaultProjectSnapshotWorker : ProjectSnapshotWorker - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly TagHelperResolver _tagHelperResolver; - - public DefaultProjectSnapshotWorker(ForegroundDispatcher foregroundDispatcher, TagHelperResolver tagHelperResolver) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (tagHelperResolver == null) - { - throw new ArgumentNullException(nameof(tagHelperResolver)); - } - - _foregroundDispatcher = foregroundDispatcher; - _tagHelperResolver = tagHelperResolver; - } - - public override Task ProcessUpdateAsync(ProjectSnapshotUpdateContext update, CancellationToken cancellationToken = default(CancellationToken)) - { - if (update == null) - { - throw new ArgumentNullException(nameof(update)); - } - - // Don't block the main thread - if (_foregroundDispatcher.IsForegroundThread) - { - return Task.Factory.StartNew(ProjectUpdatesCoreAsync, update, cancellationToken, TaskCreationOptions.None, _foregroundDispatcher.BackgroundScheduler); - } - - return ProjectUpdatesCoreAsync(update); - } - - protected virtual void OnProcessingUpdate() - { - } - - private async Task ProjectUpdatesCoreAsync(object state) - { - var update = (ProjectSnapshotUpdateContext)state; - - OnProcessingUpdate(); - - var snapshot = new DefaultProjectSnapshot(update.HostProject, update.WorkspaceProject, update.Version); - var result = await _tagHelperResolver.GetTagHelpersAsync(snapshot, CancellationToken.None); - update.TagHelpers = result.Descriptors; - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs deleted file mode 100644 index bd36bf361d..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DefaultProjectSnapshotWorkerFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - [Shared] - [ExportLanguageServiceFactory(typeof(ProjectSnapshotWorker), RazorLanguage.Name)] - internal class DefaultProjectSnapshotWorkerFactory : ILanguageServiceFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - - [ImportingConstructor] - public DefaultProjectSnapshotWorkerFactory(ForegroundDispatcher foregroundDispatcher) - { - if (foregroundDispatcher == null) - { - throw new System.ArgumentNullException(nameof(foregroundDispatcher)); - } - - _foregroundDispatcher = foregroundDispatcher; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - return new DefaultProjectSnapshotWorker(_foregroundDispatcher, languageServices.GetRequiredService()); - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs deleted file mode 100644 index 024b421312..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorConfiguration.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class FallbackRazorConfiguration : RazorConfiguration - { - public static readonly RazorConfiguration MVC_1_0 = new FallbackRazorConfiguration( - RazorLanguageVersion.Version_1_0, - "MVC-1.0", - new[] { new FallbackRazorExtension("MVC-1.0"), }); - - public static readonly RazorConfiguration MVC_1_1 = new FallbackRazorConfiguration( - RazorLanguageVersion.Version_1_1, - "MVC-1.1", - new[] { new FallbackRazorExtension("MVC-1.1"), }); - - public static readonly RazorConfiguration MVC_2_0 = new FallbackRazorConfiguration( - RazorLanguageVersion.Version_2_0, - "MVC-2.0", - new[] { new FallbackRazorExtension("MVC-2.0"), }); - - public static readonly RazorConfiguration MVC_2_1 = new FallbackRazorConfiguration( - RazorLanguageVersion.Version_2_1, - "MVC-2.1", - new[] { new FallbackRazorExtension("MVC-2.1"), }); - - - public static RazorConfiguration SelectConfiguration(Version version) - { - if (version.Major == 1 && version.Minor == 0) - { - return MVC_1_0; - } - else if (version.Major == 1 && version.Minor == 1) - { - return MVC_1_1; - } - else if (version.Major == 2 && version.Minor == 0) - { - return MVC_2_0; - } - else if (version.Major == 2 && version.Minor == 1) - { - return MVC_2_1; - } - else - { - return MVC_2_1; - } - } - - public FallbackRazorConfiguration( - RazorLanguageVersion languageVersion, - string configurationName, - RazorExtension[] extensions) - { - if (languageVersion == null) - { - throw new ArgumentNullException(nameof(languageVersion)); - } - - if (configurationName == null) - { - throw new ArgumentNullException(nameof(configurationName)); - } - - if (extensions == null) - { - throw new ArgumentNullException(nameof(extensions)); - } - - LanguageVersion = languageVersion; - ConfigurationName = configurationName; - Extensions = extensions; - } - - public override string ConfigurationName { get; } - - public override IReadOnlyList Extensions { get; } - - public override RazorLanguageVersion LanguageVersion { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorExtension.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorExtension.cs deleted file mode 100644 index 5080b0705d..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/FallbackRazorExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class FallbackRazorExtension : RazorExtension - { - public FallbackRazorExtension(string extensionName) - { - if (extensionName == null) - { - throw new ArgumentNullException(nameof(extensionName)); - } - - ExtensionName = extensionName; - } - - public override string ExtensionName { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostProject.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostProject.cs deleted file mode 100644 index cf3c1524b6..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/HostProject.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class HostProject - { - public HostProject(string projectFilePath, RazorConfiguration razorConfiguration) - { - if (projectFilePath == null) - { - throw new ArgumentNullException(nameof(projectFilePath)); - } - - if (razorConfiguration == null) - { - throw new ArgumentNullException(nameof(razorConfiguration)); - } - - FilePath = projectFilePath; - Configuration = razorConfiguration; - } - - public RazorConfiguration Configuration { get; } - - public string FilePath { get; } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs deleted file mode 100644 index eca6b56774..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class ProjectChangeEventArgs : EventArgs - { - public ProjectChangeEventArgs(ProjectSnapshot project, ProjectChangeKind kind) - { - Project = project; - Kind = kind; - } - - public ProjectSnapshot Project { get; } - - public ProjectChangeKind Kind { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeKind.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeKind.cs deleted file mode 100644 index c2ff3feacf..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeKind.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal enum ProjectChangeKind - { - Added, - Removed, - Changed, - TagHelpersChanged, - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectExtensibilityAssembly.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectExtensibilityAssembly.cs deleted file mode 100644 index 43839f3664..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectExtensibilityAssembly.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal sealed class ProjectExtensibilityAssembly : IEquatable - { - public ProjectExtensibilityAssembly(AssemblyIdentity identity) - { - if (identity == null) - { - throw new ArgumentNullException(nameof(identity)); - } - - Identity = identity; - } - - public AssemblyIdentity Identity { get; } - - public bool Equals(ProjectExtensibilityAssembly other) - { - if (other == null) - { - return false; - } - - return Identity.Equals(other.Identity); - } - - public override int GetHashCode() - { - return Identity.GetHashCode(); - } - - public override bool Equals(object obj) - { - return base.Equals(obj as ProjectExtensibilityAssembly); - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs deleted file mode 100644 index 538b3cb9fa..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal abstract class ProjectSnapshot - { - public abstract RazorConfiguration Configuration { get; } - - public abstract string FilePath { get; } - - public abstract bool IsInitialized { get; } - - public abstract IReadOnlyList TagHelpers { get; } - - public abstract VersionStamp Version { get; } - - public abstract Project WorkspaceProject { get; } - - public abstract HostProject HostProject { get; } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotChangeTrigger.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotChangeTrigger.cs deleted file mode 100644 index da27aefe0c..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotChangeTrigger.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal abstract class ProjectSnapshotChangeTrigger - { - public abstract void Initialize(ProjectSnapshotManagerBase projectManager); - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs deleted file mode 100644 index b9e39e00b1..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal abstract class ProjectSnapshotManager : ILanguageService - { - public abstract event EventHandler Changed; - - public abstract IReadOnlyList Projects { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerBase.cs deleted file mode 100644 index 026b27956f..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerBase.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal abstract class ProjectSnapshotManagerBase : ProjectSnapshotManager - { - public abstract Workspace Workspace { get; } - - public abstract void ProjectUpdated(ProjectSnapshotUpdateContext update); - - public abstract void HostProjectAdded(HostProject hostProject); - - public abstract void HostProjectChanged(HostProject hostProject); - - public abstract void HostProjectRemoved(HostProject hostProject); - - public abstract void HostProjectBuildComplete(HostProject hostProject); - - public abstract void WorkspaceProjectAdded(Project workspaceProject); - - public abstract void WorkspaceProjectChanged(Project workspaceProject); - - public abstract void WorkspaceProjectRemoved(Project workspaceProject); - - public abstract void ReportError(Exception exception); - - public abstract void ReportError(Exception exception, ProjectSnapshot project); - - public abstract void ReportError(Exception exception, HostProject hostProject); - - public abstract void ReportError(Exception exception, Project workspaceProject); - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerExtensions.cs deleted file mode 100644 index d6299717ca..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManagerExtensions.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal static class ProjectSnapshotManagerExtensions - { - public static ProjectSnapshot GetProjectWithFilePath(this ProjectSnapshotManager snapshotManager, string filePath) - { - var projects = snapshotManager.Projects; - for (var i = 0; i< projects.Count; i++) - { - var project = projects[i]; - if (FilePathComparer.Instance.Equals(filePath, project.FilePath)) - { - return project; - } - } - - return null; - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotUpdateContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotUpdateContext.cs deleted file mode 100644 index cddb3b08c1..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotUpdateContext.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class ProjectSnapshotUpdateContext - { - public ProjectSnapshotUpdateContext(string filePath, HostProject hostProject, Project workspaceProject, VersionStamp version) - { - if (filePath == null) - { - throw new ArgumentNullException(nameof(filePath)); - } - - if (hostProject == null) - { - throw new ArgumentNullException(nameof(hostProject)); - } - - if (workspaceProject == null) - { - throw new ArgumentNullException(nameof(workspaceProject)); - } - - FilePath = filePath; - HostProject = hostProject; - WorkspaceProject = workspaceProject; - Version = version; - } - - public string FilePath { get; } - - public HostProject HostProject { get; } - - public Project WorkspaceProject { get; } - - public IReadOnlyList TagHelpers { get; set; } - - public VersionStamp Version { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotWorker.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotWorker.cs deleted file mode 100644 index 5c6288ee22..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotWorker.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal abstract class ProjectSnapshotWorker : ILanguageService - { - public abstract Task ProcessUpdateAsync(ProjectSnapshotUpdateContext update, CancellationToken cancellationToken = default(CancellationToken)); - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotWorkerQueue.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotWorkerQueue.cs deleted file mode 100644 index 69c0062f05..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotWorkerQueue.cs +++ /dev/null @@ -1,203 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class ProjectSnapshotWorkerQueue - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly DefaultProjectSnapshotManager _projectManager; - private readonly ProjectSnapshotWorker _projectWorker; - - private readonly Dictionary _projects; - private Timer _timer; - - public ProjectSnapshotWorkerQueue(ForegroundDispatcher foregroundDispatcher, DefaultProjectSnapshotManager projectManager, ProjectSnapshotWorker projectWorker) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (projectManager == null) - { - throw new ArgumentNullException(nameof(projectManager)); - } - - if (projectWorker == null) - { - throw new ArgumentNullException(nameof(projectWorker)); - } - - _foregroundDispatcher = foregroundDispatcher; - _projectManager = projectManager; - _projectWorker = projectWorker; - - _projects = new Dictionary(FilePathComparer.Instance); - } - - public bool HasPendingNotifications - { - get - { - lock (_projects) - { - return _projects.Count > 0; - } - } - } - - // Used in unit tests to control the timer delay. - public TimeSpan Delay { get; set; } = TimeSpan.FromSeconds(2); - - public bool IsScheduledOrRunning => _timer != null; - - // Used in unit tests to ensure we can control when background work starts. - public ManualResetEventSlim BlockBackgroundWorkStart { get; set; } - - // Used in unit tests to ensure we can know when background work finishes. - public ManualResetEventSlim NotifyBackgroundWorkFinish { get; set; } - - // Used in unit tests to ensure we can be notified when all completes. - public ManualResetEventSlim NotifyForegroundWorkFinish { get; set; } - - private void OnStartingBackgroundWork() - { - if (BlockBackgroundWorkStart != null) - { - BlockBackgroundWorkStart.Wait(); - BlockBackgroundWorkStart.Reset(); - } - } - - private void OnFinishingBackgroundWork() - { - if (NotifyBackgroundWorkFinish != null) - { - NotifyBackgroundWorkFinish.Set(); - } - } - - private void OnFinishingForegroundWork() - { - if (NotifyForegroundWorkFinish != null) - { - NotifyForegroundWorkFinish.Set(); - } - } - - public void Enqueue(ProjectSnapshotUpdateContext context) - { - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - lock (_projects) - { - // We only want to store the last 'seen' version of any given project. That way when we pick one to process - // it's always the best version to use. - _projects[context.FilePath] = context; - - StartWorker(); - } - } - - protected virtual void StartWorker() - { - // Access to the timer is protected by the lock in Enqueue and in Timer_Tick - if (_timer == null) - { - // Timer will fire after a fixed delay, but only once. - _timer = new Timer(Timer_Tick, null, Delay, Timeout.InfiniteTimeSpan); - } - } - - private async void Timer_Tick(object state) // Yeah I know. - { - try - { - _foregroundDispatcher.AssertBackgroundThread(); - - // Timer is stopped. - _timer.Change(Timeout.Infinite, Timeout.Infinite); - - OnStartingBackgroundWork(); - - ProjectSnapshotUpdateContext[] work; - lock (_projects) - { - work = _projects.Values.ToArray(); - _projects.Clear(); - } - - var updates = new(ProjectSnapshotUpdateContext context, Exception exception)[work.Length]; - for (var i = 0; i < work.Length; i++) - { - try - { - updates[i] = (work[i], null); - await _projectWorker.ProcessUpdateAsync(updates[i].context); - } - catch (Exception projectException) - { - updates[i] = (updates[i].context, projectException); - } - } - - OnFinishingBackgroundWork(); - - // We need to get back to the UI thread to update the project system. - await Task.Factory.StartNew(PersistUpdates, updates, CancellationToken.None, TaskCreationOptions.None, _foregroundDispatcher.ForegroundScheduler); - - lock (_projects) - { - // Resetting the timer allows another batch of work to start. - _timer.Dispose(); - _timer = null; - - // If more work came in while we were running start the worker again. - if (_projects.Count > 0) - { - StartWorker(); - } - } - - OnFinishingForegroundWork(); - } - catch (Exception ex) - { - // This is something totally unexpected, let's just send it over to the workspace. - await Task.Factory.StartNew(() => _projectManager.ReportError(ex), CancellationToken.None, TaskCreationOptions.None, _foregroundDispatcher.ForegroundScheduler); - } - } - - private void PersistUpdates(object state) - { - _foregroundDispatcher.AssertForegroundThread(); - - var updates = ((ProjectSnapshotUpdateContext context, Exception exception)[])state; - - for (var i = 0; i < updates.Length; i++) - { - var update = updates[i]; - if (update.exception == null) - { - _projectManager.ProjectUpdated(update.context); - } - else - { - _projectManager.ReportError(update.exception, update.context?.WorkspaceProject); - } - } - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorConfiguration.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorConfiguration.cs deleted file mode 100644 index 43dfebe864..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorConfiguration.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class ProjectSystemRazorConfiguration : RazorConfiguration - { - public ProjectSystemRazorConfiguration( - RazorLanguageVersion languageVersion, - string configurationName, - RazorExtension[] extensions) - { - if (languageVersion == null) - { - throw new ArgumentNullException(nameof(languageVersion)); - } - - if (configurationName == null) - { - throw new ArgumentNullException(nameof(configurationName)); - } - - if (extensions == null) - { - throw new ArgumentNullException(nameof(extensions)); - } - - LanguageVersion = languageVersion; - ConfigurationName = configurationName; - Extensions = extensions; - } - - public override string ConfigurationName { get; } - - public override IReadOnlyList Extensions { get; } - - public override RazorLanguageVersion LanguageVersion { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorExtension.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorExtension.cs deleted file mode 100644 index 77f742c563..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSystemRazorExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class ProjectSystemRazorExtension : RazorExtension - { - public ProjectSystemRazorExtension(string extensionName) - { - if (extensionName == null) - { - throw new ArgumentNullException(nameof(extensionName)); - } - - ExtensionName = extensionName; - } - - public override string ExtensionName { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/WorkspaceProjectSnapshotChangeTrigger.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/WorkspaceProjectSnapshotChangeTrigger.cs deleted file mode 100644 index fb2deeec32..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/WorkspaceProjectSnapshotChangeTrigger.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using System.Diagnostics; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - [Export(typeof(ProjectSnapshotChangeTrigger))] - internal class WorkspaceProjectSnapshotChangeTrigger : ProjectSnapshotChangeTrigger - { - private ProjectSnapshotManagerBase _projectManager; - - public override void Initialize(ProjectSnapshotManagerBase projectManager) - { - _projectManager = projectManager; - _projectManager.Workspace.WorkspaceChanged += Workspace_WorkspaceChanged; - - InitializeSolution(_projectManager.Workspace.CurrentSolution); - } - - private void InitializeSolution(Solution solution) - { - Debug.Assert(solution != null); - - foreach (var project in solution.Projects) - { - _projectManager.WorkspaceProjectAdded(project); - } - } - - // Internal for testing - internal void Workspace_WorkspaceChanged(object sender, WorkspaceChangeEventArgs e) - { - Project project; - switch (e.Kind) - { - case WorkspaceChangeKind.ProjectAdded: - { - project = e.NewSolution.GetProject(e.ProjectId); - Debug.Assert(project != null); - - _projectManager.WorkspaceProjectAdded(project); - break; - } - - case WorkspaceChangeKind.ProjectChanged: - case WorkspaceChangeKind.ProjectReloaded: - { - project = e.NewSolution.GetProject(e.ProjectId); - Debug.Assert(project != null); - - _projectManager.WorkspaceProjectChanged(project); - break; - } - - case WorkspaceChangeKind.ProjectRemoved: - { - project = e.OldSolution.GetProject(e.ProjectId); - Debug.Assert(project != null); - - _projectManager.WorkspaceProjectRemoved(project); - break; - } - - case WorkspaceChangeKind.SolutionAdded: - case WorkspaceChangeKind.SolutionChanged: - case WorkspaceChangeKind.SolutionCleared: - case WorkspaceChangeKind.SolutionReloaded: - case WorkspaceChangeKind.SolutionRemoved: - - if (e.OldSolution != null) - { - foreach (var p in e.OldSolution.Projects) - { - _projectManager.WorkspaceProjectRemoved(p); - } - } - - InitializeSolution(e.NewSolution); - break; - } - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs deleted file mode 100644 index e70ec9920f..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Microsoft.AspNetCore.Razor.Performance, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.RazorAddin, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test.Common, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/Resources.Designer.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/Resources.Designer.cs deleted file mode 100644 index 058b78c6ed..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Properties/Resources.Designer.cs +++ /dev/null @@ -1,86 +0,0 @@ -// -namespace Microsoft.CodeAnalysis.Razor.Workspaces -{ - using System.Globalization; - using System.Reflection; - using System.Resources; - - internal static class Resources - { - private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.CodeAnalysis.Razor.Workspaces.Resources", typeof(Resources).GetTypeInfo().Assembly); - - /// - /// Value cannot be null or an empty string. - /// - internal static string ArgumentCannotBeNullOrEmpty - { - get => GetString("ArgumentCannotBeNullOrEmpty"); - } - - /// - /// Value cannot be null or an empty string. - /// - internal static string FormatArgumentCannotBeNullOrEmpty() - => GetString("ArgumentCannotBeNullOrEmpty"); - - /// - /// {0} must be called on a background thread. - /// - internal static string ForegroundDispatcher_AssertBackgroundThread - { - get => GetString("ForegroundDispatcher_AssertBackgroundThread"); - } - - /// - /// {0} must be called on a background thread. - /// - internal static string FormatForegroundDispatcher_AssertBackgroundThread(object p0) - => string.Format(CultureInfo.CurrentCulture, GetString("ForegroundDispatcher_AssertBackgroundThread"), p0); - - /// - /// {0} must be called on the foreground thread. - /// - internal static string ForegroundDispatcher_AssertForegroundThread - { - get => GetString("ForegroundDispatcher_AssertForegroundThread"); - } - - /// - /// {0} must be called on the foreground thread. - /// - internal static string FormatForegroundDispatcher_AssertForegroundThread(object p0) - => string.Format(CultureInfo.CurrentCulture, GetString("ForegroundDispatcher_AssertForegroundThread"), p0); - - /// - /// The method - /// - internal static string ForegroundDispatcher_NoMethodNamePlaceholder - { - get => GetString("ForegroundDispatcher_NoMethodNamePlaceholder"); - } - - /// - /// The method - /// - internal static string FormatForegroundDispatcher_NoMethodNamePlaceholder() - => GetString("ForegroundDispatcher_NoMethodNamePlaceholder"); - - private static string GetString(string name, params string[] formatterNames) - { - var value = _resourceManager.GetString(name); - - System.Diagnostics.Debug.Assert(value != null); - - if (formatterNames != null) - { - for (var i = 0; i < formatterNames.Length; i++) - { - value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); - } - } - - return value; - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorProjectEngineFactoryService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorProjectEngineFactoryService.cs deleted file mode 100644 index 4defb21947..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/RazorProjectEngineFactoryService.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.CodeAnalysis.Razor -{ - internal abstract class RazorProjectEngineFactoryService : ILanguageService - { - public abstract IProjectEngineFactory FindFactory(ProjectSnapshot project); - - public abstract IProjectEngineFactory FindSerializableFactory(ProjectSnapshot project); - - public abstract RazorProjectEngine Create(ProjectSnapshot project, Action configure); - - public abstract RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure); - - public abstract RazorProjectEngine Create(string directoryPath, Action configure); - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources.resx b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources.resx deleted file mode 100644 index fca5a30e15..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Value cannot be null or an empty string. - - - {0} must be called on a background thread. - - - {0} must be called on the foreground thread. - - - The method - - \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs deleted file mode 100644 index 0e8c7b19ef..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolutionResult.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor -{ - public sealed class TagHelperResolutionResult - { - internal static TagHelperResolutionResult Empty = new TagHelperResolutionResult(Array.Empty(), Array.Empty()); - - public TagHelperResolutionResult(IReadOnlyList descriptors, IReadOnlyList diagnostics) - { - Descriptors = descriptors; - Diagnostics = diagnostics; - } - - public IReadOnlyList Descriptors { get; } - - public IReadOnlyList Diagnostics { get; } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolver.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolver.cs deleted file mode 100644 index 847e22a674..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/TagHelperResolver.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.CodeAnalysis.Razor -{ - internal abstract class TagHelperResolver : ILanguageService - { - public abstract Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default); - - protected virtual async Task GetTagHelpersAsync(ProjectSnapshot project, RazorProjectEngine engine) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (engine == null) - { - throw new ArgumentNullException(nameof(engine)); - } - - if (project.WorkspaceProject == null) - { - return TagHelperResolutionResult.Empty; - } - - var providers = engine.Engine.Features.OfType().ToArray(); - if (providers.Length == 0) - { - return TagHelperResolutionResult.Empty; - } - - var results = new List(); - var context = TagHelperDescriptorProviderContext.Create(results); - context.ExcludeHidden = true; - context.IncludeDocumentation = true; - - var compilation = await project.WorkspaceProject.GetCompilationAsync().ConfigureAwait(false); - context.SetCompilation(compilation); - - for (var i = 0; i < providers.Length; i++) - { - var provider = providers[i]; - provider.Execute(context); - } - - return new TagHelperResolutionResult(results, Array.Empty()); - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs index a43f1d9aa4..2a41d968e3 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor/Properties/AssemblyInfo.cs @@ -5,9 +5,4 @@ using System.Runtime.CompilerServices; [assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("Microsoft.AspNetCore.Mvc.Razor.Extensions.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GeneratedDocument.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GeneratedDocument.cs deleted file mode 100644 index 8299fce595..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GeneratedDocument.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Remote.Razor -{ - internal class GeneratedDocument - { - public string Text { get; set; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj deleted file mode 100644 index 369dd82020..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Microsoft.CodeAnalysis.Remote.Razor.csproj +++ /dev/null @@ -1,28 +0,0 @@ - - - - Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure. - net46 - false - - - - - Serialization\%(FileName)%(Extension) - - - - - - - - - - - - - - - - - diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Properties/AssemblyInfo.cs deleted file mode 100644 index fd7f2d2f87..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Remote.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorLanguageService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorLanguageService.cs deleted file mode 100644 index ecde04c752..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorLanguageService.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.CodeAnalysis.Remote.Razor -{ - internal class RazorLanguageService : RazorServiceBase - { - public RazorLanguageService(Stream stream, IServiceProvider serviceProvider) - : base(stream, serviceProvider) - { - } - - public async Task GetTagHelpersAsync(ProjectSnapshotHandle projectHandle, string factoryTypeName, CancellationToken cancellationToken = default) - { - var project = await GetProjectSnapshotAsync(projectHandle, cancellationToken).ConfigureAwait(false); - - return await RazorServices.TagHelperResolver.GetTagHelpersAsync(project, factoryTypeName, cancellationToken); - } - - public Task> GetDirectivesAsync(Guid projectIdBytes, string projectDebugName, CancellationToken cancellationToken = default(CancellationToken)) - { - var projectId = ProjectId.CreateFromSerialized(projectIdBytes, projectDebugName); - - var projectEngine = RazorProjectEngine.Create(); - var directives = projectEngine.EngineFeatures.OfType().FirstOrDefault()?.Directives; - return Task.FromResult(directives ?? Enumerable.Empty()); - } - - public Task GenerateDocumentAsync(Guid projectIdBytes, string projectDebugName, string filePath, string text, CancellationToken cancellationToken = default(CancellationToken)) - { - var projectId = ProjectId.CreateFromSerialized(projectIdBytes, projectDebugName); - - var projectEngine = RazorProjectEngine.Create(); - - RazorSourceDocument source; - using (var stream = new MemoryStream()) - { - var bytes = Encoding.UTF8.GetBytes(text); - stream.Write(bytes, 0, bytes.Length); - - stream.Seek(0L, SeekOrigin.Begin); - source = RazorSourceDocument.ReadFrom(stream, filePath, Encoding.UTF8); - } - - var code = RazorCodeDocument.Create(source); - projectEngine.Engine.Process(code); - - var csharp = code.GetCSharpDocument(); - if (csharp == null) - { - throw new InvalidOperationException(); - } - - return Task.FromResult(new GeneratedDocument() { Text = csharp.GeneratedCode, }); - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs deleted file mode 100644 index 8fdbdd81da..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServiceBase.cs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.CodeAnalysis.Remote.Razor -{ - internal abstract class RazorServiceBase : ServiceHubServiceBase - { - public RazorServiceBase(Stream stream, IServiceProvider serviceProvider) - : base(serviceProvider, stream) - { - RazorServices = new RazorServices(); - - Rpc.JsonSerializer.Converters.RegisterRazorConverters(); - - // Due to this issue - https://github.com/dotnet/roslyn/issues/16900#issuecomment-277378950 - // We need to manually start the RPC connection. Otherwise we'd be opting ourselves into - // race condition prone call paths. - Rpc.StartListening(); - } - - protected RazorServices RazorServices { get; } - - protected virtual async Task GetProjectSnapshotAsync(ProjectSnapshotHandle projectHandle, CancellationToken cancellationToken) - { - if (projectHandle == null) - { - throw new ArgumentNullException(nameof(projectHandle)); - } - - var solution = await GetSolutionAsync(cancellationToken).ConfigureAwait(false); - var workspaceProject = solution.GetProject(projectHandle.WorkspaceProjectId); - - return new SerializedProjectSnapshot(projectHandle.FilePath, projectHandle.Configuration, workspaceProject); - } - - private class SerializedProjectSnapshot : ProjectSnapshot - { - public SerializedProjectSnapshot(string filePath, RazorConfiguration configuration, Project workspaceProject) - { - FilePath = filePath; - Configuration = configuration; - HostProject = new HostProject(filePath, configuration); - WorkspaceProject = workspaceProject; - TagHelpers = Array.Empty(); - - IsInitialized = true; - Version = VersionStamp.Default; - } - - public override RazorConfiguration Configuration { get; } - - public override string FilePath { get; } - - public override bool IsInitialized { get; } - - public override VersionStamp Version { get; } - - public override Project WorkspaceProject { get; } - - public override HostProject HostProject { get; } - - public override IReadOnlyList TagHelpers { get; } - } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServices.cs deleted file mode 100644 index d3a60a400c..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorServices.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Razor -{ - // Provides access to Razor language and workspace services that are avialable in the OOP host. - // - // Since we don't have access to the workspace we only have access to some specific things - // that we can construct directly. - internal class RazorServices - { - public RazorServices() - { - FallbackProjectEngineFactory = new FallbackProjectEngineFactory(); - TagHelperResolver = new RemoteTagHelperResolver(FallbackProjectEngineFactory); - } - - public IFallbackProjectEngineFactory FallbackProjectEngineFactory { get; } - - public RemoteTagHelperResolver TagHelperResolver { get; } - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteTagHelperResolver.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteTagHelperResolver.cs deleted file mode 100644 index f4ccaf7755..0000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteTagHelperResolver.cs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.CodeAnalysis.Razor -{ - internal class RemoteTagHelperResolver : TagHelperResolver - { - private readonly static RazorConfiguration DefaultConfiguration = FallbackRazorConfiguration.MVC_2_0; - - private readonly IFallbackProjectEngineFactory _fallbackFactory; - - public RemoteTagHelperResolver(IFallbackProjectEngineFactory fallbackFactory) - { - if (fallbackFactory == null) - { - throw new ArgumentNullException(nameof(fallbackFactory)); - } - - _fallbackFactory = fallbackFactory; - } - - public override Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default) - { - throw new NotImplementedException(); - } - - public Task GetTagHelpersAsync(ProjectSnapshot project, string factoryTypeName, CancellationToken cancellationToken = default) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (project.Configuration == null || project.WorkspaceProject == null) - { - return Task.FromResult(TagHelperResolutionResult.Empty); - } - - var engine = CreateProjectEngine(project, factoryTypeName); - return GetTagHelpersAsync(project, engine); - } - - internal RazorProjectEngine CreateProjectEngine(ProjectSnapshot project, string factoryTypeName) - { - // This section is really similar to the code DefaultProjectEngineFactoryService - // but with a few differences that are significant in the remote scenario - // - // Most notably, we are going to find the Tag Helpers using a compilation, and we have - // no editor settings. - // - // The default configuration currently matches MVC-2.0. Beyond MVC-2.0 we added SDK support for - // properly detecting project versions, so that's a good version to assume when we can't find a - // configuration. - var configuration = project?.Configuration ?? DefaultConfiguration; - - // If there's no factory to handle the configuration then fall back to a very basic configuration. - // - // This will stop a crash from happening in this case (misconfigured project), but will still make - // it obvious to the user that something is wrong. - var factory = CreateFactory(configuration, factoryTypeName) ?? _fallbackFactory; - return factory.Create(configuration, RazorProjectFileSystem.Empty, b => { }); - } - - private IProjectEngineFactory CreateFactory(RazorConfiguration configuration, string factoryTypeName) - { - if (factoryTypeName == null) - { - return null; - } - - return (IProjectEngineFactory)Activator.CreateInstance(Type.GetType(factoryTypeName, throwOnError: true)); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AcceptedCharacters.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AcceptedCharacters.cs deleted file mode 100644 index 1d9ba282e9..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AcceptedCharacters.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [Flags] - public enum AcceptedCharacters - { - None = 0, - NewLine = 1, - WhiteSpace = 2, - - NonWhiteSpace = 4, - - AllWhiteSpace = NewLine | WhiteSpace, - Any = AllWhiteSpace | NonWhiteSpace, - - AnyExceptNewline = NonWhiteSpace | WhiteSpace - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionContext.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionContext.cs deleted file mode 100644 index 08b4ffe032..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionContext.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class AttributeCompletionContext - { - public AttributeCompletionContext( - TagHelperDocumentContext documentContext, - IEnumerable existingCompletions, - string currentTagName, - string currentAttributeName, - IEnumerable> attributes, - string currentParentTagName, - bool currentParentIsTagHelper, - Func inHTMLSchema) - { - if (documentContext == null) - { - throw new ArgumentNullException(nameof(documentContext)); - } - - if (existingCompletions == null) - { - throw new ArgumentNullException(nameof(existingCompletions)); - } - - if (currentTagName == null) - { - throw new ArgumentNullException(nameof(currentTagName)); - } - - if (attributes == null) - { - throw new ArgumentNullException(nameof(attributes)); - } - - if (inHTMLSchema == null) - { - throw new ArgumentNullException(nameof(inHTMLSchema)); - } - - DocumentContext = documentContext; - ExistingCompletions = existingCompletions; - CurrentTagName = currentTagName; - CurrentAttributeName = currentAttributeName; - Attributes = attributes; - CurrentParentTagName = currentParentTagName; - CurrentParentIsTagHelper = currentParentIsTagHelper; - InHTMLSchema = inHTMLSchema; - } - - public TagHelperDocumentContext DocumentContext { get; } - - public IEnumerable ExistingCompletions { get; } - - public string CurrentTagName { get; } - - public string CurrentAttributeName { get; } - - public IEnumerable> Attributes { get; } - - public string CurrentParentTagName { get; } - - public bool CurrentParentIsTagHelper { get; } - - public Func InHTMLSchema { get; } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionResult.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionResult.cs deleted file mode 100644 index c6a11d67ed..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/AttributeCompletionResult.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class AttributeCompletionResult - { - private AttributeCompletionResult() - { - } - - public abstract IReadOnlyDictionary> Completions { get; } - - internal static AttributeCompletionResult Create(Dictionary> completions) - { - var readonlyCompletions = completions.ToDictionary( - key => key.Key, - value => (IEnumerable)value.Value, - completions.Comparer); - var result = new DefaultAttributeCompletionResult(readonlyCompletions); - - return result; - } - - private class DefaultAttributeCompletionResult : AttributeCompletionResult - { - private readonly IReadOnlyDictionary> _completions; - - public DefaultAttributeCompletionResult(IReadOnlyDictionary> completions) - { - _completions = completions; - } - - public override IReadOnlyDictionary> Completions => _completions; - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParser.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParser.cs deleted file mode 100644 index 9a7cabb8e1..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BackgroundParser.cs +++ /dev/null @@ -1,405 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using System.Text; -using System.Threading; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class BackgroundParser : IDisposable - { - private MainThreadState _main; - private BackgroundThread _bg; - - public BackgroundParser(RazorProjectEngine projectEngine, string filePath, string projectDirectory) - { - _main = new MainThreadState(filePath); - _bg = new BackgroundThread(_main, projectEngine, filePath, projectDirectory); - - _main.ResultsReady += (sender, args) => OnResultsReady(args); - } - - /// - /// Fired on the main thread. - /// - public event EventHandler ResultsReady; - - public bool IsIdle - { - get { return _main.IsIdle; } - } - - public void Start() - { - _bg.Start(); - } - - public void Cancel() - { - _main.Cancel(); - } - - public void QueueChange(SourceChange change, ITextSnapshot snapshot) - { - var edit = new Edit(change, snapshot); - _main.QueueChange(edit); - } - - public void Dispose() - { - _main.Cancel(); - } - - public IDisposable SynchronizeMainThreadState() - { - return _main.Lock(); - } - - protected virtual void OnResultsReady(DocumentStructureChangedEventArgs args) - { - using (SynchronizeMainThreadState()) - { - ResultsReady?.Invoke(this, args); - } - } - - private abstract class ThreadStateBase - { -#if DEBUG - private int _id = -1; -#endif - protected ThreadStateBase() - { - } - - [Conditional("DEBUG")] - protected void SetThreadId(int id) - { -#if DEBUG - _id = id; -#endif - } - - [Conditional("DEBUG")] - protected void EnsureOnThread() - { -#if DEBUG - Debug.Assert(_id != -1, "SetThreadId was never called!"); - Debug.Assert(Thread.CurrentThread.ManagedThreadId == _id, "Called from an unexpected thread!"); -#endif - } - - [Conditional("DEBUG")] - protected void EnsureNotOnThread() - { -#if DEBUG - Debug.Assert(_id != -1, "SetThreadId was never called!"); - Debug.Assert(Thread.CurrentThread.ManagedThreadId != _id, "Called from an unexpected thread!"); -#endif - } - } - - private class MainThreadState : ThreadStateBase, IDisposable - { - private readonly CancellationTokenSource _cancelSource = new CancellationTokenSource(); - private readonly ManualResetEventSlim _hasParcel = new ManualResetEventSlim(false); - private CancellationTokenSource _currentParcelCancelSource; - - private string _fileName; - private readonly object _stateLock = new object(); - private IList _changes = new List(); - - public MainThreadState(string fileName) - { - _fileName = fileName; - - SetThreadId(Thread.CurrentThread.ManagedThreadId); - } - - public event EventHandler ResultsReady; - - public CancellationToken CancelToken - { - get { return _cancelSource.Token; } - } - - public bool IsIdle - { - get - { - lock (_stateLock) - { - return _currentParcelCancelSource == null; - } - } - } - - public void Cancel() - { - EnsureOnThread(); - _cancelSource.Cancel(); - } - - public IDisposable Lock() - { - Monitor.Enter(_stateLock); - return new DisposableAction(() => Monitor.Exit(_stateLock)); - } - - public void QueueChange(Edit edit) - { - // Any thread can queue a change. - - lock (_stateLock) - { - // CurrentParcel token source is not null ==> There's a parse underway - if (_currentParcelCancelSource != null) - { - _currentParcelCancelSource.Cancel(); - } - - _changes.Add(edit); - _hasParcel.Set(); - } - } - - public WorkParcel GetParcel() - { - EnsureNotOnThread(); // Only the background thread can get a parcel - _hasParcel.Wait(_cancelSource.Token); - _hasParcel.Reset(); - lock (_stateLock) - { - // Create a cancellation source for this parcel - _currentParcelCancelSource = new CancellationTokenSource(); - - var changes = _changes; - _changes = new List(); - return new WorkParcel(changes, _currentParcelCancelSource.Token); - } - } - - public void ReturnParcel(DocumentStructureChangedEventArgs args) - { - lock (_stateLock) - { - // Clear the current parcel cancellation source - if (_currentParcelCancelSource != null) - { - _currentParcelCancelSource.Dispose(); - _currentParcelCancelSource = null; - } - - // If there are things waiting to be parsed, just don't fire the event because we're already out of date - if (_changes.Any()) - { - return; - } - } - var handler = ResultsReady; - if (handler != null) - { - handler(this, args); - } - } - - public void Dispose() - { - Dispose(true); - GC.SuppressFinalize(this); - } - - protected virtual void Dispose(bool disposing) - { - if (disposing) - { - if (_currentParcelCancelSource != null) - { - _currentParcelCancelSource.Dispose(); - _currentParcelCancelSource = null; - } - _cancelSource.Dispose(); - _hasParcel.Dispose(); - } - } - } - - private class BackgroundThread : ThreadStateBase - { - private readonly string _filePath; - private readonly string _relativeFilePath; - private readonly string _projectDirectory; - private MainThreadState _main; - private Thread _backgroundThread; - private CancellationToken _shutdownToken; - private RazorProjectEngine _projectEngine; - private RazorSyntaxTree _currentSyntaxTree; - private IList _previouslyDiscarded = new List(); - - public BackgroundThread(MainThreadState main, RazorProjectEngine projectEngine, string filePath, string projectDirectory) - { - // Run on MAIN thread! - _main = main; - _shutdownToken = _main.CancelToken; - _projectEngine = projectEngine; - _filePath = filePath; - _relativeFilePath = GetNormalizedRelativeFilePath(filePath, projectDirectory); - _projectDirectory = projectDirectory; - _backgroundThread = new Thread(WorkerLoop); - SetThreadId(_backgroundThread.ManagedThreadId); - } - - // **** ANY THREAD **** - public void Start() - { - _backgroundThread.Start(); - } - - // **** BACKGROUND THREAD **** - private void WorkerLoop() - { - try - { - EnsureOnThread(); - - while (!_shutdownToken.IsCancellationRequested) - { - // Grab the parcel of work to do - var parcel = _main.GetParcel(); - if (parcel.Edits.Any()) - { - try - { - DocumentStructureChangedEventArgs args = null; - using (var linkedCancel = CancellationTokenSource.CreateLinkedTokenSource(_shutdownToken, parcel.CancelToken)) - { - if (!linkedCancel.IsCancellationRequested) - { - // Collect ALL changes - List allEdits; - - if (_previouslyDiscarded != null) - { - allEdits = Enumerable.Concat(_previouslyDiscarded, parcel.Edits).ToList(); - } - else - { - allEdits = parcel.Edits.ToList(); - } - - var finalEdit = allEdits.Last(); - - var results = ParseChange(finalEdit.Snapshot, linkedCancel.Token); - - if (results != null && !linkedCancel.IsCancellationRequested) - { - // Clear discarded changes list - _previouslyDiscarded = null; - - _currentSyntaxTree = results.GetSyntaxTree(); - - // Build Arguments - args = new DocumentStructureChangedEventArgs( - finalEdit.Change, - finalEdit.Snapshot, - results); - } - else - { - // Parse completed but we were cancelled in the mean time. Add these to the discarded changes set - _previouslyDiscarded = allEdits; - } - } - } - if (args != null) - { - _main.ReturnParcel(args); - } - } - catch (OperationCanceledException) - { - } - } - else - { - Thread.Yield(); - } - } - } - catch (OperationCanceledException) - { - // Do nothing. Just shut down. - } - finally - { - // Clean up main thread resources - _main.Dispose(); - } - } - - private RazorCodeDocument ParseChange(ITextSnapshot snapshot, CancellationToken token) - { - EnsureOnThread(); - - var projectItem = new TextSnapshotProjectItem(snapshot, _projectDirectory, _relativeFilePath, _filePath); - var codeDocument = _projectEngine.ProcessDesignTime(projectItem); - - return codeDocument; - } - - private string GetNormalizedRelativeFilePath(string filePath, string projectDirectory) - { - if (filePath.StartsWith(projectDirectory, StringComparison.OrdinalIgnoreCase)) - { - filePath = filePath.Substring(projectDirectory.Length); - } - - if (filePath.Length > 1) - { - filePath = filePath.Replace('\\', '/'); - - if (filePath[0] != '/') - { - filePath = "/" + filePath; - } - } - - return filePath; - } - } - - private class WorkParcel - { - public WorkParcel(IList changes, CancellationToken cancelToken) - { - Edits = changes; - CancelToken = cancelToken; - } - - public CancellationToken CancelToken { get; } - - public IList Edits { get; } - } - - private class Edit - { - public Edit(SourceChange change, ITextSnapshot snapshot) - { - Change = change; - Snapshot = snapshot; - } - - public SourceChange Change { get; } - - public ITextSnapshot Snapshot { get; set; } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BlockKind.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BlockKind.cs deleted file mode 100644 index 2559231329..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BlockKind.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public enum BlockKind - { - // Code - Statement, - Directive, - Functions, - Expression, - Helper, - - // Markup - Markup, - Section, - Template, - - // Special - Comment, - Tag, - - HtmlComment - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs deleted file mode 100644 index ff9c69c4e2..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenter.cs +++ /dev/null @@ -1,259 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.Text; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.Text.Operations; -using ITextBuffer = Microsoft.VisualStudio.Text.ITextBuffer; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - /// - /// This class is responsible for handling situations where Roslyn and the HTML editor cannot auto-indent Razor code. - /// - /// - /// Attempting to insert a newline (pipe indicates the cursor): - /// @{ |} - /// Should result in the text buffer looking like the following: - /// @{ - /// | - /// } - /// This is also true for directive block scenarios. - /// - internal class BraceSmartIndenter : IDisposable - { - private readonly ForegroundDispatcher _dispatcher; - private readonly ITextBuffer _textBuffer; - private readonly VisualStudioDocumentTracker _documentTracker; - private readonly IEditorOperationsFactoryService _editorOperationsFactory; - private readonly StringBuilder _indentBuilder = new StringBuilder(); - private BraceIndentationContext _context; - - // Internal for testing - internal BraceSmartIndenter() - { - } - - public BraceSmartIndenter( - ForegroundDispatcher dispatcher, - VisualStudioDocumentTracker documentTracker, - IEditorOperationsFactoryService editorOperationsFactory) - { - if (dispatcher == null) - { - throw new ArgumentNullException(nameof(dispatcher)); - } - - if (documentTracker == null) - { - throw new ArgumentNullException(nameof(documentTracker)); - } - - if (editorOperationsFactory == null) - { - throw new ArgumentNullException(nameof(editorOperationsFactory)); - } - - _dispatcher = dispatcher; - _documentTracker = documentTracker; - _editorOperationsFactory = editorOperationsFactory; - _textBuffer = _documentTracker.TextBuffer; - _textBuffer.Changed += TextBuffer_OnChanged; - _textBuffer.PostChanged += TextBuffer_OnPostChanged; - } - - public void Dispose() - { - _dispatcher.AssertForegroundThread(); - - _textBuffer.Changed -= TextBuffer_OnChanged; - _textBuffer.PostChanged -= TextBuffer_OnPostChanged; - } - - // Internal for testing - internal void TriggerSmartIndent(ITextView textView) - { - // This forces the smart indent. For example attempting to enter a newline between the functions directive: - // @functions {} will not auto-indent in between the braces unless we forcefully move to end of line. - var editorOperations = _editorOperationsFactory.GetEditorOperations(textView); - editorOperations.MoveToEndOfLine(false); - } - - // Internal for testing - internal void TextBuffer_OnChanged(object sender, TextContentChangedEventArgs args) - { - _dispatcher.AssertForegroundThread(); - - if (!args.TextChangeOccurred(out var changeInformation)) - { - return; - } - - var newText = changeInformation.newText; - if (TryCreateIndentationContext(changeInformation.firstChange.NewPosition, newText.Length, newText, _documentTracker, out var context)) - { - _context = context; - } - } - - private void TextBuffer_OnPostChanged(object sender, EventArgs e) - { - _dispatcher.AssertForegroundThread(); - - var context = _context; - _context = null; - - if (context != null) - { - // Save the current caret position - var textView = context.FocusedTextView; - var caret = textView.Caret.Position.BufferPosition; - var textViewBuffer = textView.TextBuffer; - var indent = CalculateIndent(textViewBuffer, context.ChangePosition); - - // Current state, pipe is cursor: - // @{ - // |} - - // Insert the completion text, i.e. "\r\n " - InsertIndent(caret.Position, indent, textViewBuffer); - - // @{ - // - // |} - - // Place the caret inbetween the braces (before our indent). - RestoreCaretTo(caret.Position, textView); - - // @{ - // | - // } - - // For Razor metacode cases the editor's smart indent wont kick in automatically. - TriggerSmartIndent(textView); - - // @{ - // | - // } - } - } - - private string CalculateIndent(ITextBuffer buffer, int from) - { - // Get the line text of the block start - var currentSnapshotPoint = new SnapshotPoint(buffer.CurrentSnapshot, from); - var line = buffer.CurrentSnapshot.GetLineFromPosition(currentSnapshotPoint); - var lineText = line.GetText(); - - // Gather up the indent from the start block - _indentBuilder.Append(line.GetLineBreakText()); - foreach (var ch in lineText) - { - if (!char.IsWhiteSpace(ch)) - { - break; - } - _indentBuilder.Append(ch); - } - - var indent = _indentBuilder.ToString(); - _indentBuilder.Clear(); - - return indent; - } - - // Internal for testing - internal static void InsertIndent(int insertLocation, string indent, ITextBuffer textBuffer) - { - var edit = textBuffer.CreateEdit(); - edit.Insert(insertLocation, indent); - edit.Apply(); - } - - // Internal for testing - internal static void RestoreCaretTo(int caretPosition, ITextView textView) - { - var currentSnapshotPoint = new SnapshotPoint(textView.TextBuffer.CurrentSnapshot, caretPosition); - textView.Caret.MoveTo(currentSnapshotPoint); - } - - // Internal for testing - internal static bool TryCreateIndentationContext(int changePosition, int changeLength, string finalText, VisualStudioDocumentTracker documentTracker, out BraceIndentationContext context) - { - var focusedTextView = documentTracker.GetFocusedTextView(); - if (focusedTextView != null && ParserHelpers.IsNewLine(finalText)) - { - var currentSnapshot = documentTracker.TextBuffer.CurrentSnapshot; - var preChangeLineSnapshot = currentSnapshot.GetLineFromPosition(changePosition); - - // Handle the case where the \n comes through separately from the \r and the position - // on the line is beyond what the GetText call above gives back. - var linePosition = Math.Min(preChangeLineSnapshot.Length, changePosition - preChangeLineSnapshot.Start) - 1; - - if (AfterOpeningBrace(linePosition, preChangeLineSnapshot)) - { - var afterChangePosition = changePosition + changeLength; - var afterChangeLineSnapshot = currentSnapshot.GetLineFromPosition(afterChangePosition); - var afterChangeLinePosition = afterChangePosition - afterChangeLineSnapshot.Start; - - if (BeforeClosingBrace(afterChangeLinePosition, afterChangeLineSnapshot)) - { - context = new BraceIndentationContext(focusedTextView, changePosition); - return true; - } - } - } - - context = null; - return false; - } - - internal static bool BeforeClosingBrace(int linePosition, ITextSnapshotLine lineSnapshot) - { - var lineText = lineSnapshot.GetText(); - for (; linePosition < lineSnapshot.Length; linePosition++) - { - if (!char.IsWhiteSpace(lineText[linePosition])) - { - break; - } - } - - var beforeClosingBrace = linePosition < lineSnapshot.Length && lineText[linePosition] == '}'; - return beforeClosingBrace; - } - - internal static bool AfterOpeningBrace(int linePosition, ITextSnapshotLine lineSnapshot) - { - var lineText = lineSnapshot.GetText(); - for (; linePosition >= 0; linePosition--) - { - if (!char.IsWhiteSpace(lineText[linePosition])) - { - break; - } - } - - var afterClosingBrace = linePosition >= 0 && lineText[linePosition] == '{'; - return afterClosingBrace; - } - - internal class BraceIndentationContext - { - public BraceIndentationContext(ITextView focusedTextView, int changePosition) - { - FocusedTextView = focusedTextView; - ChangePosition = changePosition; - } - - public ITextView FocusedTextView { get; } - - public int ChangePosition { get; } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenterFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenterFactory.cs deleted file mode 100644 index 691181df69..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BraceSmartIndenterFactory.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class BraceSmartIndenterFactory : ILanguageService - { - public abstract BraceSmartIndenter Create(VisualStudioDocumentTracker documentTracker); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BufferGraphExtensions.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BufferGraphExtensions.cs deleted file mode 100644 index 1d16e0f082..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/BufferGraphExtensions.cs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.ObjectModel; -using Microsoft.VisualStudio.Text.Projection; - -namespace Microsoft.VisualStudio.Text -{ - internal static class BufferGraphExtensions - { - public static Collection GetRazorBuffers(this IBufferGraph bufferGraph) - { - if (bufferGraph == null) - { - throw new ArgumentNullException(nameof(bufferGraph)); - } - - return bufferGraph.GetTextBuffers(TextBufferExtensions.IsRazorBuffer); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ClassifiedSpan.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ClassifiedSpan.cs deleted file mode 100644 index dc066c8fce..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ClassifiedSpan.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public struct ClassifiedSpan - { - public ClassifiedSpan(SourceSpan span, SourceSpan blockSpan, SpanKind spanKind, BlockKind blockKind, AcceptedCharacters acceptedCharacters) - { - Span = span; - BlockSpan = blockSpan; - SpanKind = spanKind; - BlockKind = blockKind; - AcceptedCharacters = acceptedCharacters; - } - - public AcceptedCharacters AcceptedCharacters { get; } - - public BlockKind BlockKind { get; } - - public SourceSpan BlockSpan { get; } - - public SourceSpan Span { get; } - - public SpanKind SpanKind { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeEventArgs.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeEventArgs.cs deleted file mode 100644 index ad28406a15..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeEventArgs.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public sealed class ContextChangeEventArgs : EventArgs - { - public ContextChangeEventArgs(ContextChangeKind kind) - { - Kind = kind; - } - - public ContextChangeKind Kind { get; } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeKind.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeKind.cs deleted file mode 100644 index 2a95099676..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ContextChangeKind.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public enum ContextChangeKind - { - ProjectChanged, - EditorSettingsChanged, - TagHelpersChanged, - ImportsChanged, - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactory.cs deleted file mode 100644 index 9f8a0f91d2..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactory.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Text.Operations; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultBraceSmartIndenterFactory : BraceSmartIndenterFactory - { - private readonly IEditorOperationsFactoryService _editorOperationsFactory; - private readonly ForegroundDispatcher _dispatcher; - - public DefaultBraceSmartIndenterFactory( - ForegroundDispatcher dispatcher, - IEditorOperationsFactoryService editorOperationsFactory) - { - if (dispatcher == null) - { - throw new ArgumentNullException(nameof(dispatcher)); - } - - if (editorOperationsFactory == null) - { - throw new ArgumentNullException(nameof(editorOperationsFactory)); - } - - _dispatcher = dispatcher; - _editorOperationsFactory = editorOperationsFactory; - } - - public override BraceSmartIndenter Create(VisualStudioDocumentTracker documentTracker) - { - if (documentTracker == null) - { - throw new ArgumentNullException(nameof(documentTracker)); - } - - _dispatcher.AssertForegroundThread(); - - var braceSmartIndenter = new BraceSmartIndenter(_dispatcher, documentTracker, _editorOperationsFactory); - - return braceSmartIndenter; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs deleted file mode 100644 index 7657e1599f..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultBraceSmartIndenterFactoryFactory.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Text.Operations; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(BraceSmartIndenterFactory), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultBraceSmartIndenterFactoryFactory : ILanguageServiceFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly IEditorOperationsFactoryService _editorOperationsFactory; - - [ImportingConstructor] - public DefaultBraceSmartIndenterFactoryFactory(ForegroundDispatcher foregroundDispatcher, IEditorOperationsFactoryService editorOperationsFactory) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (editorOperationsFactory == null) - { - throw new ArgumentNullException(nameof(editorOperationsFactory)); - } - - _foregroundDispatcher = foregroundDispatcher; - _editorOperationsFactory = editorOperationsFactory; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - return new DefaultBraceSmartIndenterFactory(_foregroundDispatcher, _editorOperationsFactory); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultCodeDocumentProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultCodeDocumentProvider.cs deleted file mode 100644 index 61fafc8a84..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultCodeDocumentProvider.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(RazorCodeDocumentProvider))] - internal class DefaultCodeDocumentProvider : RazorCodeDocumentProvider - { - private readonly RazorTextBufferProvider _bufferProvider; - private readonly TextBufferCodeDocumentProvider _codeDocumentProvider; - - [ImportingConstructor] - public DefaultCodeDocumentProvider( - RazorTextBufferProvider bufferProvider, - TextBufferCodeDocumentProvider codeDocumentProvider) - { - if (bufferProvider == null) - { - throw new ArgumentNullException(nameof(bufferProvider)); - } - - if (codeDocumentProvider == null) - { - throw new ArgumentNullException(nameof(codeDocumentProvider)); - } - - _bufferProvider = bufferProvider; - _codeDocumentProvider = codeDocumentProvider; - } - - public override bool TryGetFromDocument(TextDocument document, out RazorCodeDocument codeDocument) - { - if (document == null) - { - throw new ArgumentNullException(nameof(document)); - } - - if (!_bufferProvider.TryGetFromDocument(document, out var textBuffer)) - { - // Could not find a Razor buffer associated with the document. - codeDocument = null; - return false; - } - - if (_codeDocumentProvider.TryGetFromBuffer(textBuffer, out codeDocument)) - { - return true; - } - - // A Razor code document has not yet been associated with the buffer yet. - codeDocument = null; - return false; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultEditorSettingsManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultEditorSettingsManager.cs deleted file mode 100644 index cba5851308..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultEditorSettingsManager.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(EditorSettingsManager))] - internal class DefaultEditorSettingsManager : EditorSettingsManager - { - public override event EventHandler Changed; - - private readonly object SettingsAccessorLock = new object(); - private readonly ForegroundDispatcher _foregroundDispatcher; - private EditorSettings _settings; - - [ImportingConstructor] - public DefaultEditorSettingsManager(ForegroundDispatcher foregroundDispatcher) - { - _foregroundDispatcher = foregroundDispatcher; - _settings = EditorSettings.Default; - } - - public override EditorSettings Current - { - get - { - lock (SettingsAccessorLock) - { - return _settings; - } - } - } - - public override void Update(EditorSettings updatedSettings) - { - if (updatedSettings == null) - { - throw new ArgumentNullException(nameof(updatedSettings)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - lock (SettingsAccessorLock) - { - if (!_settings.Equals(updatedSettings)) - { - _settings = updatedSettings; - OnChanged(); - } - } - } - - private void OnChanged() - { - _foregroundDispatcher.AssertForegroundThread(); - - var args = new EditorSettingsChangedEventArgs(Current); - Changed?.Invoke(this, args); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManager.cs deleted file mode 100644 index 2e8c5a450a..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManager.cs +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.IO; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultImportDocumentManager : ImportDocumentManager - { - private readonly FileChangeTrackerFactory _fileChangeTrackerFactory; - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly ErrorReporter _errorReporter; - private readonly RazorProjectEngineFactoryService _projectEngineFactoryService; - private readonly Dictionary _importTrackerCache; - - public override event EventHandler Changed; - - public DefaultImportDocumentManager( - ForegroundDispatcher foregroundDispatcher, - ErrorReporter errorReporter, - FileChangeTrackerFactory fileChangeTrackerFactory, - RazorProjectEngineFactoryService projectEngineFactoryService) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (errorReporter == null) - { - throw new ArgumentNullException(nameof(errorReporter)); - } - - if (fileChangeTrackerFactory == null) - { - throw new ArgumentNullException(nameof(fileChangeTrackerFactory)); - } - - if (projectEngineFactoryService == null) - { - throw new ArgumentNullException(nameof(projectEngineFactoryService)); - } - - _foregroundDispatcher = foregroundDispatcher; - _errorReporter = errorReporter; - _fileChangeTrackerFactory = fileChangeTrackerFactory; - _projectEngineFactoryService = projectEngineFactoryService; - _importTrackerCache = new Dictionary(StringComparer.OrdinalIgnoreCase); - } - - public override void OnSubscribed(VisualStudioDocumentTracker tracker) - { - if (tracker == null) - { - throw new ArgumentNullException(nameof(tracker)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - var imports = GetImportItems(tracker); - foreach (var import in imports) - { - var importFilePath = import.PhysicalPath; - Debug.Assert(importFilePath != null); - - if (!_importTrackerCache.TryGetValue(importFilePath, out var importTracker)) - { - // First time seeing this import. Start tracking it. - var fileChangeTracker = _fileChangeTrackerFactory.Create(importFilePath); - importTracker = new ImportTracker(fileChangeTracker); - _importTrackerCache[importFilePath] = importTracker; - - fileChangeTracker.Changed += FileChangeTracker_Changed; - fileChangeTracker.StartListening(); - } - - importTracker.AssociatedDocuments.Add(tracker.FilePath); - } - } - - public override void OnUnsubscribed(VisualStudioDocumentTracker tracker) - { - if (tracker == null) - { - throw new ArgumentNullException(nameof(tracker)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - var imports = GetImportItems(tracker); - foreach (var import in imports) - { - var importFilePath = import.PhysicalPath; - Debug.Assert(importFilePath != null); - - if (_importTrackerCache.TryGetValue(importFilePath, out var importTracker)) - { - importTracker.AssociatedDocuments.Remove(tracker.FilePath); - - if (importTracker.AssociatedDocuments.Count == 0) - { - // There are no open documents that care about this import. We no longer need to track it. - importTracker.FileChangeTracker.StopListening(); - _importTrackerCache.Remove(importFilePath); - } - } - } - } - - private IEnumerable GetImportItems(VisualStudioDocumentTracker tracker) - { - var projectDirectory = Path.GetDirectoryName(tracker.ProjectPath); - var projectEngine = _projectEngineFactoryService.Create(projectDirectory, _ => { }); - var trackerItem = projectEngine.FileSystem.GetItem(tracker.FilePath); - var importFeature = projectEngine.ProjectFeatures.OfType().FirstOrDefault(); - - // There should always be an import feature unless someone has misconfigured their RazorProjectEngine. - // In that case once we attempt to parse the Razor file we'll explode and give the a user a decent - // error message; for now, lets just be extra protective and assume 0 imports to not give a bad error. - var importItems = importFeature?.GetImports(trackerItem) ?? Enumerable.Empty(); - var physicalImports = importItems.Where(import => import.FilePath != null); - - return physicalImports; - } - - private void OnChanged(ImportTracker importTracker, FileChangeKind changeKind) - { - _foregroundDispatcher.AssertForegroundThread(); - - if (Changed == null) - { - return; - } - - var args = new ImportChangedEventArgs(importTracker.FilePath, changeKind, importTracker.AssociatedDocuments); - Changed.Invoke(this, args); - } - - private void FileChangeTracker_Changed(object sender, FileChangeEventArgs args) - { - _foregroundDispatcher.AssertForegroundThread(); - - if (_importTrackerCache.TryGetValue(args.FilePath, out var importTracker)) - { - OnChanged(importTracker, args.Kind); - } - } - - private class ImportTracker - { - public ImportTracker(FileChangeTracker fileChangeTracker) - { - FileChangeTracker = fileChangeTracker; - AssociatedDocuments = new HashSet(StringComparer.OrdinalIgnoreCase); - } - - public string FilePath => FileChangeTracker.FilePath; - - public FileChangeTracker FileChangeTracker { get; } - - public HashSet AssociatedDocuments { get; } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs deleted file mode 100644 index 47efa8b96c..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultImportDocumentManagerFactory.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(ImportDocumentManager), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultImportDocumentManagerFactory : ILanguageServiceFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - - [ImportingConstructor] - public DefaultImportDocumentManagerFactory(ForegroundDispatcher foregroundDispatcher) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - _foregroundDispatcher = foregroundDispatcher; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - var errorReporter = languageServices.WorkspaceServices.GetRequiredService(); - var fileChangeTrackerFactory = languageServices.GetRequiredService(); - var projectEngineFactoryService = languageServices.GetRequiredService(); - - return new DefaultImportDocumentManager( - _foregroundDispatcher, - errorReporter, - fileChangeTrackerFactory, - projectEngineFactoryService); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryService.cs deleted file mode 100644 index d70f82619e..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryService.cs +++ /dev/null @@ -1,196 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultProjectEngineFactoryService : RazorProjectEngineFactoryService - { - private readonly static RazorConfiguration DefaultConfiguration = FallbackRazorConfiguration.MVC_2_1; - - private readonly Workspace _workspace; - private readonly IFallbackProjectEngineFactory _defaultFactory; - private readonly Lazy[] _customFactories; - private ProjectSnapshotManager _projectManager; - - public DefaultProjectEngineFactoryService( - Workspace workspace, - IFallbackProjectEngineFactory defaultFactory, - Lazy[] customFactories) - { - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - if (defaultFactory == null) - { - throw new ArgumentNullException(nameof(defaultFactory)); - } - - if (customFactories == null) - { - throw new ArgumentNullException(nameof(customFactories)); - } - - _workspace = workspace; - _defaultFactory = defaultFactory; - _customFactories = customFactories; - } - - // Internal for testing - internal DefaultProjectEngineFactoryService( - ProjectSnapshotManager projectManager, - IFallbackProjectEngineFactory defaultFactory, - Lazy[] customFactories) - { - if (projectManager == null) - { - throw new ArgumentNullException(nameof(projectManager)); - } - - if (defaultFactory == null) - { - throw new ArgumentNullException(nameof(defaultFactory)); - } - - if (customFactories == null) - { - throw new ArgumentNullException(nameof(customFactories)); - } - - _projectManager = projectManager; - _defaultFactory = defaultFactory; - _customFactories = customFactories; - } - - public override IProjectEngineFactory FindFactory(ProjectSnapshot project) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - return SelectFactory(project.Configuration ?? DefaultConfiguration, requireSerializable: false); - } - - public override IProjectEngineFactory FindSerializableFactory(ProjectSnapshot project) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - return SelectFactory(project.Configuration ?? DefaultConfiguration, requireSerializable: true); - } - - public override RazorProjectEngine Create(ProjectSnapshot project, Action configure) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - return CreateCore(project, RazorProjectFileSystem.Create(Path.GetDirectoryName(project.FilePath)), configure); - } - - public override RazorProjectEngine Create(string directoryPath, Action configure) - { - if (directoryPath == null) - { - throw new ArgumentNullException(nameof(directoryPath)); - } - - var project = FindProjectByDirectory(directoryPath); - return CreateCore(project, RazorProjectFileSystem.Create(directoryPath), configure); - } - - public override RazorProjectEngine Create(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (fileSystem == null) - { - throw new ArgumentNullException(nameof(fileSystem)); - } - - return CreateCore(project, fileSystem, configure); - } - - private RazorProjectEngine CreateCore(ProjectSnapshot project, RazorProjectFileSystem fileSystem, Action configure) - { - // When we're running in the editor, the editor provides a configure delegate that will include - // the editor settings and tag helpers. - // - // This service is only used in process in Visual Studio, and any other callers should provide these - // things also. - configure = configure ?? ((b) => { }); - - // The default configuration currently matches the newest MVC configuration. - // - // We typically want this because the language adds features over time - we don't want to a bunch of errors - // to show up when a document is first opened, and then go away when the configuration loads, we'd prefer the opposite. - var configuration = project?.Configuration ?? DefaultConfiguration; - - // If there's no factory to handle the configuration then fall back to a very basic configuration. - // - // This will stop a crash from happening in this case (misconfigured project), but will still make - // it obvious to the user that something is wrong. - var factory = SelectFactory(configuration) ?? _defaultFactory; - return factory.Create(configuration, fileSystem, configure); - } - - private IProjectEngineFactory SelectFactory(RazorConfiguration configuration, bool requireSerializable = false) - { - for (var i = 0; i < _customFactories.Length; i++) - { - var factory = _customFactories[i]; - if (string.Equals(configuration.ConfigurationName, factory.Metadata.ConfigurationName)) - { - return requireSerializable && !factory.Metadata.SupportsSerialization ? null : factory.Value; - } - } - - return null; - } - - private ProjectSnapshot FindProjectByDirectory(string directory) - { - directory = NormalizeDirectoryPath(directory); - - if (_projectManager == null) - { - _projectManager = _workspace.Services.GetLanguageServices(RazorLanguage.Name).GetRequiredService(); - } - - var projects = _projectManager.Projects; - for (var i = 0; i < projects.Count; i++) - { - var project = projects[i]; - if (project.FilePath != null) - { - if (string.Equals(directory, NormalizeDirectoryPath(Path.GetDirectoryName(project.FilePath)), StringComparison.OrdinalIgnoreCase)) - { - return project; - } - } - } - - return null; - } - - private string NormalizeDirectoryPath(string path) - { - return path.Replace('\\', '/').TrimEnd('/'); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryServiceFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryServiceFactory.cs deleted file mode 100644 index 7f22134479..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultProjectEngineFactoryServiceFactory.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Composition; -using System.Linq; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [ExportLanguageServiceFactory(typeof(RazorProjectEngineFactoryService), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultProjectEngineFactoryServiceFactory : ILanguageServiceFactory - { - private readonly Lazy[] _customFactories; - private readonly IFallbackProjectEngineFactory _fallbackFactory; - - [ImportingConstructor] - public DefaultProjectEngineFactoryServiceFactory( - IFallbackProjectEngineFactory fallbackFactory, - [ImportMany] IEnumerable> customFactories) - { - if (fallbackFactory == null) - { - throw new ArgumentNullException(nameof(fallbackFactory)); - } - - if (customFactories == null) - { - throw new ArgumentNullException(nameof(customFactories)); - } - - _fallbackFactory = fallbackFactory; - _customFactories = customFactories.ToArray(); - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - return new DefaultProjectEngineFactoryService( - languageServices.WorkspaceServices.Workspace, - _fallbackFactory, - _customFactories); - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManager.cs deleted file mode 100644 index 6be7e06fa9..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorDocumentManager.cs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.Diagnostics; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(RazorDocumentManager))] - internal class DefaultRazorDocumentManager : RazorDocumentManager - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly RazorEditorFactoryService _editorFactoryService; - private readonly TextBufferProjectService _projectService; - - [ImportingConstructor] - public DefaultRazorDocumentManager( - ForegroundDispatcher dispatcher, - RazorEditorFactoryService editorFactoryService, - TextBufferProjectService projectService) - { - if (dispatcher == null) - { - throw new ArgumentNullException(nameof(dispatcher)); - } - - if (editorFactoryService == null) - { - throw new ArgumentNullException(nameof(editorFactoryService)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - _foregroundDispatcher = dispatcher; - _editorFactoryService = editorFactoryService; - _projectService = projectService; - } - - public override void OnTextViewOpened(ITextView textView, IEnumerable subjectBuffers) - { - if (textView == null) - { - throw new ArgumentNullException(nameof(textView)); - } - - if (subjectBuffers == null) - { - throw new ArgumentNullException(nameof(subjectBuffers)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - foreach (var textBuffer in subjectBuffers) - { - if (!textBuffer.IsRazorBuffer()) - { - continue; - } - - if (!IsSupportedProject(textBuffer)) - { - return; - } - - if (!_editorFactoryService.TryGetDocumentTracker(textBuffer, out var documentTracker) || - !(documentTracker is DefaultVisualStudioDocumentTracker tracker)) - { - Debug.Fail("Tracker should always be available given our expectations of the VS workflow."); - return; - } - - tracker.AddTextView(textView); - - if (documentTracker.TextViews.Count == 1) - { - tracker.Subscribe(); - } - } - } - - public override void OnTextViewClosed(ITextView textView, IEnumerable subjectBuffers) - { - if (textView == null) - { - throw new ArgumentNullException(nameof(textView)); - } - - if (subjectBuffers == null) - { - throw new ArgumentNullException(nameof(subjectBuffers)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - // This means a Razor buffer has be detached from this ITextView or the ITextView is closing. Since we keep a - // list of all of the open text views for each text buffer, we need to update the tracker. - // - // Notice that this method is called *after* changes are applied to the text buffer(s). We need to check every - // one of them for a tracker because the content type could have changed. - foreach (var textBuffer in subjectBuffers) - { - DefaultVisualStudioDocumentTracker documentTracker; - if (textBuffer.Properties.TryGetProperty(typeof(VisualStudioDocumentTracker), out documentTracker)) - { - documentTracker.RemoveTextView(textView); - - if (documentTracker.TextViews.Count == 0) - { - documentTracker.Unsubscribe(); - } - } - } - } - - private bool IsSupportedProject(ITextBuffer textBuffer) - { - // Fundamentally we have a Razor half of the world as soon as the document is open - and then later - // the C# half of the world will be initialized. This code is in general pretty tolerant of - // unexpected /impossible states. - // - // We also want to successfully shut down if the buffer is something other than .cshtml. - object project = null; - var isSupportedProject = false; - - // We expect the document to have a hierarchy even if it's not a real 'project'. - // However the hierarchy can be null when the document is in the process of closing. - if ((project = _projectService.GetHostProject(textBuffer)) != null) - { - isSupportedProject = _projectService.IsSupportedProject(project); - } - - return isSupportedProject; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorEditorFactoryService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorEditorFactoryService.cs deleted file mode 100644 index 66f624d02d..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorEditorFactoryService.cs +++ /dev/null @@ -1,151 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using System.Diagnostics; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(RazorEditorFactoryService))] - internal class DefaultRazorEditorFactoryService : RazorEditorFactoryService - { - private static readonly object RazorTextBufferInitializationKey = new object(); - private readonly VisualStudioWorkspaceAccessor _workspaceAccessor; - - [ImportingConstructor] - public DefaultRazorEditorFactoryService(VisualStudioWorkspaceAccessor workspaceAccessor) - { - if (workspaceAccessor == null) - { - throw new ArgumentNullException(nameof(workspaceAccessor)); - } - - _workspaceAccessor = workspaceAccessor; - } - - public override bool TryGetDocumentTracker(ITextBuffer textBuffer, out VisualStudioDocumentTracker documentTracker) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - if (!textBuffer.IsRazorBuffer()) - { - documentTracker = null; - return false; - } - - var textBufferInitialized = TryInitializeTextBuffer(textBuffer); - if (!textBufferInitialized) - { - documentTracker = null; - return false; - } - - if (!textBuffer.Properties.TryGetProperty(typeof(VisualStudioDocumentTracker), out documentTracker)) - { - Debug.Fail("Document tracker should have been stored on the text buffer during initialization."); - return false; - } - - return true; - } - - public override bool TryGetParser(ITextBuffer textBuffer, out VisualStudioRazorParser parser) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - if (!textBuffer.IsRazorBuffer()) - { - parser = null; - return false; - } - - var textBufferInitialized = TryInitializeTextBuffer(textBuffer); - if (!textBufferInitialized) - { - parser = null; - return false; - } - - if (!textBuffer.Properties.TryGetProperty(typeof(VisualStudioRazorParser), out parser)) - { - Debug.Fail("Parser should have been stored on the text buffer during initialization."); - return false; - } - - return true; - } - - internal override bool TryGetSmartIndenter(ITextBuffer textBuffer, out BraceSmartIndenter braceSmartIndenter) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - if (!textBuffer.IsRazorBuffer()) - { - braceSmartIndenter = null; - return false; - } - - var textBufferInitialized = TryInitializeTextBuffer(textBuffer); - if (!textBufferInitialized) - { - braceSmartIndenter = null; - return false; - } - - if (!textBuffer.Properties.TryGetProperty(typeof(BraceSmartIndenter), out braceSmartIndenter)) - { - Debug.Fail("Brace smart indenter should have been stored on the text buffer during initialization."); - return false; - } - - return true; - } - - // Internal for testing - internal bool TryInitializeTextBuffer(ITextBuffer textBuffer) - { - if (textBuffer.Properties.ContainsProperty(RazorTextBufferInitializationKey)) - { - // Buffer already initialized. - return true; - } - - if (!_workspaceAccessor.TryGetWorkspace(textBuffer, out var workspace)) - { - // Could not locate workspace for given text buffer. - return false; - } - - var razorLanguageServices = workspace.Services.GetLanguageServices(RazorLanguage.Name); - var documentTrackerFactory = razorLanguageServices.GetRequiredService(); - var parserFactory = razorLanguageServices.GetRequiredService(); - var braceSmartIndenterFactory = razorLanguageServices.GetRequiredService(); - - var tracker = documentTrackerFactory.Create(textBuffer); - textBuffer.Properties[typeof(VisualStudioDocumentTracker)] = tracker; - - var parser = parserFactory.Create(tracker); - textBuffer.Properties[typeof(VisualStudioRazorParser)] = parser; - - var braceSmartIndenter = braceSmartIndenterFactory.Create(tracker); - textBuffer.Properties[typeof(BraceSmartIndenter)] = braceSmartIndenter; - - textBuffer.Properties.AddProperty(RazorTextBufferInitializationKey, RazorTextBufferInitializationKey); - - return true; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs deleted file mode 100644 index c0ed95ad11..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorIndentationFactsService.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.VisualStudio.Text; -using Span = Microsoft.AspNetCore.Razor.Language.Legacy.Span; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(RazorIndentationFactsService))] - internal class DefaultRazorIndentationFactsService : RazorIndentationFactsService - { - // This method dives down a syntax tree looking for open curly braces, every time - // it finds one it increments its indent until it finds the provided "line". - // - // Examples: - // @{ - // Hello World - // } - // Asking for desired indentation of the @{ or } lines should result in a desired indentation of 4. - // - //
- // @{ - // Hello World - // } - //
- // Asking for desired indentation of the @{ or } lines should result in a desired indentation of 8. - public override int? GetDesiredIndentation( - RazorSyntaxTree syntaxTree, - ITextSnapshot syntaxTreeSnapshot, - ITextSnapshotLine line, - int indentSize, - int tabSize) - { - if (syntaxTree == null) - { - throw new ArgumentNullException(nameof(syntaxTree)); - } - - if (syntaxTreeSnapshot == null) - { - throw new ArgumentNullException(nameof(syntaxTreeSnapshot)); - } - - if (line == null) - { - throw new ArgumentNullException(nameof(line)); - } - - if (indentSize < 0) - { - throw new ArgumentOutOfRangeException(nameof(indentSize)); - } - - if (tabSize < 0) - { - throw new ArgumentOutOfRangeException(nameof(tabSize)); - } - - var previousLineEndIndex = GetPreviousLineEndIndex(syntaxTreeSnapshot, line); - var simulatedChange = new SourceChange(previousLineEndIndex, 0, string.Empty); - var owningSpan = syntaxTree.Root.LocateOwner(simulatedChange); - if (owningSpan.Kind == SpanKindInternal.Code) - { - // Example, - // @{\n - // ^ - The newline here is a code span and we should just let the default c# editor take care of indentation. - - return null; - } - - int? desiredIndentation = null; - SyntaxTreeNode owningChild = owningSpan; - while (owningChild.Parent != null) - { - var owningParent = owningChild.Parent; - for (var i = 0; i < owningParent.Children.Count; i++) - { - var currentChild = owningParent.Children[i]; - if (IsCSharpOpenCurlyBrace(currentChild)) - { - var lineText = line.Snapshot.GetLineFromLineNumber(currentChild.Start.LineIndex).GetText(); - desiredIndentation = GetIndentLevelOfLine(lineText, tabSize) + indentSize; - } - - if (currentChild == owningChild) - { - break; - } - } - - if (desiredIndentation.HasValue) - { - return desiredIndentation; - } - - owningChild = owningParent; - } - - // Couldn't determine indentation - return null; - } - - // Internal for testing - internal int GetIndentLevelOfLine(string line, int tabSize) - { - var indentLevel = 0; - - foreach (var c in line) - { - if (!char.IsWhiteSpace(c)) - { - break; - } - else if (c == '\t') - { - indentLevel += tabSize; - } - else - { - indentLevel++; - } - } - - return indentLevel; - } - - // Internal for testing - internal static int GetPreviousLineEndIndex(ITextSnapshot syntaxTreeSnapshot, ITextSnapshotLine line) - { - var previousLine = line.Snapshot.GetLineFromLineNumber(line.LineNumber - 1); - var trackingPoint = previousLine.Snapshot.CreateTrackingPoint(previousLine.End, PointTrackingMode.Negative); - var previousLineEndIndex = trackingPoint.GetPosition(syntaxTreeSnapshot); - return previousLineEndIndex; - } - - // Internal for testing - internal static bool IsCSharpOpenCurlyBrace(SyntaxTreeNode currentChild) - { - return currentChild is Span currentSpan && - currentSpan.Symbols.Count == 1 && - currentSpan.Symbols[0] is CSharpSymbol symbol && - symbol.Type == CSharpSymbolType.LeftBrace; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorSyntaxFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorSyntaxFactsService.cs deleted file mode 100644 index b6cbfe50af..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultRazorSyntaxFactsService.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Span = Microsoft.AspNetCore.Razor.Language.Legacy.Span; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(RazorSyntaxFactsService))] - internal class DefaultRazorSyntaxFactsService : RazorSyntaxFactsService - { - public override IReadOnlyList GetClassifiedSpans(RazorSyntaxTree syntaxTree) - { - if (syntaxTree == null) - { - throw new ArgumentNullException(nameof(syntaxTree)); - } - - var spans = Flatten(syntaxTree); - - var result = new ClassifiedSpan[spans.Count]; - for (var i = 0; i < spans.Count; i++) - { - var span = spans[i]; - result[i] = new ClassifiedSpan( - new SourceSpan( - span.Start.FilePath ?? syntaxTree.Source.FilePath, - span.Start.AbsoluteIndex, - span.Start.LineIndex, - span.Start.CharacterIndex, - span.Length), - new SourceSpan( - span.Parent.Start.FilePath ?? syntaxTree.Source.FilePath, - span.Parent.Start.AbsoluteIndex, - span.Parent.Start.LineIndex, - span.Parent.Start.CharacterIndex, - span.Parent.Length), - (SpanKind)span.Kind, - (BlockKind)span.Parent.Type, - (AcceptedCharacters)span.EditHandler.AcceptedCharacters); - } - - return result; - } - - private List Flatten(RazorSyntaxTree syntaxTree) - { - var result = new List(); - AppendFlattenedSpans(syntaxTree.Root, result); - return result; - - void AppendFlattenedSpans(SyntaxTreeNode node, List foundSpans) - { - Span spanNode = node as Span; - if (spanNode != null) - { - foundSpans.Add(spanNode); - } - else - { - TagHelperBlock tagHelperNode = node as TagHelperBlock; - if (tagHelperNode != null) - { - // These aren't in document order, sort them first and then dig in - List attributeNodes = tagHelperNode.Attributes.Select(kvp => kvp.Value).Where(att => att != null).ToList(); - attributeNodes.Sort((x, y) => x.Start.AbsoluteIndex.CompareTo(y.Start.AbsoluteIndex)); - - foreach (SyntaxTreeNode curNode in attributeNodes) - { - AppendFlattenedSpans(curNode, foundSpans); - } - } - - Block blockNode = node as Block; - if (blockNode != null) - { - foreach (SyntaxTreeNode curNode in blockNode.Children) - { - AppendFlattenedSpans(curNode, foundSpans); - } - } - } - } - } - - public override IReadOnlyList GetTagHelperSpans(RazorSyntaxTree syntaxTree) - { - if (syntaxTree == null) - { - throw new ArgumentNullException(nameof(syntaxTree)); - } - - var results = new List(); - - List toProcess = new List(); - List blockChildren = new List(); - toProcess.Add(syntaxTree.Root); - - for (var i = 0; i < toProcess.Count; i++) - { - var blockNode = toProcess[i]; - TagHelperBlock tagHelperNode = blockNode as TagHelperBlock; - if (tagHelperNode != null) - { - results.Add(new TagHelperSpan( - new SourceSpan( - tagHelperNode.Start.FilePath ?? syntaxTree.Source.FilePath, - tagHelperNode.Start.AbsoluteIndex, - tagHelperNode.Start.LineIndex, - tagHelperNode.Start.CharacterIndex, - tagHelperNode.Length), - tagHelperNode.Binding)); - } - - // collect all child blocks and inject into toProcess as a single InsertRange - foreach (SyntaxTreeNode curNode in blockNode.Children) - { - Block curBlock = curNode as Block; - if (curBlock != null) - { - blockChildren.Add(curBlock); - } - } - - if (blockChildren.Count > 0) - { - toProcess.InsertRange(i + 1, blockChildren); - blockChildren.Clear(); - } - } - - return results; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperCompletionService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperCompletionService.cs deleted file mode 100644 index dc8d55cb03..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperCompletionService.cs +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.Diagnostics; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(TagHelperCompletionService))] - internal class DefaultTagHelperCompletionService : TagHelperCompletionService - { - private readonly TagHelperFactsService _tagHelperFactsService; - private static readonly HashSet _emptyHashSet = new HashSet(); - - [ImportingConstructor] - public DefaultTagHelperCompletionService(TagHelperFactsService tagHelperFactsService) - { - if (tagHelperFactsService == null) - { - throw new ArgumentNullException(nameof(tagHelperFactsService)); - } - - _tagHelperFactsService = tagHelperFactsService; - } - - /* - * This API attempts to understand a users context as they're typing in a Razor file to provide TagHelper based attribute IntelliSense. - * - * Scenarios for TagHelper attribute IntelliSense follows: - * 1. TagHelperDescriptor's have matching required attribute names - * -> Provide IntelliSense for the required attributes of those descriptors to lead users towards a TagHelperified element. - * 2. TagHelperDescriptor entirely applies to current element. Tag name, attributes, everything is fulfilled. - * -> Provide IntelliSense for the bound attributes for the applied descriptors. - * - * Within each of the above scenarios if an attribute completion has a corresponding bound attribute we associate it with the corresponding - * BoundAttributeDescriptor. By doing this a user can see what C# type a TagHelper expects for the attribute. - */ - public override AttributeCompletionResult GetAttributeCompletions(AttributeCompletionContext completionContext) - { - if (completionContext == null) - { - throw new ArgumentNullException(nameof(completionContext)); - } - - var attributeCompletions = completionContext.ExistingCompletions.ToDictionary( - completion => completion, - _ => new HashSet(), - StringComparer.OrdinalIgnoreCase); - - var documentContext = completionContext.DocumentContext; - var descriptorsForTag = _tagHelperFactsService.GetTagHelpersGivenTag(documentContext, completionContext.CurrentTagName, completionContext.CurrentParentTagName); - if (descriptorsForTag.Count == 0) - { - // If the current tag has no possible descriptors then we can't have any additional attributes. - var defaultResult = AttributeCompletionResult.Create(attributeCompletions); - return defaultResult; - } - - var prefix = documentContext.Prefix ?? string.Empty; - Debug.Assert(completionContext.CurrentTagName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)); - - var applicableTagHelperBinding = _tagHelperFactsService.GetTagHelperBinding( - documentContext, - completionContext.CurrentTagName, - completionContext.Attributes, - completionContext.CurrentParentTagName, - completionContext.CurrentParentIsTagHelper); - - var applicableDescriptors = applicableTagHelperBinding?.Descriptors ?? Enumerable.Empty(); - var unprefixedTagName = completionContext.CurrentTagName.Substring(prefix.Length); - - if (!completionContext.InHTMLSchema(unprefixedTagName) && - applicableDescriptors.All(descriptor => descriptor.TagOutputHint == null)) - { - // This isn't a known HTML tag and no descriptor has an output element hint. Remove all previous completions. - attributeCompletions.Clear(); - } - - for (var i = 0; i < descriptorsForTag.Count; i++) - { - var descriptor = descriptorsForTag[i]; - - if (applicableDescriptors.Contains(descriptor)) - { - foreach (var attributeDescriptor in descriptor.BoundAttributes) - { - UpdateCompletions(attributeDescriptor.Name, attributeDescriptor); - } - } - else - { - var htmlNameToBoundAttribute = descriptor.BoundAttributes.ToDictionary(attribute => attribute.Name, StringComparer.OrdinalIgnoreCase); - - foreach (var rule in descriptor.TagMatchingRules) - { - foreach (var requiredAttribute in rule.Attributes) - { - if (htmlNameToBoundAttribute.TryGetValue(requiredAttribute.Name, out var attributeDescriptor)) - { - UpdateCompletions(requiredAttribute.Name, attributeDescriptor); - } - else - { - UpdateCompletions(requiredAttribute.Name, possibleDescriptor: null); - } - } - } - } - } - - var completionResult = AttributeCompletionResult.Create(attributeCompletions); - return completionResult; - - void UpdateCompletions(string attributeName, BoundAttributeDescriptor possibleDescriptor) - { - if (completionContext.Attributes.Any(attribute => string.Equals(attribute.Key, attributeName, StringComparison.OrdinalIgnoreCase)) && - (completionContext.CurrentAttributeName == null || - !string.Equals(attributeName, completionContext.CurrentAttributeName, StringComparison.OrdinalIgnoreCase))) - { - // Attribute is already present on this element and it is not the attribute in focus. - // It shouldn't exist in the completion list. - return; - } - - if (!attributeCompletions.TryGetValue(attributeName, out var rules)) - { - rules = new HashSet(); - attributeCompletions[attributeName] = rules; - } - - if (possibleDescriptor != null) - { - rules.Add(possibleDescriptor); - } - } - } - - public override ElementCompletionResult GetElementCompletions(ElementCompletionContext completionContext) - { - if (completionContext == null) - { - throw new ArgumentNullException(nameof(completionContext)); - } - - var elementCompletions = new Dictionary>(StringComparer.OrdinalIgnoreCase); - - AddAllowedChildrenCompletions(completionContext, elementCompletions); - - if (elementCompletions.Count > 0) - { - // If the containing element is already a TagHelper and only allows certain children. - var emptyResult = ElementCompletionResult.Create(elementCompletions); - return emptyResult; - } - - elementCompletions = completionContext.ExistingCompletions.ToDictionary( - completion => completion, - _ => new HashSet(), - StringComparer.OrdinalIgnoreCase); - - var catchAllDescriptors = new HashSet(); - var prefix = completionContext.DocumentContext.Prefix ?? string.Empty; - var possibleChildDescriptors = _tagHelperFactsService.GetTagHelpersGivenParent(completionContext.DocumentContext, completionContext.ContainingTagName); - foreach (var possibleDescriptor in possibleChildDescriptors) - { - var addRuleCompletions = false; - var outputHint = possibleDescriptor.TagOutputHint; - - foreach (var rule in possibleDescriptor.TagMatchingRules) - { - if (!TagHelperMatchingConventions.SatisfiesParentTag(completionContext.ContainingTagName, rule)) - { - continue; - } - - if (rule.TagName == TagHelperMatchingConventions.ElementCatchAllName) - { - catchAllDescriptors.Add(possibleDescriptor); - } - else if (elementCompletions.ContainsKey(rule.TagName)) - { - addRuleCompletions = true; - } - else if (outputHint != null) - { - // If the current descriptor has an output hint we need to make sure it shows up only when its output hint would normally show up. - // Example: We have a MyTableTagHelper that has an output hint of "table" and a MyTrTagHelper that has an output hint of "tr". - // If we try typing in a situation like this: | - // We'd expect to only get "my-table" as a completion because the "body" tag doesn't allow "tr" tags. - addRuleCompletions = elementCompletions.ContainsKey(outputHint); - } - else if (!completionContext.InHTMLSchema(rule.TagName)) - { - // If there is an unknown HTML schema tag that doesn't exist in the current completion we should add it. This happens for - // TagHelpers that target non-schema oriented tags. - addRuleCompletions = true; - } - - if (addRuleCompletions) - { - UpdateCompletions(prefix + rule.TagName, possibleDescriptor); - } - } - } - - // We needed to track all catch-alls and update their completions after all other completions have been completed. - // This way, any TagHelper added completions will also have catch-alls listed under their entries. - foreach (var catchAllDescriptor in catchAllDescriptors) - { - foreach (var completionTagName in elementCompletions.Keys) - { - if (elementCompletions[completionTagName].Count > 0 || - !string.IsNullOrEmpty(prefix) && completionTagName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) - { - // The current completion either has other TagHelper's associated with it or is prefixed with a non-empty - // TagHelper prefix. - UpdateCompletions(completionTagName, catchAllDescriptor); - } - } - } - - var result = ElementCompletionResult.Create(elementCompletions); - return result; - - void UpdateCompletions(string tagName, TagHelperDescriptor possibleDescriptor) - { - if (!elementCompletions.TryGetValue(tagName, out var existingRuleDescriptors)) - { - existingRuleDescriptors = new HashSet(); - elementCompletions[tagName] = existingRuleDescriptors; - } - - existingRuleDescriptors.Add(possibleDescriptor); - } - } - - private void AddAllowedChildrenCompletions( - ElementCompletionContext completionContext, - Dictionary> elementCompletions) - { - if (completionContext.ContainingTagName == null) - { - // If we're at the root then there's no containing TagHelper to specify allowed children. - return; - } - - var prefix = completionContext.DocumentContext.Prefix ?? string.Empty; - - var binding = _tagHelperFactsService.GetTagHelperBinding( - completionContext.DocumentContext, - completionContext.ContainingTagName, - completionContext.Attributes, - completionContext.ContainingParentTagName, - completionContext.ContainingParentIsTagHelper); - - if (binding == null) - { - // Containing tag is not a TagHelper; therefore, it allows any children. - return; - } - - foreach (var descriptor in binding.Descriptors) - { - foreach (var childTag in descriptor.AllowedChildTags) - { - var prefixedName = string.Concat(prefix, childTag.Name); - var descriptors = _tagHelperFactsService.GetTagHelpersGivenTag( - completionContext.DocumentContext, - prefixedName, - completionContext.ContainingTagName); - - if (descriptors.Count == 0) - { - if (!elementCompletions.ContainsKey(prefixedName)) - { - elementCompletions[prefixedName] = _emptyHashSet; - } - - continue; - } - - if (!elementCompletions.TryGetValue(prefixedName, out var existingRuleDescriptors)) - { - existingRuleDescriptors = new HashSet(); - elementCompletions[prefixedName] = existingRuleDescriptors; - } - - existingRuleDescriptors.UnionWith(descriptors); - } - } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperFactsService.cs deleted file mode 100644 index 1d23ce0231..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperFactsService.cs +++ /dev/null @@ -1,166 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(TagHelperFactsService))] - internal class DefaultTagHelperFactsService : TagHelperFactsService - { - public override TagHelperBinding GetTagHelperBinding( - TagHelperDocumentContext documentContext, - string tagName, - IEnumerable> attributes, - string parentTag, - bool parentIsTagHelper) - { - if (documentContext == null) - { - throw new ArgumentNullException(nameof(documentContext)); - } - - if (tagName == null) - { - throw new ArgumentNullException(nameof(tagName)); - } - - if (attributes == null) - { - throw new ArgumentNullException(nameof(attributes)); - } - - var descriptors = documentContext.TagHelpers; - if (descriptors == null || descriptors.Count == 0) - { - return null; - } - - var prefix = documentContext.Prefix; - var tagHelperBinder = new TagHelperBinder(prefix, descriptors); - var binding = tagHelperBinder.GetBinding(tagName, attributes.ToList(), parentTag, parentIsTagHelper); - - return binding; - } - - public override IEnumerable GetBoundTagHelperAttributes( - TagHelperDocumentContext documentContext, - string attributeName, - TagHelperBinding binding) - { - if (documentContext == null) - { - throw new ArgumentNullException(nameof(documentContext)); - } - - if (attributeName == null) - { - throw new ArgumentNullException(nameof(attributeName)); - } - - if (binding == null) - { - throw new ArgumentNullException(nameof(binding)); - } - - var matchingBoundAttributes = new List(); - foreach (var descriptor in binding.Descriptors) - { - foreach (var boundAttributeDescriptor in descriptor.BoundAttributes) - { - if (TagHelperMatchingConventions.CanSatisfyBoundAttribute(attributeName, boundAttributeDescriptor)) - { - matchingBoundAttributes.Add(boundAttributeDescriptor); - - // Only one bound attribute can match an attribute - break; - } - } - } - - return matchingBoundAttributes; - } - - public override IReadOnlyList GetTagHelpersGivenTag( - TagHelperDocumentContext documentContext, - string tagName, - string parentTag) - { - if (documentContext == null) - { - throw new ArgumentNullException(nameof(documentContext)); - } - - if (tagName == null) - { - throw new ArgumentNullException(nameof(tagName)); - } - - var matchingDescriptors = new List(); - var descriptors = documentContext?.TagHelpers; - if (descriptors?.Count == 0) - { - return matchingDescriptors; - } - - var prefix = documentContext.Prefix ?? string.Empty; - if (!tagName.StartsWith(prefix, StringComparison.OrdinalIgnoreCase)) - { - // Can't possibly match TagHelpers, it doesn't start with the TagHelperPrefix. - return matchingDescriptors; - } - - var tagNameWithoutPrefix = tagName.Substring(prefix.Length); - for (var i = 0; i < descriptors.Count; i++) - { - var descriptor = descriptors[i]; - foreach (var rule in descriptor.TagMatchingRules) - { - if (TagHelperMatchingConventions.SatisfiesTagName(tagNameWithoutPrefix, rule) && - TagHelperMatchingConventions.SatisfiesParentTag(parentTag, rule)) - { - matchingDescriptors.Add(descriptor); - break; - } - } - } - - return matchingDescriptors; - } - - public override IReadOnlyList GetTagHelpersGivenParent(TagHelperDocumentContext documentContext, string parentTag) - { - if (documentContext == null) - { - throw new ArgumentNullException(nameof(documentContext)); - } - - var matchingDescriptors = new List(); - var descriptors = documentContext?.TagHelpers; - if (descriptors?.Count == 0) - { - return matchingDescriptors; - } - - for (var i = 0; i < descriptors.Count; i++) - { - var descriptor = descriptors[i]; - foreach (var rule in descriptor.TagMatchingRules) - { - if (TagHelperMatchingConventions.SatisfiesParentTag(parentTag, rule)) - { - matchingDescriptors.Add(descriptor); - break; - } - } - } - - return matchingDescriptors; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolver.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolver.cs deleted file mode 100644 index 47453f6f80..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolver.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultTagHelperResolver : TagHelperResolver - { - private readonly RazorProjectEngineFactoryService _engineFactory; - - public DefaultTagHelperResolver(RazorProjectEngineFactoryService engineFactory) - { - if (engineFactory == null) - { - throw new ArgumentNullException(nameof(engineFactory)); - } - - _engineFactory = engineFactory; - } - - public override Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (project.Configuration == null || project.WorkspaceProject == null) - { - return Task.FromResult(TagHelperResolutionResult.Empty); - } - - var engine = _engineFactory.Create(project, RazorProjectFileSystem.Empty, b => { }); - return GetTagHelpersAsync(project, engine); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolverFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolverFactory.cs deleted file mode 100644 index 1a238ad473..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTagHelperResolverFactory.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(TagHelperResolver), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultTagHelperResolverFactory : ILanguageServiceFactory - { - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - return new DefaultTagHelperResolver(languageServices.GetRequiredService()); - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferCodeDocumentProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferCodeDocumentProvider.cs deleted file mode 100644 index a9df7a9c45..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferCodeDocumentProvider.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(TextBufferCodeDocumentProvider))] - internal class DefaultTextBufferCodeDocumentProvider : TextBufferCodeDocumentProvider - { - public override bool TryGetFromBuffer(ITextBuffer textBuffer, out RazorCodeDocument codeDocument) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - if (textBuffer.Properties.TryGetProperty(typeof(VisualStudioRazorParser), out VisualStudioRazorParser parser) && parser.CodeDocument != null) - { - codeDocument = parser.CodeDocument; - return true; - } - - codeDocument = null; - return false; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs deleted file mode 100644 index 22efa0ec08..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultTextBufferProvider.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using System.Linq; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Projection; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(RazorTextBufferProvider))] - internal class DefaultTextBufferProvider : RazorTextBufferProvider - { - private readonly IBufferGraphFactoryService _bufferGraphService; - - [ImportingConstructor] - public DefaultTextBufferProvider(IBufferGraphFactoryService bufferGraphService) - { - if (bufferGraphService == null) - { - throw new ArgumentNullException(nameof(bufferGraphService)); - } - - _bufferGraphService = bufferGraphService; - } - - public override bool TryGetFromDocument(TextDocument document, out ITextBuffer textBuffer) - { - if (document == null) - { - throw new ArgumentNullException(nameof(document)); - } - - textBuffer = null; - - if (!document.TryGetText(out var sourceText)) - { - // Could not retrieve source text from the document. We have no way have locating an ITextBuffer. - return false; - } - - var container = sourceText.Container; - ITextBuffer buffer; - try - { - buffer = container.GetTextBuffer(); - } - catch (ArgumentException) - { - // The source text container was not built from an ITextBuffer. - return false; - } - - var bufferGraph = _bufferGraphService.CreateBufferGraph(buffer); - var razorBuffer = bufferGraph.GetRazorBuffers().FirstOrDefault(); - - if (razorBuffer == null) - { - // Could not find a text buffer associated with the text document. - return false; - } - - textBuffer = razorBuffer; - return true; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTracker.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTracker.cs deleted file mode 100644 index c6e6937b18..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTracker.cs +++ /dev/null @@ -1,231 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultVisualStudioDocumentTracker : VisualStudioDocumentTracker - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly string _filePath; - private readonly string _projectPath; - private readonly ProjectSnapshotManager _projectManager; - private readonly WorkspaceEditorSettings _workspaceEditorSettings; - private readonly ITextBuffer _textBuffer; - private readonly ImportDocumentManager _importDocumentManager; - private readonly List _textViews; - private readonly Workspace _workspace; - private bool _isSupportedProject; - private ProjectSnapshot _project; - - public override event EventHandler ContextChanged; - - public DefaultVisualStudioDocumentTracker( - ForegroundDispatcher dispatcher, - string filePath, - string projectPath, - ProjectSnapshotManager projectManager, - WorkspaceEditorSettings workspaceEditorSettings, - Workspace workspace, - ITextBuffer textBuffer, - ImportDocumentManager importDocumentManager) - { - if (dispatcher == null) - { - throw new ArgumentNullException(nameof(dispatcher)); - } - - if (string.IsNullOrEmpty(filePath)) - { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath)); - } - - if (projectPath == null) - { - throw new ArgumentNullException(nameof(projectPath)); - } - - if (projectManager == null) - { - throw new ArgumentNullException(nameof(projectManager)); - } - - if (workspaceEditorSettings == null) - { - throw new ArgumentNullException(nameof(workspaceEditorSettings)); - } - - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - if (importDocumentManager == null) - { - throw new ArgumentNullException(nameof(importDocumentManager)); - } - - _foregroundDispatcher = dispatcher; - _filePath = filePath; - _projectPath = projectPath; - _projectManager = projectManager; - _workspaceEditorSettings = workspaceEditorSettings; - _textBuffer = textBuffer; - _importDocumentManager = importDocumentManager; - _workspace = workspace; // For now we assume that the workspace is the always default VS workspace. - - _textViews = new List(); - } - - public override RazorConfiguration Configuration => _project?.Configuration; - - public override EditorSettings EditorSettings => _workspaceEditorSettings.Current; - - public override IReadOnlyList TagHelpers => _project?.TagHelpers ?? Array.Empty(); - - public override bool IsSupportedProject => _isSupportedProject; - - public override Project Project => _workspace.CurrentSolution.GetProject(_project.WorkspaceProject.Id); - - public override ITextBuffer TextBuffer => _textBuffer; - - public override IReadOnlyList TextViews => _textViews; - - public override Workspace Workspace => _workspace; - - public override string FilePath => _filePath; - - public override string ProjectPath => _projectPath; - - internal void AddTextView(ITextView textView) - { - if (textView == null) - { - throw new ArgumentNullException(nameof(textView)); - } - - if (!_textViews.Contains(textView)) - { - _textViews.Add(textView); - } - } - - internal void RemoveTextView(ITextView textView) - { - if (textView == null) - { - throw new ArgumentNullException(nameof(textView)); - } - - if (_textViews.Contains(textView)) - { - _textViews.Remove(textView); - } - } - - public override ITextView GetFocusedTextView() - { - for (var i = 0; i < TextViews.Count; i++) - { - if (TextViews[i].HasAggregateFocus) - { - return TextViews[i]; - } - } - - return null; - } - - public void Subscribe() - { - _importDocumentManager.OnSubscribed(this); - - _workspaceEditorSettings.Changed += EditorSettingsManager_Changed; - _projectManager.Changed += ProjectManager_Changed; - _importDocumentManager.Changed += Import_Changed; - - _isSupportedProject = true; - _project = _projectManager.GetProjectWithFilePath(_projectPath); - - OnContextChanged(_project, ContextChangeKind.ProjectChanged); - } - - public void Unsubscribe() - { - _importDocumentManager.OnUnsubscribed(this); - - _projectManager.Changed -= ProjectManager_Changed; - _workspaceEditorSettings.Changed -= EditorSettingsManager_Changed; - _importDocumentManager.Changed -= Import_Changed; - - // Detached from project. - _isSupportedProject = false; - _project = null; - - OnContextChanged(project: null, kind: ContextChangeKind.ProjectChanged); - } - - private void OnContextChanged(ProjectSnapshot project, ContextChangeKind kind) - { - _foregroundDispatcher.AssertForegroundThread(); - - _project = project; - - var handler = ContextChanged; - if (handler != null) - { - handler(this, new ContextChangeEventArgs(kind)); - } - } - - // Internal for testing - internal void ProjectManager_Changed(object sender, ProjectChangeEventArgs e) - { - if (_projectPath != null && - string.Equals(_projectPath, e.Project.FilePath, StringComparison.OrdinalIgnoreCase)) - { - if (e.Kind == ProjectChangeKind.TagHelpersChanged) - { - OnContextChanged(e.Project, ContextChangeKind.TagHelpersChanged); - } - else - { - OnContextChanged(e.Project, ContextChangeKind.ProjectChanged); - } - } - } - - // Internal for testing - internal void EditorSettingsManager_Changed(object sender, EditorSettingsChangedEventArgs args) - { - OnContextChanged(_project, ContextChangeKind.EditorSettingsChanged); - } - - // Internal for testing - internal void Import_Changed(object sender, ImportChangedEventArgs args) - { - foreach (var path in args.AssociatedDocuments) - { - if (string.Equals(_filePath, path, StringComparison.OrdinalIgnoreCase)) - { - OnContextChanged(_project, ContextChangeKind.ImportsChanged); - break; - } - } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactory.cs deleted file mode 100644 index 7005ce059e..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactory.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultVisualStudioDocumentTrackerFactory : VisualStudioDocumentTrackerFactory - { - private readonly TextBufferProjectService _projectService; - private readonly ITextDocumentFactoryService _textDocumentFactory; - private readonly Workspace _workspace; - private readonly ImportDocumentManager _importDocumentManager; - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly ProjectSnapshotManager _projectManager; - private readonly WorkspaceEditorSettings _workspaceEditorSettings; - - public DefaultVisualStudioDocumentTrackerFactory( - ForegroundDispatcher foregroundDispatcher, - ProjectSnapshotManager projectManager, - WorkspaceEditorSettings workspaceEditorSettings, - TextBufferProjectService projectService, - ITextDocumentFactoryService textDocumentFactory, - ImportDocumentManager importDocumentManager, - Workspace workspace) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (projectManager == null) - { - throw new ArgumentNullException(nameof(projectManager)); - } - - if (workspaceEditorSettings == null) - { - throw new ArgumentNullException(nameof(workspaceEditorSettings)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - if (textDocumentFactory == null) - { - throw new ArgumentNullException(nameof(textDocumentFactory)); - } - - if (importDocumentManager == null) - { - throw new ArgumentNullException(nameof(importDocumentManager)); - } - - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - _foregroundDispatcher = foregroundDispatcher; - _projectManager = projectManager; - _workspaceEditorSettings = workspaceEditorSettings; - _projectService = projectService; - _textDocumentFactory = textDocumentFactory; - _importDocumentManager = importDocumentManager; - _workspace = workspace; - } - - public override VisualStudioDocumentTracker Create(ITextBuffer textBuffer) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - if (!_textDocumentFactory.TryGetTextDocument(textBuffer, out var textDocument)) - { - Debug.Fail("Text document should be available from the text buffer."); - return null; - } - - var filePath = textDocument.FilePath; - var project = _projectService.GetHostProject(textBuffer); - if (project == null) - { - Debug.Fail("Text buffer should belong to a project."); - return null; - } - - var projectPath = _projectService.GetProjectPath(project); - - var tracker = new DefaultVisualStudioDocumentTracker(_foregroundDispatcher, filePath, projectPath, _projectManager, _workspaceEditorSettings, _workspace, textBuffer, _importDocumentManager); - - return tracker; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs deleted file mode 100644 index a2af5b8d17..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioDocumentTrackerFactoryFactory.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(VisualStudioDocumentTrackerFactory), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultVisualStudioDocumentTrackerFactoryFactory : ILanguageServiceFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly TextBufferProjectService _projectService; - private readonly ITextDocumentFactoryService _textDocumentFactory; - - [ImportingConstructor] - public DefaultVisualStudioDocumentTrackerFactoryFactory( - ForegroundDispatcher foregroundDispatcher, - TextBufferProjectService projectService, - ITextDocumentFactoryService textDocumentFactory) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - if (textDocumentFactory == null) - { - throw new ArgumentNullException(nameof(textDocumentFactory)); - } - - _foregroundDispatcher = foregroundDispatcher; - _projectService = projectService; - _textDocumentFactory = textDocumentFactory; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - var projectManager = languageServices.GetRequiredService(); - var workspaceEditorSettings = languageServices.GetRequiredService(); - var importDocumentManager = languageServices.GetRequiredService(); - - return new DefaultVisualStudioDocumentTrackerFactory( - _foregroundDispatcher, - projectManager, - workspaceEditorSettings, - _projectService, - _textDocumentFactory, - importDocumentManager, - languageServices.WorkspaceServices.Workspace); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs deleted file mode 100644 index ddbd000f0b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParser.cs +++ /dev/null @@ -1,445 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; -using Microsoft.VisualStudio.Text; -using ITextBuffer = Microsoft.VisualStudio.Text.ITextBuffer; -using Timer = System.Threading.Timer; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultVisualStudioRazorParser : VisualStudioRazorParser, IDisposable - { - public override event EventHandler DocumentStructureChanged; - - // Internal for testing. - internal TimeSpan IdleDelay = TimeSpan.FromSeconds(3); - internal Timer _idleTimer; - internal BackgroundParser _parser; - internal ChangeReference _latestChangeReference; - internal RazorSyntaxTreePartialParser _partialParser; - - private readonly object IdleLock = new object(); - private readonly VisualStudioCompletionBroker _completionBroker; - private readonly VisualStudioDocumentTracker _documentTracker; - private readonly ForegroundDispatcher _dispatcher; - private readonly RazorProjectEngineFactoryService _projectEngineFactory; - private readonly ErrorReporter _errorReporter; - private RazorProjectEngine _projectEngine; - private RazorCodeDocument _codeDocument; - private ITextSnapshot _snapshot; - private bool _disposed; - - // For testing only - internal DefaultVisualStudioRazorParser(RazorCodeDocument codeDocument) - { - _codeDocument = codeDocument; - } - - public DefaultVisualStudioRazorParser( - ForegroundDispatcher dispatcher, - VisualStudioDocumentTracker documentTracker, - RazorProjectEngineFactoryService projectEngineFactory, - ErrorReporter errorReporter, - VisualStudioCompletionBroker completionBroker) - { - if (dispatcher == null) - { - throw new ArgumentNullException(nameof(dispatcher)); - } - - if (documentTracker == null) - { - throw new ArgumentNullException(nameof(documentTracker)); - } - - if (projectEngineFactory == null) - { - throw new ArgumentNullException(nameof(projectEngineFactory)); - } - - if (errorReporter == null) - { - throw new ArgumentNullException(nameof(errorReporter)); - } - - if (completionBroker == null) - { - throw new ArgumentNullException(nameof(completionBroker)); - } - - _dispatcher = dispatcher; - _projectEngineFactory = projectEngineFactory; - _errorReporter = errorReporter; - _completionBroker = completionBroker; - _documentTracker = documentTracker; - - _documentTracker.ContextChanged += DocumentTracker_ContextChanged; - } - - public override string FilePath => _documentTracker.FilePath; - - public override RazorCodeDocument CodeDocument => _codeDocument; - - public override ITextSnapshot Snapshot => _snapshot; - - public override ITextBuffer TextBuffer => _documentTracker.TextBuffer; - - public override bool HasPendingChanges => _latestChangeReference != null; - - // Used in unit tests to ensure we can be notified when idle starts. - internal ManualResetEventSlim NotifyForegroundIdleStart { get; set; } - - // Used in unit tests to ensure we can block background idle work. - internal ManualResetEventSlim BlockBackgroundIdleWork { get; set; } - - public override void QueueReparse() - { - // Can be called from any thread - - if (_dispatcher.IsForegroundThread) - { - ReparseOnForeground(null); - } - else - { - Task.Factory.StartNew(ReparseOnForeground, null, CancellationToken.None, TaskCreationOptions.None, _dispatcher.ForegroundScheduler); - } - } - - public void Dispose() - { - _dispatcher.AssertForegroundThread(); - - StopParser(); - - _documentTracker.ContextChanged -= DocumentTracker_ContextChanged; - - StopIdleTimer(); - - _disposed = true; - } - - // Internal for testing - internal void DocumentTracker_ContextChanged(object sender, ContextChangeEventArgs args) - { - _dispatcher.AssertForegroundThread(); - - if (!TryReinitializeParser()) - { - return; - } - - // We have a new parser, force a reparse to generate new document information. Note that this - // only blocks until the reparse change has been queued. - QueueReparse(); - } - - // Internal for testing - internal bool TryReinitializeParser() - { - _dispatcher.AssertForegroundThread(); - - StopParser(); - - if (!_documentTracker.IsSupportedProject) - { - // Tracker is either starting up, tearing down or wrongfully instantiated. - // Either way, the tracker can't act on its associated project, neither can we. - return false; - } - - StartParser(); - - return true; - } - - // Internal for testing - internal void StartParser() - { - _dispatcher.AssertForegroundThread(); - - var projectDirectory = Path.GetDirectoryName(_documentTracker.ProjectPath); - _projectEngine = _projectEngineFactory.Create(projectDirectory, ConfigureProjectEngine); - _parser = new BackgroundParser(_projectEngine, FilePath, projectDirectory); - _parser.ResultsReady += OnResultsReady; - _parser.Start(); - - TextBuffer.Changed += TextBuffer_OnChanged; - } - - // Internal for testing - internal void StopParser() - { - _dispatcher.AssertForegroundThread(); - - if (_parser != null) - { - // Detatch from the text buffer until we have a new parser to handle changes. - TextBuffer.Changed -= TextBuffer_OnChanged; - - _parser.ResultsReady -= OnResultsReady; - _parser.Dispose(); - _parser = null; - } - } - - // Internal for testing - internal void StartIdleTimer() - { - _dispatcher.AssertForegroundThread(); - - lock (IdleLock) - { - if (_idleTimer == null) - { - // Timer will fire after a fixed delay, but only once. - _idleTimer = new Timer(Timer_Tick, null, IdleDelay, Timeout.InfiniteTimeSpan); - } - } - } - - // Internal for testing - internal void StopIdleTimer() - { - // Can be called from any thread. - - lock (IdleLock) - { - if (_idleTimer != null) - { - _idleTimer.Dispose(); - _idleTimer = null; - } - } - } - - private void TextBuffer_OnChanged(object sender, TextContentChangedEventArgs args) - { - _dispatcher.AssertForegroundThread(); - - if (args.Changes.Count > 0) - { - // Idle timers are used to track provisional changes. Provisional changes only last for a single text change. After that normal - // partial parsing rules apply (stop the timer). - StopIdleTimer(); - } - - if (!args.TextChangeOccurred(out var changeInformation)) - { - return; - } - - var change = new SourceChange(changeInformation.firstChange.OldPosition, changeInformation.oldText.Length, changeInformation.newText); - var snapshot = args.After; - var result = PartialParseResultInternal.Rejected; - - using (_parser.SynchronizeMainThreadState()) - { - // Check if we can partial-parse - if (_partialParser != null && _parser.IsIdle) - { - result = _partialParser.Parse(change); - } - } - - // If partial parsing failed or there were outstanding parser tasks, start a full reparse - if ((result & PartialParseResultInternal.Rejected) == PartialParseResultInternal.Rejected) - { - QueueChange(change, snapshot); - } - - if ((result & PartialParseResultInternal.Provisional) == PartialParseResultInternal.Provisional) - { - StartIdleTimer(); - } - } - - // Internal for testing - internal void OnIdle(object state) - { - _dispatcher.AssertForegroundThread(); - - if (_disposed) - { - return; - } - - OnNotifyForegroundIdle(); - - foreach (var textView in _documentTracker.TextViews) - { - if (_completionBroker.IsCompletionActive(textView)) - { - // Completion list is still active, need to re-start timer. - StartIdleTimer(); - return; - } - } - - QueueReparse(); - } - - // Internal for testing - internal void ReparseOnForeground(object state) - { - _dispatcher.AssertForegroundThread(); - - if (_disposed) - { - return; - } - - var snapshot = TextBuffer.CurrentSnapshot; - QueueChange(null, snapshot); - } - - private void QueueChange(SourceChange change, ITextSnapshot snapshot) - { - _dispatcher.AssertForegroundThread(); - - _latestChangeReference = new ChangeReference(change, snapshot); - _parser.QueueChange(change, snapshot); - } - - private void OnNotifyForegroundIdle() - { - if (NotifyForegroundIdleStart != null) - { - NotifyForegroundIdleStart.Set(); - } - } - - private void OnStartingBackgroundIdleWork() - { - if (BlockBackgroundIdleWork != null) - { - BlockBackgroundIdleWork.Wait(); - } - } - - private void Timer_Tick(object state) - { - try - { - _dispatcher.AssertBackgroundThread(); - - OnStartingBackgroundIdleWork(); - - StopIdleTimer(); - - // We need to get back to the UI thread to properly check if a completion is active. - Task.Factory.StartNew(OnIdle, null, CancellationToken.None, TaskCreationOptions.None, _dispatcher.ForegroundScheduler); - } - catch (Exception ex) - { - // This is something totally unexpected, let's just send it over to the workspace. - Task.Factory.StartNew(() => _errorReporter.ReportError(ex), CancellationToken.None, TaskCreationOptions.None, _dispatcher.ForegroundScheduler); - } - } - - private void OnResultsReady(object sender, DocumentStructureChangedEventArgs args) - { - _dispatcher.AssertBackgroundThread(); - - // Jump back to UI thread to notify structure changes. - Task.Factory.StartNew(OnDocumentStructureChanged, args, CancellationToken.None, TaskCreationOptions.None, _dispatcher.ForegroundScheduler); - } - - // Internal for testing - internal void OnDocumentStructureChanged(object state) - { - _dispatcher.AssertForegroundThread(); - - if (_disposed) - { - return; - } - - var args = (DocumentStructureChangedEventArgs)state; - if (_latestChangeReference == null || // extra hardening - !_latestChangeReference.IsAssociatedWith(args) || - args.Snapshot != TextBuffer.CurrentSnapshot) - { - // In the middle of parsing a newer change or about to parse a newer change. - return; - } - - _latestChangeReference = null; - _codeDocument = args.CodeDocument; - _snapshot = args.Snapshot; - _partialParser = new RazorSyntaxTreePartialParser(CodeDocument.GetSyntaxTree()); - - DocumentStructureChanged?.Invoke(this, args); - } - - private void ConfigureProjectEngine(RazorProjectEngineBuilder builder) - { - builder.Features.Add(new VisualStudioParserOptionsFeature(_documentTracker.EditorSettings)); - builder.Features.Add(new VisualStudioTagHelperFeature(_documentTracker.TagHelpers)); - } - - private class VisualStudioParserOptionsFeature : RazorEngineFeatureBase, IConfigureRazorCodeGenerationOptionsFeature - { - private readonly EditorSettings _settings; - - public VisualStudioParserOptionsFeature(EditorSettings settings) - { - _settings = settings; - } - - public int Order { get; set; } - - public void Configure(RazorCodeGenerationOptionsBuilder options) - { - options.IndentSize = _settings.IndentSize; - options.IndentWithTabs = _settings.IndentWithTabs; - } - } - - private class VisualStudioTagHelperFeature : ITagHelperFeature - { - private readonly IReadOnlyList _tagHelpers; - - public VisualStudioTagHelperFeature(IReadOnlyList tagHelpers) - { - _tagHelpers = tagHelpers; - } - - public RazorEngine Engine { get; set; } - - public IReadOnlyList GetDescriptors() - { - return _tagHelpers; - } - } - - // Internal for testing - internal class ChangeReference - { - public ChangeReference(SourceChange change, ITextSnapshot snapshot) - { - Change = change; - Snapshot = snapshot; - } - - public SourceChange Change { get; } - - public ITextSnapshot Snapshot { get; } - - public bool IsAssociatedWith(DocumentStructureChangedEventArgs other) - { - return Change == other.SourceChange && - Snapshot == other.Snapshot; - } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs deleted file mode 100644 index 5318ede596..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactory.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultVisualStudioRazorParserFactory : VisualStudioRazorParserFactory - { - private readonly ForegroundDispatcher _dispatcher; - private readonly RazorProjectEngineFactoryService _projectEngineFactoryService; - private readonly VisualStudioCompletionBroker _completionBroker; - private readonly ErrorReporter _errorReporter; - - public DefaultVisualStudioRazorParserFactory( - ForegroundDispatcher dispatcher, - ErrorReporter errorReporter, - VisualStudioCompletionBroker completionBroker, - RazorProjectEngineFactoryService projectEngineFactoryService) - { - if (dispatcher == null) - { - throw new ArgumentNullException(nameof(dispatcher)); - } - - if (errorReporter == null) - { - throw new ArgumentNullException(nameof(errorReporter)); - } - - if (completionBroker == null) - { - throw new ArgumentNullException(nameof(completionBroker)); - } - - if (projectEngineFactoryService == null) - { - throw new ArgumentNullException(nameof(projectEngineFactoryService)); - } - - _dispatcher = dispatcher; - _errorReporter = errorReporter; - _completionBroker = completionBroker; - _projectEngineFactoryService = projectEngineFactoryService; - } - - public override VisualStudioRazorParser Create(VisualStudioDocumentTracker documentTracker) - { - if (documentTracker == null) - { - throw new ArgumentNullException(nameof(documentTracker)); - } - - _dispatcher.AssertForegroundThread(); - - var parser = new DefaultVisualStudioRazorParser( - _dispatcher, - documentTracker, - _projectEngineFactoryService, - _errorReporter, - _completionBroker); - return parser; - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs deleted file mode 100644 index 38cfe5f189..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultVisualStudioRazorParserFactoryFactory.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(VisualStudioRazorParserFactory), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultVisualStudioRazorParserFactoryFactory : ILanguageServiceFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - - [ImportingConstructor] - public DefaultVisualStudioRazorParserFactoryFactory(ForegroundDispatcher foregroundDispatcher) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - _foregroundDispatcher = foregroundDispatcher; - } - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - var workspaceServices = languageServices.WorkspaceServices; - var errorReporter = workspaceServices.GetRequiredService(); - var completionBroker = languageServices.GetRequiredService(); - var projectEngineFactoryService = languageServices.GetRequiredService(); - - return new DefaultVisualStudioRazorParserFactory( - _foregroundDispatcher, - errorReporter, - completionBroker, - projectEngineFactoryService); - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettings.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettings.cs deleted file mode 100644 index 0e49fbb8f4..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettings.cs +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class DefaultWorkspaceEditorSettings : WorkspaceEditorSettings - { - private readonly EditorSettingsManager _editorSettingsManager; - private readonly EventHandler _onChanged; - private EventHandler _changed; - private readonly ForegroundDispatcher _foregroundDispatcher; - private int _listenerCount = 0; - - public DefaultWorkspaceEditorSettings(ForegroundDispatcher foregroundDispatcher, EditorSettingsManager editorSettingsManager) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (editorSettingsManager == null) - { - throw new ArgumentNullException(nameof(editorSettingsManager)); - } - - _foregroundDispatcher = foregroundDispatcher; - _editorSettingsManager = editorSettingsManager; - _onChanged = OnChanged; - } - - public override event EventHandler Changed - { - add - { - _foregroundDispatcher.AssertForegroundThread(); - - _listenerCount++; - _changed += value; - - if (_listenerCount == 1) - { - // We bind to the editor settings manager only when we have listeners to avoid leaking memory. - // Basically we're relying on anyone listening to us to have an understanding of when they're going - // to be torn down. In Razor's case this will just be the document tracker factory (which does know). - AttachToEditorSettingsManager(); - } - } - remove - { - _foregroundDispatcher.AssertForegroundThread(); - - _listenerCount--; - _changed -= value; - - if (_listenerCount == 0) - { - // We detatch from the editor settings manager when no one is listening to allow us to be garbage - // collected in the case that the workspace is tearing down. - DetachFromEditorSettingsManager(); - } - } - } - - // Internal for testing - internal virtual void AttachToEditorSettingsManager() - { - _editorSettingsManager.Changed += _onChanged; - } - - // Internal for testing - internal virtual void DetachFromEditorSettingsManager() - { - _editorSettingsManager.Changed -= _onChanged; - } - - public override EditorSettings Current => _editorSettingsManager.Current; - - // Internal for testing - internal void OnChanged(object sender, EditorSettingsChangedEventArgs e) - { - _foregroundDispatcher.AssertForegroundThread(); - - Debug.Assert(_changed != null, nameof(OnChanged) + " should not be invoked when there are no listeners."); - - var args = new EditorSettingsChangedEventArgs(Current); - _changed?.Invoke(this, args); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettingsFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettingsFactory.cs deleted file mode 100644 index 6bc448b43f..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DefaultWorkspaceEditorSettingsFactory.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(WorkspaceEditorSettings), RazorLanguage.Name)] - internal class DefaultWorkspaceEditorSettingsFactory : ILanguageServiceFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly EditorSettingsManager _editorSettingsManager; - - [ImportingConstructor] - public DefaultWorkspaceEditorSettingsFactory(ForegroundDispatcher foregroundDispatcher, EditorSettingsManager editorSettingsManager) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (editorSettingsManager == null) - { - throw new ArgumentNullException(nameof(editorSettingsManager)); - } - - _foregroundDispatcher = foregroundDispatcher; - _editorSettingsManager = editorSettingsManager; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - return new DefaultWorkspaceEditorSettings(_foregroundDispatcher, _editorSettingsManager); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DocumentStructureChangedEventArgs.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DocumentStructureChangedEventArgs.cs deleted file mode 100644 index 4cd5e5c7dc..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/DocumentStructureChangedEventArgs.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public sealed class DocumentStructureChangedEventArgs : EventArgs - { - public DocumentStructureChangedEventArgs( - SourceChange change, - ITextSnapshot snapshot, - RazorCodeDocument codeDocument) - { - SourceChange = change; - Snapshot = snapshot; - CodeDocument = codeDocument; - } - - /// - /// The which triggered the re-parse. - /// - public SourceChange SourceChange { get; } - - /// - /// The text snapshot used in the re-parse. - /// - public ITextSnapshot Snapshot { get; } - - /// - /// The result of the parsing and code generation. - /// - public RazorCodeDocument CodeDocument { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/EditorSettingsManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/EditorSettingsManager.cs deleted file mode 100644 index c3e0399bde..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/EditorSettingsManager.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class EditorSettingsManager - { - public abstract event EventHandler Changed; - - public abstract EditorSettings Current { get; } - - public abstract void Update(EditorSettings updateSettings); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionContext.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionContext.cs deleted file mode 100644 index 6d2c3965f5..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionContext.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public sealed class ElementCompletionContext - { - public ElementCompletionContext( - TagHelperDocumentContext documentContext, - IEnumerable existingCompletions, - string containingTagName, - IEnumerable> attributes, - string containingParentTagName, - bool containingParentIsTagHelper, - Func inHTMLSchema) - { - if (documentContext == null) - { - throw new ArgumentNullException(nameof(documentContext)); - } - - if (existingCompletions == null) - { - throw new ArgumentNullException(nameof(existingCompletions)); - } - - if (inHTMLSchema == null) - { - throw new ArgumentNullException(nameof(inHTMLSchema)); - } - - DocumentContext = documentContext; - ExistingCompletions = existingCompletions; - ContainingTagName = containingTagName; - Attributes = attributes; - ContainingParentTagName = containingParentTagName; - ContainingParentIsTagHelper = containingParentIsTagHelper; - InHTMLSchema = inHTMLSchema; - } - - public TagHelperDocumentContext DocumentContext { get; } - - public IEnumerable ExistingCompletions { get; } - - public string ContainingTagName { get; } - - public IEnumerable> Attributes { get; } - - public string ContainingParentTagName { get; } - - public bool ContainingParentIsTagHelper { get; } - - public Func InHTMLSchema { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionResult.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionResult.cs deleted file mode 100644 index 3f5a9ad2d7..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ElementCompletionResult.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class ElementCompletionResult - { - private ElementCompletionResult() - { - } - - public abstract IReadOnlyDictionary> Completions { get; } - - internal static ElementCompletionResult Create(Dictionary> completions) - { - var readonlyCompletions = completions.ToDictionary( - key => key.Key, - value => (IEnumerable)value.Value, - completions.Comparer); - var result = new DefaultElementCompletionResult(readonlyCompletions); - - return result; - } - - private class DefaultElementCompletionResult : ElementCompletionResult - { - private readonly IReadOnlyDictionary> _completions; - - public DefaultElementCompletionResult(IReadOnlyDictionary> completions) - { - _completions = completions; - } - - public override IReadOnlyDictionary> Completions => _completions; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeEventArgs.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeEventArgs.cs deleted file mode 100644 index 508c27381a..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeEventArgs.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal sealed class FileChangeEventArgs : EventArgs - { - public FileChangeEventArgs(string filePath, FileChangeKind kind) - { - FilePath = filePath; - Kind = kind; - } - - public string FilePath { get; } - - public FileChangeKind Kind { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeKind.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeKind.cs deleted file mode 100644 index f5be58db77..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeKind.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal enum FileChangeKind - { - Added, - Removed, - Changed, - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeTracker.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeTracker.cs deleted file mode 100644 index 3c51bebdf6..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeTracker.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class FileChangeTracker - { - public abstract event EventHandler Changed; - - public abstract string FilePath { get; } - - public abstract void StartListening(); - - public abstract void StopListening(); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeTrackerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeTrackerFactory.cs deleted file mode 100644 index f3b57f72a0..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/FileChangeTrackerFactory.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class FileChangeTrackerFactory : ILanguageService - { - public abstract FileChangeTracker Create(string filePath); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ImportChangedEventArgs.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ImportChangedEventArgs.cs deleted file mode 100644 index 8444943bd6..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ImportChangedEventArgs.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class ImportChangedEventArgs : EventArgs - { - public ImportChangedEventArgs(string filePath, FileChangeKind kind, IEnumerable associatedDocuments) - { - FilePath = filePath; - Kind = kind; - AssociatedDocuments = associatedDocuments; - } - - public string FilePath { get; } - - public FileChangeKind Kind { get; } - - public IEnumerable AssociatedDocuments { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ImportDocumentManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ImportDocumentManager.cs deleted file mode 100644 index 0dbc93a21b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/ImportDocumentManager.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class ImportDocumentManager : ILanguageService - { - public abstract event EventHandler Changed; - - public abstract void OnSubscribed(VisualStudioDocumentTracker tracker); - - public abstract void OnUnsubscribed(VisualStudioDocumentTracker tracker); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_1_0.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_1_0.cs deleted file mode 100644 index 9b3b92eb89..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_1_0.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Reflection; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [ExportCustomProjectEngineFactory("MVC-1.0", SupportsSerialization = true)] - internal class LegacyProjectEngineFactory_1_0 : IProjectEngineFactory - { - private const string AssemblyName = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X"; - - public RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure) - { - // Rewrite the assembly name into a full name just like this one, but with the name of the MVC design time assembly. - var assemblyName = new AssemblyName(typeof(LegacyProjectEngineFactory_1_0).Assembly.FullName); - assemblyName.Name = AssemblyName; - - var extension = new AssemblyExtension(configuration.ConfigurationName, Assembly.Load(assemblyName)); - var initializer = extension.CreateInitializer(); - - return RazorProjectEngine.Create(configuration, fileSystem, b => - { - initializer.Initialize(b); - configure?.Invoke(b); - }); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_1_1.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_1_1.cs deleted file mode 100644 index d01e6999a8..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_1_1.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Reflection; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [ExportCustomProjectEngineFactory("MVC-1.1", SupportsSerialization = true)] - internal class LegacyProjectEngineFactory_1_1 : IProjectEngineFactory - { - private const string AssemblyName = "Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X"; - - public RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure) - { - // Rewrite the assembly name into a full name just like this one, but with the name of the MVC design time assembly. - var assemblyName = new AssemblyName(typeof(LegacyProjectEngineFactory_1_1).Assembly.FullName); - assemblyName.Name = AssemblyName; - - var extension = new AssemblyExtension(configuration.ConfigurationName, Assembly.Load(assemblyName)); - var initializer = extension.CreateInitializer(); - - return RazorProjectEngine.Create(configuration, fileSystem, b => - { - initializer.Initialize(b); - configure?.Invoke(b); - }); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_2_0.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_2_0.cs deleted file mode 100644 index ebf9e144f5..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_2_0.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Reflection; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [ExportCustomProjectEngineFactory("MVC-2.0", SupportsSerialization = true)] - internal class LegacyProjectEngineFactory_2_0 : IProjectEngineFactory - { - private const string AssemblyName = "Microsoft.AspNetCore.Mvc.Razor.Extensions"; - public RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure) - { - // Rewrite the assembly name into a full name just like this one, but with the name of the MVC design time assembly. - var assemblyName = new AssemblyName(typeof(LegacyProjectEngineFactory_2_0).Assembly.FullName); - assemblyName.Name = AssemblyName; - - var extension = new AssemblyExtension(configuration.ConfigurationName, Assembly.Load(assemblyName)); - var initializer = extension.CreateInitializer(); - - return RazorProjectEngine.Create(configuration, fileSystem, b => - { - initializer.Initialize(b); - configure?.Invoke(b); - }); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_2_1.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_2_1.cs deleted file mode 100644 index df8d04667c..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/LegacyProjectEngineFactory_2_1.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Reflection; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - // Currently we provide a fixed configuration for 2.1, but this is a point-in-time issue. We plan - // to make the 2.1 configuration more flexible and less hardcoded. - [ExportCustomProjectEngineFactory("MVC-2.1", SupportsSerialization = true)] - internal class LegacyProjectEngineFactory_2_1 : IProjectEngineFactory - { - private const string AssemblyName = "Microsoft.AspNetCore.Mvc.Razor.Extensions"; - public RazorProjectEngine Create(RazorConfiguration configuration, RazorProjectFileSystem fileSystem, Action configure) - { - // Rewrite the assembly name into a full name just like this one, but with the name of the MVC design time assembly. - var assemblyName = new AssemblyName(typeof(LegacyProjectEngineFactory_2_1).Assembly.FullName); - assemblyName.Name = AssemblyName; - - var extension = new AssemblyExtension(configuration.ConfigurationName, Assembly.Load(assemblyName)); - var initializer = extension.CreateInitializer(); - - return RazorProjectEngine.Create(configuration, fileSystem, b => - { - initializer.Initialize(b); - configure?.Invoke(b); - }); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj deleted file mode 100644 index aa50d39965..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Microsoft.VisualStudio.Editor.Razor.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - net46 - Razor is a markup syntax for adding server-side logic to web pages. This package contains the Visual Studio agnostic Razor design-time infrastructure. - false - - - - - - - - - - - - - diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs deleted file mode 100644 index fce64fd49b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Properties/Resources.Designer.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Properties/Resources.Designer.cs deleted file mode 100644 index 922d049da8..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Properties/Resources.Designer.cs +++ /dev/null @@ -1,44 +0,0 @@ -// -namespace Microsoft.VisualStudio.Editor.Razor -{ - using System.Globalization; - using System.Reflection; - using System.Resources; - - internal static class Resources - { - private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.VisualStudio.Editor.Razor.Resources", typeof(Resources).GetTypeInfo().Assembly); - - /// - /// Value cannot be null or an empty string. - /// - internal static string ArgumentCannotBeNullOrEmpty - { - get => GetString("ArgumentCannotBeNullOrEmpty"); - } - - /// - /// Value cannot be null or an empty string. - /// - internal static string FormatArgumentCannotBeNullOrEmpty() - => GetString("ArgumentCannotBeNullOrEmpty"); - - private static string GetString(string name, params string[] formatterNames) - { - var value = _resourceManager.GetString(name); - - System.Diagnostics.Debug.Assert(value != null); - - if (formatterNames != null) - { - for (var i = 0; i < formatterNames.Length; i++) - { - value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); - } - } - - return value; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorCodeDocumentProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorCodeDocumentProvider.cs deleted file mode 100644 index be30691363..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorCodeDocumentProvider.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class RazorCodeDocumentProvider - { - public abstract bool TryGetFromDocument(TextDocument document, out RazorCodeDocument codeDocument); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs deleted file mode 100644 index c55dcc3776..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorDirectiveCompletionProvider.cs +++ /dev/null @@ -1,218 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.ComponentModel.Composition; -using System.Linq; -using System.Runtime.CompilerServices; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Completion; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Projection; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [System.Composition.Shared] - [Export(typeof(CompletionProvider))] - [ExportMetadata("Language", LanguageNames.CSharp)] - internal class RazorDirectiveCompletionProvider : CompletionProvider - { - // Internal for testing - internal static readonly string DescriptionKey = "Razor.Description"; - - private static readonly IEnumerable DefaultDirectives = new[] - { - CSharpCodeParser.AddTagHelperDirectiveDescriptor, - CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, - CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, - }; - private readonly Lazy _codeDocumentProvider; - - [ImportingConstructor] - public RazorDirectiveCompletionProvider([Import(typeof(RazorCodeDocumentProvider))] Lazy codeDocumentProvider) - { - if (codeDocumentProvider == null) - { - throw new ArgumentNullException(nameof(codeDocumentProvider)); - } - - _codeDocumentProvider = codeDocumentProvider; - } - - public override Task GetDescriptionAsync(Document document, CompletionItem item, CancellationToken cancellationToken) - { - if (document == null) - { - throw new ArgumentNullException(nameof(document)); - } - - if (item == null) - { - throw new ArgumentNullException(nameof(item)); - } - - var descriptionContent = new List(); - if (item.Properties.TryGetValue(DescriptionKey, out var directiveDescription)) - { - var descriptionText = new TaggedText(TextTags.Text, directiveDescription); - descriptionContent.Add(descriptionText); - } - - var completionDescription = CompletionDescription.Create(descriptionContent.ToImmutableArray()); - return Task.FromResult(completionDescription); - } - - public override Task ProvideCompletionsAsync(CompletionContext context) - { - if (context == null) - { - throw new ArgumentNullException(nameof(context)); - } - - // FilePath will be null when the editor is open for cases where we don't have a file on disk (C# interactive window and others). - if (context.Document?.FilePath == null || - !context.Document.FilePath.EndsWith(".cshtml", StringComparison.OrdinalIgnoreCase)) - { - // Not a Razor file. - return Task.CompletedTask; - } - - var result = AddCompletionItems(context); - - return result; - } - - // We do not want this inlined because the work done in this method requires Razor.Workspaces and Razor.Language assemblies. - // If those two assemblies were to load you'd have them load in every C# editor completion scenario. - [MethodImpl(MethodImplOptions.NoInlining)] - private Task AddCompletionItems(CompletionContext context) - { - if (!_codeDocumentProvider.Value.TryGetFromDocument(context.Document, out var codeDocument)) - { - // A Razor code document has not yet been associated with the document. - return Task.CompletedTask; - } - - var syntaxTree = codeDocument.GetSyntaxTree(); - if (syntaxTree == null) - { - // No syntax tree has been computed for the current document. - return Task.CompletedTask; - } - - if (!AtDirectiveCompletionPoint(syntaxTree, context)) - { - // Can't have a valid directive at the current location. - return Task.CompletedTask; - } - - var completionItems = GetCompletionItems(syntaxTree); - context.AddItems(completionItems); - - return Task.CompletedTask; - } - - // Internal virtual for testing - internal virtual IEnumerable GetCompletionItems(RazorSyntaxTree syntaxTree) - { - var directives = syntaxTree.Options.Directives.Concat(DefaultDirectives); - var completionItems = new List(); - foreach (var directive in directives) - { - var propertyDictionary = new Dictionary(StringComparer.Ordinal); - - if (!string.IsNullOrEmpty(directive.Description)) - { - propertyDictionary[DescriptionKey] = directive.Description; - } - - var completionItem = CompletionItem.Create( - directive.Directive, - // This groups all Razor directives together - sortText: "_RazorDirective_", - rules: CompletionItemRules.Create(formatOnCommit: false), - tags: ImmutableArray.Create(CompletionTags.Intrinsic), - properties: propertyDictionary.ToImmutableDictionary()); - completionItems.Add(completionItem); - } - - return completionItems; - } - - // Internal for testing - internal bool AtDirectiveCompletionPoint(RazorSyntaxTree syntaxTree, CompletionContext context) - { - if (TryGetRazorSnapshotPoint(context, out var razorSnapshotPoint)) - { - var change = new SourceChange(razorSnapshotPoint.Position, 0, string.Empty); - var owner = syntaxTree.Root.LocateOwner(change); - - if (owner == null) - { - return false; - } - - if (owner.ChunkGenerator is ExpressionChunkGenerator && - owner.Symbols.All(IsDirectiveCompletableSymbol) && - // Do not provide IntelliSense for explicit expressions. Explicit expressions will usually look like: - // [@] [(] [DateTime.Now] [)] - owner.Parent?.Children.Count > 1 && - owner.Parent.Children[1] == owner) - { - return true; - } - } - - return false; - } - - protected virtual bool TryGetRazorSnapshotPoint(CompletionContext context, out SnapshotPoint snapshotPoint) - { - snapshotPoint = default(SnapshotPoint); - - if (context.Document.TryGetText(out var sourceText)) - { - var textSnapshot = sourceText.FindCorrespondingEditorTextSnapshot(); - var projectionSnapshot = textSnapshot as IProjectionSnapshot; - - if (projectionSnapshot == null) - { - return false; - } - - var mappedPoints = projectionSnapshot.MapToSourceSnapshots(context.CompletionListSpan.Start); - var htmlSnapshotPoints = mappedPoints.Where(p => p.Snapshot.TextBuffer.IsRazorBuffer()); - - if (!htmlSnapshotPoints.Any()) - { - return false; - } - - snapshotPoint = htmlSnapshotPoints.First(); - return true; - } - - return false; - } - - private static bool IsDirectiveCompletableSymbol(AspNetCore.Razor.Language.Legacy.ISymbol symbol) - { - if (!(symbol is CSharpSymbol csharpSymbol)) - { - return false; - } - - return csharpSymbol.Type == CSharpSymbolType.Identifier || - // Marker symbol - csharpSymbol.Type == CSharpSymbolType.Unknown; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorDocumentManager.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorDocumentManager.cs deleted file mode 100644 index 2f4dd3c577..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorDocumentManager.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.CodeAnalysis.Host; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class RazorDocumentManager : ILanguageService - { - public abstract void OnTextViewOpened(ITextView textView, IEnumerable subjectBuffers); - - public abstract void OnTextViewClosed(ITextView textView, IEnumerable subjectBuffers); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorEditorFactoryService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorEditorFactoryService.cs deleted file mode 100644 index 8f298aed95..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorEditorFactoryService.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class RazorEditorFactoryService - { - public abstract bool TryGetDocumentTracker(ITextBuffer textBuffer, out VisualStudioDocumentTracker documentTracker); - - public abstract bool TryGetParser(ITextBuffer textBuffer, out VisualStudioRazorParser parser); - - internal abstract bool TryGetSmartIndenter(ITextBuffer textBuffer, out BraceSmartIndenter braceSmartIndenter); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorIndentationFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorIndentationFactsService.cs deleted file mode 100644 index 01f7e6f126..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorIndentationFactsService.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Host; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class RazorIndentationFactsService : ILanguageService - { - public abstract int? GetDesiredIndentation(RazorSyntaxTree syntaxTree, ITextSnapshot syntaxTreeSnapshot, ITextSnapshotLine line, int indentSize, int tabSize); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxFactsService.cs deleted file mode 100644 index fc47c81991..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxFactsService.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class RazorSyntaxFactsService : ILanguageService - { - public abstract IReadOnlyList GetClassifiedSpans(RazorSyntaxTree syntaxTree); - - public abstract IReadOnlyList GetTagHelperSpans(RazorSyntaxTree syntaxTree); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxFactsServiceExtensions.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxFactsServiceExtensions.cs deleted file mode 100644 index c64a0210d1..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxFactsServiceExtensions.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public static class RazorSyntaxFactsServiceExtensions - { - public static bool IsTagHelperSpan(this RazorSyntaxFactsService syntaxFactsService, RazorSyntaxTree syntaxTree, SourceSpan span) - { - if (syntaxFactsService == null) - { - throw new ArgumentNullException(nameof(syntaxFactsService)); - } - - if (syntaxTree == null) - { - // Extra hardening for the case that tooling hasn't retrieved a SyntaxTree yet. - return false; - } - - var tagHelperSpans = syntaxFactsService.GetTagHelperSpans(syntaxTree); - for (var i = 0; i < tagHelperSpans.Count; i++) - { - var tagHelperSpan = tagHelperSpans[i].Span; - if (tagHelperSpan.AbsoluteIndex == span.AbsoluteIndex && tagHelperSpan.Length == span.Length) - { - return true; - } - } - - return false; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxTreePartialParser.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxTreePartialParser.cs deleted file mode 100644 index 377351c959..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorSyntaxTreePartialParser.cs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Span = Microsoft.AspNetCore.Razor.Language.Legacy.Span; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class RazorSyntaxTreePartialParser - { - private Span _lastChangeOwner; - private bool _lastResultProvisional; - - public RazorSyntaxTreePartialParser(RazorSyntaxTree syntaxTree) - { - if (syntaxTree == null) - { - throw new ArgumentNullException(nameof(syntaxTree)); - } - - // We mutate the existing syntax tree so we need to clone the one passed in so our mutations don't - // impact external state. - SyntaxTreeRoot = (Block)syntaxTree.Root.Clone(); - } - - // Internal for testing - internal Block SyntaxTreeRoot { get; } - - public PartialParseResultInternal Parse(SourceChange change) - { - var result = GetPartialParseResult(change); - - // Remember if this was provisionally accepted for next partial parse. - _lastResultProvisional = (result & PartialParseResultInternal.Provisional) == PartialParseResultInternal.Provisional; - - return result; - } - - private PartialParseResultInternal GetPartialParseResult(SourceChange change) - { - var result = PartialParseResultInternal.Rejected; - - // Try the last change owner - if (_lastChangeOwner != null && _lastChangeOwner.EditHandler.OwnsChange(_lastChangeOwner, change)) - { - var editResult = _lastChangeOwner.EditHandler.ApplyChange(_lastChangeOwner, change); - result = editResult.Result; - if ((editResult.Result & PartialParseResultInternal.Rejected) != PartialParseResultInternal.Rejected) - { - _lastChangeOwner.ReplaceWith(editResult.EditedSpan); - } - - return result; - } - - // Locate the span responsible for this change - _lastChangeOwner = SyntaxTreeRoot.LocateOwner(change); - - if (_lastResultProvisional) - { - // Last change owner couldn't accept this, so we must do a full reparse - result = PartialParseResultInternal.Rejected; - } - else if (_lastChangeOwner != null) - { - var editResult = _lastChangeOwner.EditHandler.ApplyChange(_lastChangeOwner, change); - result = editResult.Result; - if ((editResult.Result & PartialParseResultInternal.Rejected) != PartialParseResultInternal.Rejected) - { - _lastChangeOwner.ReplaceWith(editResult.EditedSpan); - } - } - - return result; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorTextBufferProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorTextBufferProvider.cs deleted file mode 100644 index ed3479671b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorTextBufferProvider.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Host; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class RazorTextBufferProvider : ILanguageService - { - public abstract bool TryGetFromDocument(TextDocument document, out ITextBuffer textBuffer); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorTextViewConnectionListener.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorTextViewConnectionListener.cs deleted file mode 100644 index 53a4464b45..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/RazorTextViewConnectionListener.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.Utilities; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - [ContentType(RazorLanguage.CoreContentType)] - [TextViewRole(PredefinedTextViewRoles.Document)] - [Export(typeof(ITextViewConnectionListener))] - internal class RazorTextViewConnectionListener : ITextViewConnectionListener - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly RazorDocumentManager _documentManager; - - [ImportingConstructor] - public RazorTextViewConnectionListener(ForegroundDispatcher foregroundDispatcher, RazorDocumentManager documentManager) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (documentManager == null) - { - throw new ArgumentNullException(nameof(documentManager)); - } - - _foregroundDispatcher = foregroundDispatcher; - _documentManager = documentManager; - } - - public void SubjectBuffersConnected(ITextView textView, ConnectionReason reason, IReadOnlyCollection subjectBuffers) - { - if (textView == null) - { - throw new ArgumentException(nameof(textView)); - } - - if (subjectBuffers == null) - { - throw new ArgumentNullException(nameof(subjectBuffers)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - _documentManager.OnTextViewOpened(textView, subjectBuffers); - } - - public void SubjectBuffersDisconnected(ITextView textView, ConnectionReason reason, IReadOnlyCollection subjectBuffers) - { - if (textView == null) - { - throw new ArgumentException(nameof(textView)); - } - - if (subjectBuffers == null) - { - throw new ArgumentNullException(nameof(subjectBuffers)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - _documentManager.OnTextViewClosed(textView, subjectBuffers); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Resources.resx b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Resources.resx deleted file mode 100644 index 55a253ebbe..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/Resources.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Value cannot be null or an empty string. - - \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/SpanKind.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/SpanKind.cs deleted file mode 100644 index 8e66d13408..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/SpanKind.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public enum SpanKind - { - Transition, - MetaCode, - Comment, - Code, - Markup, - None - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperCompletionService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperCompletionService.cs deleted file mode 100644 index 61eb751796..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperCompletionService.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class TagHelperCompletionService - { - public abstract AttributeCompletionResult GetAttributeCompletions(AttributeCompletionContext completionContext); - - public abstract ElementCompletionResult GetElementCompletions(ElementCompletionContext completionContext); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperFactsService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperFactsService.cs deleted file mode 100644 index e7fd77279d..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperFactsService.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class TagHelperFactsService - { - public abstract TagHelperBinding GetTagHelperBinding(TagHelperDocumentContext documentContext, string tagName, IEnumerable> attributes, string parentTag, bool parentIsTagHelper); - - public abstract IEnumerable GetBoundTagHelperAttributes(TagHelperDocumentContext documentContext, string attributeName, TagHelperBinding binding); - - public abstract IReadOnlyList GetTagHelpersGivenTag(TagHelperDocumentContext documentContext, string tagName, string parentTag); - - public abstract IReadOnlyList GetTagHelpersGivenParent(TagHelperDocumentContext documentContext, string parentTag); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperSpan.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperSpan.cs deleted file mode 100644 index 15a88dee7a..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TagHelperSpan.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public struct TagHelperSpan - { - public TagHelperSpan(SourceSpan span, TagHelperBinding binding) - { - if (binding == null) - { - throw new ArgumentNullException(nameof(binding)); - } - - Span = span; - Binding = binding; - } - - public TagHelperBinding Binding { get; } - - public IEnumerable TagHelpers => Binding.Descriptors; - - public SourceSpan Span { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferCodeDocumentProvider.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferCodeDocumentProvider.cs deleted file mode 100644 index ac05e6d912..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferCodeDocumentProvider.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class TextBufferCodeDocumentProvider - { - public abstract bool TryGetFromBuffer(ITextBuffer textBuffer, out RazorCodeDocument codeDocument); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferExtensions.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferExtensions.cs deleted file mode 100644 index fcfefeb874..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferExtensions.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Text -{ - internal static class TextBufferExtensions - { - public static bool IsRazorBuffer(this ITextBuffer textBuffer) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - return textBuffer.ContentType.IsOfType(RazorLanguage.CoreContentType); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferProjectService.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferProjectService.cs deleted file mode 100644 index 30ba31714c..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextBufferProjectService.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class TextBufferProjectService - { - public abstract object GetHostProject(ITextBuffer textBuffer); - - public abstract bool IsSupportedProject(object project); - - public abstract string GetProjectPath(object project); - - public abstract string GetProjectName(object project); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextContentChangedEventArgsExtensions.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextContentChangedEventArgsExtensions.cs deleted file mode 100644 index 2e274ee885..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextContentChangedEventArgsExtensions.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; - -namespace Microsoft.VisualStudio.Text -{ - internal static class TextContentChangedEventArgsExtensions - { - public static bool TextChangeOccurred(this TextContentChangedEventArgs args, out (ITextChange firstChange, ITextChange lastChange, string newText, string oldText) changeInformation) - { - if (args.Changes.Count > 0) - { - var firstChange = args.Changes[0]; - var lastChange = args.Changes[args.Changes.Count - 1]; - var oldLength = lastChange.OldEnd - firstChange.OldPosition; - var newLength = lastChange.NewEnd - firstChange.NewPosition; - var newText = args.After.GetText(firstChange.NewPosition, newLength); - var oldText = args.Before.GetText(firstChange.OldPosition, oldLength); - - var wasChanged = true; - if (oldLength == newLength) - { - wasChanged = !string.Equals(oldText, newText, StringComparison.Ordinal); - } - - if (wasChanged) - { - changeInformation = (firstChange, lastChange, newText, oldText); - return true; - } - } - - changeInformation = default((ITextChange, ITextChange, string, string)); - return false; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextSnapshotProjectItem.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextSnapshotProjectItem.cs deleted file mode 100644 index 4a605fd4a4..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/TextSnapshotProjectItem.cs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Text; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal class TextSnapshotProjectItem : RazorProjectItem - { - private readonly ITextSnapshot _snapshot; - - public TextSnapshotProjectItem(ITextSnapshot snapshot, string projectDirectory, string relativeFilePath, string filePath) - { - if (snapshot == null) - { - throw new ArgumentNullException(nameof(snapshot)); - } - - if (string.IsNullOrEmpty(projectDirectory)) - { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(projectDirectory)); - } - - if (string.IsNullOrEmpty(relativeFilePath)) - { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(relativeFilePath)); - } - - if (string.IsNullOrEmpty(filePath)) - { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath)); - } - - _snapshot = snapshot; - BasePath = projectDirectory; - FilePath = relativeFilePath; - PhysicalPath = filePath; - } - - public override string BasePath { get; } - - public override string FilePath { get; } - - public override string PhysicalPath { get; } - - public override bool Exists => true; - - public override Stream Read() - { - var charArray = _snapshot.ToCharArray(0, _snapshot.Length); - - // We can assume UTF8 because the call path that reads from RazorProjectItem => SourceDocument - // can't determine the encoding and always assumes Encoding.UTF8. This is something that we might - // want to revisit in the future. - var bytes = Encoding.UTF8.GetBytes(charArray); - var memoryStream = new MemoryStream(bytes); - return memoryStream; - } - } - -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioCompletionBroker.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioCompletionBroker.cs deleted file mode 100644 index a86810b290..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioCompletionBroker.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Host; -using Microsoft.VisualStudio.Text.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class VisualStudioCompletionBroker : ILanguageService - { - public abstract bool IsCompletionActive(ITextView textView); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioDocumentTracker.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioDocumentTracker.cs deleted file mode 100644 index 7cde4da716..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioDocumentTracker.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.Editor; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class VisualStudioDocumentTracker - { - public abstract event EventHandler ContextChanged; - - public abstract RazorConfiguration Configuration { get; } - - public abstract EditorSettings EditorSettings { get; } - - public abstract IReadOnlyList TagHelpers { get; } - - public abstract bool IsSupportedProject { get; } - - public abstract string FilePath { get; } - - public abstract string ProjectPath { get; } - - public abstract Project Project { get; } - - public abstract Workspace Workspace { get; } - - public abstract ITextBuffer TextBuffer { get; } - - public abstract IReadOnlyList TextViews { get; } - - public abstract ITextView GetFocusedTextView(); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioDocumentTrackerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioDocumentTrackerFactory.cs deleted file mode 100644 index c17565dd72..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioDocumentTrackerFactory.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Host; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class VisualStudioDocumentTrackerFactory : ILanguageService - { - public abstract VisualStudioDocumentTracker Create(ITextBuffer textBuffer); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParser.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParser.cs deleted file mode 100644 index c1d71a6111..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParser.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public abstract class VisualStudioRazorParser - { - public abstract event EventHandler DocumentStructureChanged; - - public abstract string FilePath { get; } - - public abstract RazorCodeDocument CodeDocument { get; } - - public abstract ITextSnapshot Snapshot { get; } - - public abstract ITextBuffer TextBuffer { get; } - - public abstract bool HasPendingChanges { get; } - - public abstract void QueueReparse(); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParserFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParserFactory.cs deleted file mode 100644 index 7d30a46027..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioRazorParserFactory.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class VisualStudioRazorParserFactory : ILanguageService - { - public abstract VisualStudioRazorParser Create(VisualStudioDocumentTracker documentTracker); - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioWorkspaceAccessor.cs b/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioWorkspaceAccessor.cs deleted file mode 100644 index 70016569c2..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Editor.Razor/VisualStudioWorkspaceAccessor.cs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - internal abstract class VisualStudioWorkspaceAccessor - { - public abstract bool TryGetWorkspace(ITextBuffer textBuffer, out Workspace workspace); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTracker.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTracker.cs deleted file mode 100644 index e2d164e806..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTracker.cs +++ /dev/null @@ -1,141 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.Runtime.InteropServices; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - internal class DefaultFileChangeTracker : FileChangeTracker, IVsFileChangeEvents - { - private const uint FileChangeFlags = (uint)(_VSFILECHANGEFLAGS.VSFILECHG_Time | _VSFILECHANGEFLAGS.VSFILECHG_Size | _VSFILECHANGEFLAGS.VSFILECHG_Del | _VSFILECHANGEFLAGS.VSFILECHG_Add); - - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly ErrorReporter _errorReporter; - private readonly IVsFileChangeEx _fileChangeService; - private uint _fileChangeCookie; - - public override event EventHandler Changed; - - public DefaultFileChangeTracker( - string filePath, - ForegroundDispatcher foregroundDispatcher, - ErrorReporter errorReporter, - IVsFileChangeEx fileChangeService) - { - if (string.IsNullOrEmpty(filePath)) - { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath)); - } - - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (errorReporter == null) - { - throw new ArgumentNullException(nameof(errorReporter)); - } - - if (fileChangeService == null) - { - throw new ArgumentNullException(nameof(fileChangeService)); - } - - FilePath = filePath; - _foregroundDispatcher = foregroundDispatcher; - _errorReporter = errorReporter; - _fileChangeService = fileChangeService; - _fileChangeCookie = VSConstants.VSCOOKIE_NIL; - } - - public override string FilePath { get; } - - public override void StartListening() - { - _foregroundDispatcher.AssertForegroundThread(); - - try - { - if (_fileChangeCookie == VSConstants.VSCOOKIE_NIL) - { - var hr = _fileChangeService.AdviseFileChange( - FilePath, - FileChangeFlags, - this, - out _fileChangeCookie); - - Marshal.ThrowExceptionForHR(hr); - } - } - catch (Exception exception) - { - _errorReporter.ReportError(exception); - } - } - - public override void StopListening() - { - _foregroundDispatcher.AssertForegroundThread(); - - try - { - if (_fileChangeCookie != VSConstants.VSCOOKIE_NIL) - { - var hr = _fileChangeService.UnadviseFileChange(_fileChangeCookie); - Marshal.ThrowExceptionForHR(hr); - _fileChangeCookie = VSConstants.VSCOOKIE_NIL; - } - } - catch (Exception exception) - { - _errorReporter.ReportError(exception); - } - } - - public int FilesChanged(uint fileCount, string[] filePaths, uint[] fileChangeFlags) - { - _foregroundDispatcher.AssertForegroundThread(); - - foreach (var fileChangeFlag in fileChangeFlags) - { - var fileChangeKind = FileChangeKind.Changed; - var changeFlag = (_VSFILECHANGEFLAGS)fileChangeFlag; - if ((changeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Del) == _VSFILECHANGEFLAGS.VSFILECHG_Del) - { - fileChangeKind = FileChangeKind.Removed; - } - else if ((changeFlag & _VSFILECHANGEFLAGS.VSFILECHG_Add) == _VSFILECHANGEFLAGS.VSFILECHG_Add) - { - fileChangeKind = FileChangeKind.Added; - } - - // Purposefully not passing through the file paths here because we know this change has to do with this trackers FilePath. - // We use that FilePath instead so any path normalization the file service did does not impact callers. - OnChanged(fileChangeKind); - } - - return VSConstants.S_OK; - } - - public int DirectoryChanged(string pszDirectory) => VSConstants.S_OK; - - private void OnChanged(FileChangeKind changeKind) - { - _foregroundDispatcher.AssertForegroundThread(); - - if (Changed == null) - { - return; - } - - var args = new FileChangeEventArgs(FilePath, changeKind); - Changed.Invoke(this, args); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactory.cs deleted file mode 100644 index 6c6515be4a..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactory.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - internal partial class DefaultFileChangeTrackerFactory : FileChangeTrackerFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly ErrorReporter _errorReporter; - private readonly IVsFileChangeEx _fileChangeService; - - public DefaultFileChangeTrackerFactory( - ForegroundDispatcher foregroundDispatcher, - ErrorReporter errorReporter, - IVsFileChangeEx fileChangeService) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (errorReporter == null) - { - throw new ArgumentNullException(nameof(errorReporter)); - } - - if (fileChangeService == null) - { - throw new ArgumentNullException(nameof(fileChangeService)); - } - - _foregroundDispatcher = foregroundDispatcher; - _errorReporter = errorReporter; - _fileChangeService = fileChangeService; - } - - public override FileChangeTracker Create(string filePath) - { - if (string.IsNullOrEmpty(filePath)) - { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath)); - } - - var fileChangeTracker = new DefaultFileChangeTracker(filePath, _foregroundDispatcher, _errorReporter, _fileChangeService); - return fileChangeTracker; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs deleted file mode 100644 index 4ecc2a7230..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(FileChangeTrackerFactory), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultFileChangeTrackerFactoryFactory : ILanguageServiceFactory - { - private readonly IVsFileChangeEx _fileChangeService; - private readonly ForegroundDispatcher _foregroundDispatcher; - - [ImportingConstructor] - public DefaultFileChangeTrackerFactoryFactory(ForegroundDispatcher foregroundDispatcher, SVsServiceProvider serviceProvider) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (serviceProvider == null) - { - throw new ArgumentNullException(nameof(serviceProvider)); - } - - _foregroundDispatcher = foregroundDispatcher; - _fileChangeService = serviceProvider.GetService(typeof(SVsFileChangeEx)) as IVsFileChangeEx; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - var errorReporter = languageServices.WorkspaceServices.GetRequiredService(); - return new DefaultFileChangeTrackerFactory(_foregroundDispatcher, errorReporter, _fileChangeService); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultRazorEngineDirectiveResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultRazorEngineDirectiveResolver.cs deleted file mode 100644 index 9c1eadae88..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultRazorEngineDirectiveResolver.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System; -using System.Collections.Generic; -using System.Composition; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - [Export(typeof(IRazorEngineDirectiveResolver))] - internal class DefaultRazorEngineDirectiveResolver : IRazorEngineDirectiveResolver - { - public async Task> GetRazorEngineDirectivesAsync(Workspace workspace, Project project, CancellationToken cancellationToken = default(CancellationToken)) - { - try - { - var client = await RazorLanguageServiceClientFactory.CreateAsync(workspace, cancellationToken); - - using (var session = await client.CreateSessionAsync(project.Solution)) - { - var directives = await session.InvokeAsync>("GetDirectivesAsync", new object[] { project.Id.Id, "Foo", }, cancellationToken).ConfigureAwait(false); - return directives; - } - } - catch (Exception exception) - { - throw new InvalidOperationException( - Resources.FormatUnexpectedException( - typeof(DefaultRazorEngineDirectiveResolver).FullName, - nameof(GetRazorEngineDirectivesAsync)), - exception); - } - } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultRazorEngineDocumentGenerator.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultRazorEngineDocumentGenerator.cs deleted file mode 100644 index b7c0cce061..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultRazorEngineDocumentGenerator.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System; -using System.Composition; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - [Export(typeof(IRazorEngineDocumentGenerator))] - internal class DefaultRazorEngineDocumentGenerator : IRazorEngineDocumentGenerator - { - public async Task GenerateDocumentAsync(Workspace workspace, Project project, string filePath, string text, CancellationToken cancellationToken = default(CancellationToken)) - { - try - { - var client = await RazorLanguageServiceClientFactory.CreateAsync(workspace, cancellationToken); - - using (var session = await client.CreateSessionAsync(project.Solution)) - { - var document = await session.InvokeAsync("GenerateDocumentAsync", new object[] { project.Id.Id, "Foo", filePath, text }, cancellationToken).ConfigureAwait(false); - return document; - } - } - catch (Exception exception) - { - throw new InvalidOperationException( - Resources.FormatUnexpectedException( - typeof(DefaultRazorEngineDocumentGenerator).FullName, - nameof(GenerateDocumentAsync)), - exception); - } - } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultVisualStudioWorkspaceAccessor.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultVisualStudioWorkspaceAccessor.cs deleted file mode 100644 index 0e9079b84e..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/DefaultVisualStudioWorkspaceAccessor.cs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using System.Linq; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Projection; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - [System.Composition.Shared] - [Export(typeof(VisualStudioWorkspaceAccessor))] - internal class DefaultVisualStudioWorkspaceAccessor : VisualStudioWorkspaceAccessor - { - private readonly IBufferGraphFactoryService _bufferGraphService; - private readonly TextBufferProjectService _projectService; - private readonly Workspace _defaultWorkspace; - - [ImportingConstructor] - public DefaultVisualStudioWorkspaceAccessor( - IBufferGraphFactoryService bufferGraphService, - TextBufferProjectService projectService, - [Import(typeof(VisualStudioWorkspace))] Workspace defaultWorkspace) - { - if (bufferGraphService == null) - { - throw new ArgumentNullException(nameof(bufferGraphService)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - if (defaultWorkspace == null) - { - throw new ArgumentNullException(nameof(defaultWorkspace)); - } - - _bufferGraphService = bufferGraphService; - _projectService = projectService; - _defaultWorkspace = defaultWorkspace; - } - - public override bool TryGetWorkspace(ITextBuffer textBuffer, out Workspace workspace) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - // We do a best effort approach in this method to get the workspace that belongs to the TextBuffer. - // The approaches we take to find the workspace are: - // - // 1. Look for a C# projection buffer associated with the Razor buffer. If we can find one we let - // Roslyn take control of finding the Workspace (projectionBuffer.GetWorkspace()). If not, - // fall back to determining if we can use the default workspace. - // 2. Look to see if this ITextBuffer is associated with a host project. If we find that our Razor - // buffer has a host project, we make the assumption that we should use the default VisualStudioWorkspace. - - if (TryGetWorkspaceFromProjectionBuffer(textBuffer, out workspace)) - { - return true; - } - - if (TryGetWorkspaceFromHostProject(textBuffer, out workspace)) - { - return true; - } - - workspace = null; - return false; - } - - // Internal virtual for testing - internal virtual bool TryGetWorkspaceFromProjectionBuffer(ITextBuffer textBuffer, out Workspace workspace) - { - var graph = _bufferGraphService.CreateBufferGraph(textBuffer); - var projectedCSharpBuffer = graph.GetTextBuffers(buffer => buffer.ContentType.IsOfType("CSharp")).FirstOrDefault(); - - if (projectedCSharpBuffer == null) - { - workspace = null; - return false; - } - - workspace = projectedCSharpBuffer.GetWorkspace(); - if (workspace == null) - { - // Couldn't resolve a workspace for the projected csharp buffer. - return false; - } - - return true; - } - - // Internal virtual for testing - internal virtual bool TryGetWorkspaceFromHostProject(ITextBuffer textBuffer, out Workspace workspace) - { - var project = _projectService.GetHostProject(textBuffer); - - if (project == null) - { - // Could not locate a project for the given text buffer. - workspace = null; - return false; - } - - // We have a host project, assume default workspace. - workspace = _defaultWorkspace; - return true; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultTextBufferProjectService.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultTextBufferProjectService.cs deleted file mode 100644 index aeafcec345..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultTextBufferProjectService.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using System.Diagnostics; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor -{ - /// - /// Infrastructure methods to find project information from an . - /// - [System.Composition.Shared] - [Export(typeof(TextBufferProjectService))] - internal class DefaultTextBufferProjectService : TextBufferProjectService - { - private const string DotNetCoreCapability = "(CSharp|VB)&CPS"; - - private readonly RunningDocumentTable _documentTable; - private readonly ITextDocumentFactoryService _documentFactory; - - [ImportingConstructor] - public DefaultTextBufferProjectService( - [Import(typeof(SVsServiceProvider))] IServiceProvider services, - ITextDocumentFactoryService documentFactory) - { - if (services == null) - { - throw new ArgumentNullException(nameof(services)); - } - - if (documentFactory == null) - { - throw new ArgumentNullException(nameof(documentFactory)); - } - - _documentFactory = documentFactory; - _documentTable = new RunningDocumentTable(services); - } - - public override object GetHostProject(ITextBuffer textBuffer) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - // If there's no document we can't find the FileName, or look for a matching hierarchy. - if (!_documentFactory.TryGetTextDocument(textBuffer, out var textDocument)) - { - return null; - } - - _documentTable.FindDocument(textDocument.FilePath, out var hierarchy, out uint itemId, out uint cookie); - - // We don't currently try to look a Roslyn ProjectId at this point, we just want to know some - // basic things. - // See https://github.com/dotnet/roslyn/blob/4e3db2b7a0732d45a720e9ed00c00cd22ab67a14/src/VisualStudio/Core/SolutionExplorerShim/HierarchyItemToProjectIdMap.cs#L47 - // for a more complete implementation. - return hierarchy; - } - - public override string GetProjectPath(object project) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - var hierarchy = project as IVsHierarchy; - Debug.Assert(hierarchy != null); - - ErrorHandler.ThrowOnFailure(((IVsProject)hierarchy).GetMkDocument((uint)VSConstants.VSITEMID.Root, out var path), VSConstants.E_NOTIMPL); - return path; - } - - public override bool IsSupportedProject(object project) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - var hierarchy = project as IVsHierarchy; - Debug.Assert(hierarchy != null); - - try - { - return hierarchy.IsCapabilityMatch(DotNetCoreCapability); - } - catch (NotSupportedException) - { - // IsCapabilityMatch throws a NotSupportedException if it can't create a BooleanSymbolExpressionEvaluator COM object - } - catch (ObjectDisposedException) - { - // IsCapabilityMatch throws an ObjectDisposedException if the underlying hierarchy has been disposed. - } - - return false; - } - - public override string GetProjectName(object project) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - var hierarchy = project as IVsHierarchy; - Debug.Assert(hierarchy != null); - - if (ErrorHandler.Failed(hierarchy.GetProperty((uint)VSConstants.VSITEMID.Root, (int)__VSHPROPID.VSHPROPID_Name, out var name))) - { - return null; - } - - return (string)name; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs deleted file mode 100644 index 577035aa9d..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Language.Intellisense; -using Microsoft.VisualStudio.Text.Editor; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor -{ - internal class DefaultVisualStudioCompletionBroker : VisualStudioCompletionBroker - { - private readonly ICompletionBroker _completionBroker; - - public DefaultVisualStudioCompletionBroker(ICompletionBroker completionBroker) - { - if (completionBroker == null) - { - throw new ArgumentNullException(nameof(completionBroker)); - } - - _completionBroker = completionBroker; - } - - public override bool IsCompletionActive(ITextView textView) - { - if (textView == null) - { - throw new ArgumentNullException(nameof(textView)); - } - - var completionIsActive = _completionBroker.IsCompletionActive(textView); - return completionIsActive; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs deleted file mode 100644 index f0c6086f99..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Language.Intellisense; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Editor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(VisualStudioCompletionBroker), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultVisualStudioCompletionBrokerFactory : ILanguageServiceFactory - { - private readonly ICompletionBroker _completionBroker; - - [ImportingConstructor] - public DefaultVisualStudioCompletionBrokerFactory(ICompletionBroker completionBroker) - { - if (completionBroker == null) - { - throw new ArgumentNullException(nameof(completionBroker)); - } - - _completionBroker = completionBroker; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - return new DefaultVisualStudioCompletionBroker(_completionBroker); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRazorEngineDirectiveResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRazorEngineDirectiveResolver.cs deleted file mode 100644 index c884eedca1..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRazorEngineDirectiveResolver.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - internal interface IRazorEngineDirectiveResolver - { - Task> GetRazorEngineDirectivesAsync(Workspace workspace, Project project, CancellationToken cancellationToken = default(CancellationToken)); - } -} -#endif \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRazorEngineDocumentGenerator.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRazorEngineDocumentGenerator.cs deleted file mode 100644 index 4b39c82bdb..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRazorEngineDocumentGenerator.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - internal interface IRazorEngineDocumentGenerator - { - Task GenerateDocumentAsync(Workspace workspace, Project project, string filePath, string text, CancellationToken cancellationToken = default(CancellationToken)); - } -} -#endif \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj deleted file mode 100644 index a3bbd0f3c9..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Microsoft.VisualStudio.LanguageServices.Razor.csproj +++ /dev/null @@ -1,117 +0,0 @@ - - - - net46 - Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure for Visual Studio. - false - ..\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Rules\ - - - - $(DefineConstants);RAZOR_EXTENSION_DEVELOPER_MODE - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ProjectSystem\Rules\RazorConfiguration.xaml - - - ProjectSystem\Rules\RazorExtension.xaml - - - ProjectSystem\Rules\RazorGeneral.xaml - - - XamlRuleToCode:RazorConfiguration.xaml - - - XamlRuleToCode:RazorExtension.xaml - - - XamlRuleToCode:RazorGeneral.xaml - - - - - Designer - MSBuild:GenerateRuleSourceFromXaml - Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules - RazorProjectProperties - - ProjectSystem\Rules\ - - - Designer - MSBuild:GenerateRuleSourceFromXaml - Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules - RazorProjectProperties - ProjectSystem\Rules\ - - - Designer - MSBuild:GenerateRuleSourceFromXaml - Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules - RazorProjectProperties - ProjectSystem\Rules\ - - - - - ProjectSystem\Rules\RazorConfiguration.xaml - - - ProjectSystem\Rules\RazorExtension.xaml - - - ProjectSystem\Rules\RazorGeneral.xaml - - - - - - - - - - diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/OOPTagHelperResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/OOPTagHelperResolver.cs deleted file mode 100644 index c1e2ae56c7..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/OOPTagHelperResolver.cs +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Editor.Razor; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - internal class OOPTagHelperResolver : TagHelperResolver - { - private readonly DefaultTagHelperResolver _defaultResolver; - private readonly RazorProjectEngineFactoryService _engineFactory; - private readonly ErrorReporter _errorReporter; - private readonly Workspace _workspace; - - public OOPTagHelperResolver(RazorProjectEngineFactoryService engineFactory, ErrorReporter errorReporter, Workspace workspace) - { - if (engineFactory == null) - { - throw new ArgumentNullException(nameof(engineFactory)); - } - - if (errorReporter == null) - { - throw new ArgumentNullException(nameof(errorReporter)); - } - - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - _engineFactory = engineFactory; - _errorReporter = errorReporter; - _workspace = workspace; - - _defaultResolver = new DefaultTagHelperResolver(_engineFactory); - } - - public override async Task GetTagHelpersAsync(ProjectSnapshot project, CancellationToken cancellationToken = default) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (project.Configuration == null || project.WorkspaceProject == null) - { - return TagHelperResolutionResult.Empty; - } - - // Not every custom factory supports the OOP host. Our priority system should work like this: - // - // 1. Use custom factory out of process - // 2. Use custom factory in process - // 3. Use fallback factory in process - // - // Calling into RazorTemplateEngineFactoryService.Create will accomplish #2 and #3 in one step. - var factory = _engineFactory.FindSerializableFactory(project); - - try - { - TagHelperResolutionResult result = null; - if (factory != null) - { - result = await ResolveTagHelpersOutOfProcessAsync(factory, project); - } - - if (result == null) - { - // Was unable to get tag helpers OOP, fallback to default behavior. - result = await ResolveTagHelpersInProcessAsync(project); - } - - return result; - } - catch (Exception exception) - { - throw new InvalidOperationException( - Resources.FormatUnexpectedException( - typeof(DefaultTagHelperResolver).FullName, - nameof(GetTagHelpersAsync)), - exception); - } - } - - protected virtual async Task ResolveTagHelpersOutOfProcessAsync(IProjectEngineFactory factory, ProjectSnapshot project) - { - // We're being overly defensive here because the OOP host can return null for the client/session/operation - // when it's disconnected (user stops the process). - // - // This will change in the future to an easier to consume API but for VS RTM this is what we have. - try - { - var client = await RazorLanguageServiceClientFactory.CreateAsync(_workspace, CancellationToken.None); - if (client != null) - { - using (var session = await client.CreateSessionAsync(project.WorkspaceProject.Solution)) - { - if (session != null) - { - var args = new object[] - { - Serialize(project), - factory == null ? null : factory.GetType().AssemblyQualifiedName, - }; - - var json = await session.InvokeAsync("GetTagHelpersAsync", args, CancellationToken.None).ConfigureAwait(false); - return Deserialize(json); - } - } - } - } - catch (Exception ex) - { - // We silence exceptions from the OOP host because we don't want to bring down VS for an OOP failure. - // We will retry all failures in process anyway, so if there's a real problem that isn't unique to OOP - // then it will report a crash in VS. - _errorReporter.ReportError(ex, project); - } - - return null; - } - - protected virtual Task ResolveTagHelpersInProcessAsync(ProjectSnapshot project) - { - return _defaultResolver.GetTagHelpersAsync(project); - } - - private JObject Serialize(ProjectSnapshot snapshot) - { - var serializer = new JsonSerializer(); - serializer.Converters.RegisterRazorConverters(); - - return JObject.FromObject(snapshot, serializer); - } - - private TagHelperResolutionResult Deserialize(JObject jsonObject) - { - var serializer = new JsonSerializer(); - serializer.Converters.RegisterRazorConverters(); - - using (var reader = jsonObject.CreateReader()) - { - return serializer.Deserialize(reader); - } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/OOPTagHelperResolverFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/OOPTagHelperResolverFactory.cs deleted file mode 100644 index b6b4e93d52..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/OOPTagHelperResolverFactory.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(TagHelperResolver), RazorLanguage.Name, ServiceLayer.Host)] - internal class OOPTagHelperResolverFactory : ILanguageServiceFactory - { - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - return new OOPTagHelperResolver( - languageServices.GetRequiredService(), - languageServices.WorkspaceServices.GetRequiredService(), - languageServices.WorkspaceServices.Workspace); - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs deleted file mode 100644 index 5e45f9821f..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs +++ /dev/null @@ -1,266 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.ComponentModel.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using System.Threading.Tasks.Dataflow; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.Properties; -using ProjectState = System.Collections.Immutable.IImmutableDictionary; -using ProjectStateItem = System.Collections.Generic.KeyValuePair>; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - // Somewhat similar to https://github.com/dotnet/project-system/blob/fa074d228dcff6dae9e48ce43dd4a3a5aa22e8f0/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/LanguageServices/LanguageServiceHost.cs - // - // This class is responsible for intializing the Razor ProjectSnapshotManager for cases where - // MSBuild provides configuration support (>= 2.1). - [AppliesTo("DotNetCoreRazor & DotNetCoreRazorConfiguration")] - [Export(ExportContractNames.Scopes.UnconfiguredProject, typeof(IProjectDynamicLoadComponent))] - internal class DefaultRazorProjectHost : RazorProjectHostBase - { - private IDisposable _subscription; - - [ImportingConstructor] - public DefaultRazorProjectHost( - IUnconfiguredProjectCommonServices commonServices, - [Import(typeof(VisualStudioWorkspace))] Workspace workspace) - : base(commonServices, workspace) - { - } - - // Internal for testing - internal DefaultRazorProjectHost( - IUnconfiguredProjectCommonServices commonServices, - Workspace workspace, - ProjectSnapshotManagerBase projectManager) - : base(commonServices, workspace, projectManager) - { - } - - protected override async Task InitializeCoreAsync(CancellationToken cancellationToken) - { - await base.InitializeCoreAsync(cancellationToken).ConfigureAwait(false); - - // Don't try to evaluate any properties here since the project is still loading and we require access - // to the UI thread to push our updates. - // - // Just subscribe and handle the notification later. - // Don't try to evaluate any properties here since the project is still loading and we require access - // to the UI thread to push our updates. - // - // Just subscribe and handle the notification later. - var receiver = new ActionBlock>(OnProjectChanged); - _subscription = CommonServices.ActiveConfiguredProjectSubscription.JointRuleSource.SourceBlock.LinkTo( - receiver, - initialDataAsNew: true, - suppressVersionOnlyUpdates: true, - ruleNames: new string[] { Rules.RazorGeneral.SchemaName, Rules.RazorConfiguration.SchemaName, Rules.RazorExtension.SchemaName }); - } - - protected override async Task DisposeCoreAsync(bool initialized) - { - await base.DisposeCoreAsync(initialized).ConfigureAwait(false); - - if (initialized) - { - _subscription.Dispose(); - } - } - - // Internal for testing - internal async Task OnProjectChanged(IProjectVersionedValue update) - { - if (IsDisposing || IsDisposed) - { - return; - } - - await CommonServices.TasksService.LoadedProjectAsync(async () => - { - await ExecuteWithLock(async () => - { - if (TryGetConfiguration(update.Value.CurrentState, out var configuration)) - { - var hostProject = new HostProject(CommonServices.UnconfiguredProject.FullPath, configuration); - await UpdateProjectUnsafeAsync(hostProject).ConfigureAwait(false); - } - else - { - // Ok we can't find a configuration. Let's assume this project isn't using Razor then. - await UpdateProjectUnsafeAsync(null).ConfigureAwait(false); - } - }); - }, registerFaultHandler: true); - } - - // Internal for testing - internal static bool TryGetConfiguration( - ProjectState projectState, - out RazorConfiguration configuration) - { - if (!TryGetDefaultConfiguration(projectState, out var defaultConfiguration)) - { - configuration = null; - return false; - } - - if (!TryGetLanguageVersion(projectState, out var languageVersion)) - { - configuration = null; - return false; - } - - if (!TryGetConfigurationItem(defaultConfiguration, projectState, out var configurationItem)) - { - configuration = null; - return false; - } - - if (!TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionNames)) - { - configuration = null; - return false; - } - - if (!TryGetExtensions(configuredExtensionNames, projectState, out var extensions)) - { - configuration = null; - return false; - } - - configuration = new ProjectSystemRazorConfiguration(languageVersion, configurationItem.Key, extensions); - return true; - } - - - // Internal for testing - internal static bool TryGetDefaultConfiguration(ProjectState projectState, out string defaultConfiguration) - { - if (!projectState.TryGetValue(Rules.RazorGeneral.SchemaName, out var rule)) - { - defaultConfiguration = null; - return false; - } - - if (!rule.Properties.TryGetValue(Rules.RazorGeneral.RazorDefaultConfigurationProperty, out defaultConfiguration)) - { - defaultConfiguration = null; - return false; - } - - if (string.IsNullOrEmpty(defaultConfiguration)) - { - defaultConfiguration = null; - return false; - } - - return true; - } - - // Internal for testing - internal static bool TryGetLanguageVersion(ProjectState projectState, out RazorLanguageVersion languageVersion) - { - if (!projectState.TryGetValue(Rules.RazorGeneral.SchemaName, out var rule)) - { - languageVersion = null; - return false; - } - - if (!rule.Properties.TryGetValue(Rules.RazorGeneral.RazorLangVersionProperty, out var languageVersionValue)) - { - languageVersion = null; - return false; - } - - if (string.IsNullOrEmpty(languageVersionValue)) - { - languageVersion = null; - return false; - } - - if (!RazorLanguageVersion.TryParse(languageVersionValue, out languageVersion)) - { - languageVersion = RazorLanguageVersion.Latest; - } - - return true; - } - - // Internal for testing - internal static bool TryGetConfigurationItem( - string configuration, - ProjectState projectState, - out ProjectStateItem configurationItem) - { - if (!projectState.TryGetValue(Rules.RazorConfiguration.PrimaryDataSourceItemType, out var configurationState)) - { - configurationItem = default(ProjectStateItem); - return false; - } - - var razorConfigurationItems = configurationState.Items; - foreach (var item in razorConfigurationItems) - { - if (item.Key == configuration) - { - configurationItem = item; - return true; - } - } - - configurationItem = default(ProjectStateItem); - return false; - } - - // Internal for testing - internal static bool TryGetConfiguredExtensionNames(ProjectStateItem configurationItem, out string[] configuredExtensionNames) - { - if (!configurationItem.Value.TryGetValue(Rules.RazorConfiguration.ExtensionsProperty, out var extensionNamesValue)) - { - configuredExtensionNames = null; - return false; - } - - if (string.IsNullOrEmpty(extensionNamesValue)) - { - configuredExtensionNames = null; - return false; - } - - configuredExtensionNames = extensionNamesValue.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); - return true; - } - - // Internal for testing - internal static bool TryGetExtensions(string[] configuredExtensionNames, ProjectState projectState, out ProjectSystemRazorExtension[] extensions) - { - if (!projectState.TryGetValue(Rules.RazorExtension.PrimaryDataSourceItemType, out var extensionState)) - { - extensions = null; - return false; - } - - var extensionItems = extensionState.Items; - var extensionList = new List(); - foreach (var item in extensionItems) - { - var extensionName = item.Key; - if (configuredExtensionNames.Contains(extensionName)) - { - extensionList.Add(new ProjectSystemRazorExtension(extensionName)); - } - } - - extensions = extensionList.ToArray(); - return true; - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs deleted file mode 100644 index 8e7fb4d493..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs +++ /dev/null @@ -1,146 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using System.IO; -using System.Reflection.Metadata; -using System.Reflection.PortableExecutable; -using System.Threading; -using System.Threading.Tasks; -using System.Threading.Tasks.Dataflow; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.ProjectSystem; -using ResolvedCompilationReference = Microsoft.CodeAnalysis.Razor.ProjectSystem.ManageProjectSystemSchema.ResolvedCompilationReference; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - // Somewhat similar to https://github.com/dotnet/project-system/blob/fa074d228dcff6dae9e48ce43dd4a3a5aa22e8f0/src/Microsoft.VisualStudio.ProjectSystem.Managed/ProjectSystem/LanguageServices/LanguageServiceHost.cs - // - // This class is responsible for intializing the Razor ProjectSnapshotManager for cases where - // MSBuild does not provides configuration support (SDK < 2.1). - [AppliesTo("(DotNetCoreRazor | DotNetCoreWeb) & !DotNetCoreRazorConfiguration")] - [Export(ExportContractNames.Scopes.UnconfiguredProject, typeof(IProjectDynamicLoadComponent))] - internal class FallbackRazorProjectHost : RazorProjectHostBase - { - private const string MvcAssemblyName = "Microsoft.AspNetCore.Mvc.Razor"; - private const string MvcAssemblyFileName = "Microsoft.AspNetCore.Mvc.Razor.dll"; - - private IDisposable _subscription; - - [ImportingConstructor] - public FallbackRazorProjectHost( - IUnconfiguredProjectCommonServices commonServices, - [Import(typeof(VisualStudioWorkspace))] Workspace workspace) - : base(commonServices, workspace) - { - } - - // Internal for testing - internal FallbackRazorProjectHost( - IUnconfiguredProjectCommonServices commonServices, - Workspace workspace, - ProjectSnapshotManagerBase projectManager) - : base(commonServices, workspace, projectManager) - { - } - - protected override async Task InitializeCoreAsync(CancellationToken cancellationToken) - { - await base.InitializeCoreAsync(cancellationToken).ConfigureAwait(false); - - // Don't try to evaluate any properties here since the project is still loading and we require access - // to the UI thread to push our updates. - // - // Just subscribe and handle the notification later. - var receiver = new ActionBlock>(OnProjectChanged); - _subscription = CommonServices.ActiveConfiguredProjectSubscription.JointRuleSource.SourceBlock.LinkTo( - receiver, - initialDataAsNew: true, - suppressVersionOnlyUpdates: true, - ruleNames: new string[] { ResolvedCompilationReference.SchemaName }, - linkOptions: new DataflowLinkOptions() { PropagateCompletion = true }); - } - - protected override async Task DisposeCoreAsync(bool initialized) - { - await base.DisposeCoreAsync(initialized).ConfigureAwait(false); - - if (initialized) - { - _subscription.Dispose(); - } - } - - // Internal for testing - internal async Task OnProjectChanged(IProjectVersionedValue update) - { - if (IsDisposing || IsDisposed) - { - return; - } - - await CommonServices.TasksService.LoadedProjectAsync(async () => - { - await ExecuteWithLock(async () => - { - string mvcReferenceFullPath = null; - var references = update.Value.CurrentState[ResolvedCompilationReference.SchemaName].Items; - foreach (var reference in references) - { - if (reference.Key.EndsWith(MvcAssemblyFileName, StringComparison.OrdinalIgnoreCase)) - { - mvcReferenceFullPath = reference.Key; - break; - } - } - - if (mvcReferenceFullPath == null) - { - // Ok we can't find an MVC version. Let's assume this project isn't using Razor then. - await UpdateProjectUnsafeAsync(null).ConfigureAwait(false); - return; - } - - var version = GetAssemblyVersion(mvcReferenceFullPath); - if (version == null) - { - // Ok we can't find an MVC version. Let's assume this project isn't using Razor then. - await UpdateProjectUnsafeAsync(null).ConfigureAwait(false); - return; - } - - var configuration = FallbackRazorConfiguration.SelectConfiguration(version); - var hostProject = new HostProject(CommonServices.UnconfiguredProject.FullPath, configuration); - await UpdateProjectUnsafeAsync(hostProject).ConfigureAwait(false); - }); - }, registerFaultHandler: true); - } - - // virtual for overriding in tests - protected virtual Version GetAssemblyVersion(string filePath) - { - return ReadAssemblyVersion(filePath); - } - - private static Version ReadAssemblyVersion(string filePath) - { - try - { - using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete)) - using (var reader = new PEReader(stream)) - { - var metadataReader = reader.GetMetadataReader(); - - var assemblyDefinition = metadataReader.GetAssemblyDefinition(); - return assemblyDefinition.Version; - } - } - catch - { - // We're purposely silencing any kinds of I/O exceptions here, just in case something wacky is going on. - return null; - } - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IUnconfiguredProjectCommonServices.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IUnconfiguredProjectCommonServices.cs deleted file mode 100644 index f520a6e046..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/IUnconfiguredProjectCommonServices.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.References; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - // This defines the set of services that we frequently need for working with UnconfiguredProject. - // - // We're following a somewhat common pattern for code that uses CPS. It's really easy to end up - // relying on service location inside CPS, which can be hard to test. This approach makes it easy - // for us to build reusable mocks instead. - internal interface IUnconfiguredProjectCommonServices - { - ConfiguredProject ActiveConfiguredProject { get; } - - IAssemblyReferencesService ActiveConfiguredProjectAssemblyReferences { get; } - - IPackageReferencesService ActiveConfiguredProjectPackageReferences { get; } - - Rules.RazorProjectProperties ActiveConfiguredProjectRazorProperties { get; } - - IActiveConfiguredProjectSubscriptionService ActiveConfiguredProjectSubscription { get; } - - IProjectAsynchronousTasksService TasksService { get; } - - IProjectThreadingService ThreadingService { get; } - - UnconfiguredProject UnconfiguredProject { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ManageProjectSystemSchema.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ManageProjectSystemSchema.cs deleted file mode 100644 index 79138c8ac6..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/ManageProjectSystemSchema.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - // Well-Known Schema and property names defined by the ManagedProjectSystem - internal static class ManageProjectSystemSchema - { - public static class ResolvedCompilationReference - { - public static readonly string SchemaName = "ResolvedCompilationReference"; - - public static readonly string ItemName = "ResolvedCompilationReference"; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs deleted file mode 100644 index 5419eb73af..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.Threading; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal abstract class RazorProjectHostBase : OnceInitializedOnceDisposedAsync, IProjectDynamicLoadComponent - { - private readonly Workspace _workspace; - private readonly AsyncSemaphore _lock; - - private ProjectSnapshotManagerBase _projectManager; - private HostProject _current; - - public RazorProjectHostBase( - IUnconfiguredProjectCommonServices commonServices, - [Import(typeof(VisualStudioWorkspace))] Workspace workspace) - : base(commonServices.ThreadingService.JoinableTaskContext) - { - if (commonServices == null) - { - throw new ArgumentNullException(nameof(commonServices)); - } - - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - CommonServices = commonServices; - _workspace = workspace; - - _lock = new AsyncSemaphore(initialCount: 1); - } - - // Internal for testing - protected RazorProjectHostBase( - IUnconfiguredProjectCommonServices commonServices, - Workspace workspace, - ProjectSnapshotManagerBase projectManager) - : base(commonServices.ThreadingService.JoinableTaskContext) - { - if (commonServices == null) - { - throw new ArgumentNullException(nameof(commonServices)); - } - - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - if (projectManager == null) - { - throw new ArgumentNullException(nameof(projectManager)); - } - - CommonServices = commonServices; - _workspace = workspace; - _projectManager = projectManager; - - _lock = new AsyncSemaphore(initialCount: 1); - } - - protected IUnconfiguredProjectCommonServices CommonServices { get; } - - // internal for tests. The product will call through the IProjectDynamicLoadComponent interface. - internal Task LoadAsync() - { - return InitializeAsync(); - } - - protected override Task InitializeCoreAsync(CancellationToken cancellationToken) - { - CommonServices.UnconfiguredProject.ProjectRenaming += UnconfiguredProject_ProjectRenaming; - - return Task.CompletedTask; - } - - protected override async Task DisposeCoreAsync(bool initialized) - { - if (initialized) - { - CommonServices.UnconfiguredProject.ProjectRenaming -= UnconfiguredProject_ProjectRenaming; - - await ExecuteWithLock(async () => - { - if (_current != null) - { - await UpdateProjectUnsafeAsync(null).ConfigureAwait(false); - } - }); - } - } - - // Internal for tests - internal async Task OnProjectRenamingAsync() - { - // When a project gets renamed we expect any rules watched by the derived class to fire. - // - // However, the project snapshot manager uses the project Fullpath as the key. We want to just - // reinitialize the HostProject with the same configuration and settings here, but the updated - // FilePath. - await ExecuteWithLock(async () => - { - if (_current != null) - { - var old = _current; - await UpdateProjectUnsafeAsync(null).ConfigureAwait(false); - - var filePath = CommonServices.UnconfiguredProject.FullPath; - await UpdateProjectUnsafeAsync(new HostProject(filePath, old.Configuration)).ConfigureAwait(false); - } - }); - } - - // Should only be called from the UI thread. - private ProjectSnapshotManagerBase GetProjectManager() - { - CommonServices.ThreadingService.VerifyOnUIThread(); - - if (_projectManager == null) - { - _projectManager = (ProjectSnapshotManagerBase)_workspace.Services.GetLanguageServices(RazorLanguage.Name).GetRequiredService(); - } - - return _projectManager; - } - - // Must be called inside the lock. - protected async Task UpdateProjectUnsafeAsync(HostProject project) - { - await CommonServices.ThreadingService.SwitchToUIThread(); - var projectManager = GetProjectManager(); - - if (_current == null && project == null) - { - // This is a no-op. This project isn't using Razor. - } - else if (_current == null && project != null) - { - projectManager.HostProjectAdded(project); - } - else if (_current != null && project == null) - { - projectManager.HostProjectRemoved(_current); - } - else - { - projectManager.HostProjectChanged(project); - } - - _current = project; - } - - protected async Task ExecuteWithLock(Func func) - { - using (JoinableCollection.Join()) - { - using (await _lock.EnterAsync().ConfigureAwait(false)) - { - var task = JoinableFactory.RunAsync(func); - await task.Task.ConfigureAwait(false); - } - } - } - - Task IProjectDynamicLoadComponent.LoadAsync() - { - return InitializeAsync(); - } - - Task IProjectDynamicLoadComponent.UnloadAsync() - { - return DisposeAsync(); - } - - private async Task UnconfiguredProject_ProjectRenaming(object sender, ProjectRenamedEventArgs args) - { - await OnProjectRenamingAsync().ConfigureAwait(false); - } - } -} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.cs deleted file mode 100644 index d8c2484f5b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.cs +++ /dev/null @@ -1,212 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules { - - - internal partial class RazorConfiguration { - - /// Backing field for deserialized rule.. - private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule; - - /// The name of the schema to look for at runtime to fulfill property access. - internal const string SchemaName = "RazorConfiguration"; - - /// The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource. - internal const string PrimaryDataSourceItemType = "RazorConfiguration"; - - /// The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource. - internal const string PrimaryDataSourceLabel = ""; - - /// Razor Extensions (The "Extensions" property). - internal const string ExtensionsProperty = "Extensions"; - - /// Backing field for the property. - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule; - - /// Backing field for the file name of the rule property. - private string file; - - /// Backing field for the ItemType property. - private string itemType; - - /// Backing field for the ItemName property. - private string itemName; - - /// Configured Project - private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject; - - /// The dictionary of named catalogs. - private System.Collections.Immutable.IImmutableDictionary catalogs; - - /// Backing field for the property. - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule; - - /// Thread locking object - private object locker = new object(); - - /// Initializes a new instance of the RazorConfiguration class. - internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule) { - this.rule = rule; - } - - /// Initializes a new instance of the RazorConfiguration class. - internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs, string context, string file, string itemType, string itemName) : - this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName)) { - if ((configuredProject == null)) { - throw new System.ArgumentNullException("configuredProject"); - } - this.configuredProject = configuredProject; - this.catalogs = catalogs; - this.file = file; - this.itemType = itemType; - this.itemName = itemName; - } - - /// Initializes a new instance of the RazorConfiguration class. - internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) : - this(rule) { - if ((rule == null)) { - throw new System.ArgumentNullException("rule"); - } - if ((configuredProject == null)) { - throw new System.ArgumentNullException("configuredProject"); - } - this.configuredProject = configuredProject; - this.rule = rule; - this.file = this.rule.File; - this.itemType = this.rule.ItemType; - this.itemName = this.rule.ItemName; - } - - /// Initializes a new instance of the RazorConfiguration class. - internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) : - this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName) { - } - - /// Initializes a new instance of the RazorConfiguration class that assumes a project context (neither property sheet nor items). - internal RazorConfiguration(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs) : - this(configuredProject, catalogs, "Project", null, null, null) { - } - - /// Gets the IRule used to get and set properties. - public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule { - get { - return this.rule; - } - } - - /// Razor Extensions - internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty Extensions { - get { - Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; - if ((localRule == null)) { - localRule = this.GeneratedFallbackRule; - } - if ((localRule == null)) { - return null; - } - Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExtensionsProperty))); - if (((property == null) - && (this.GeneratedFallbackRule != null))) { - localRule = this.GeneratedFallbackRule; - property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(ExtensionsProperty))); - } - return property; - } - } - - /// Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule { - get { - if (((this.fallbackRule == null) - && (this.configuredProject != null))) { - System.Threading.Monitor.Enter(this.locker); - try { - if ((this.fallbackRule == null)) { - this.InitializeFallbackRule(); - } - } - finally { - System.Threading.Monitor.Exit(this.locker); - } - } - return this.fallbackRule; - } - } - - private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) { - if ((catalog == null)) { - return null; - } - return catalog.BindToContext(SchemaName, file, itemType, itemName); - } - - private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext) { - if ((propertiesContext.IsProjectFile == true)) { - return null; - } - else { - return propertiesContext.File; - } - } - - private void InitializeFallbackRule() { - if ((this.configuredProject == null)) { - return; - } - Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorConfiguration.deserializedFallbackRule; - if ((unboundRule == null)) { - System.IO.Stream xamlStream = null; - System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); - try { - xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorConfiguration.xaml"); - Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream))); - System.Collections.Generic.IEnumerator ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator(); - for ( - ; ((unboundRule == null) - && ruleEnumerator.MoveNext()); - ) { - Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current)); - if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) { - unboundRule = t; - unboundRule.Name = "30e71838-2cb8-4c67-ab28-7670763124af"; - RazorConfiguration.deserializedFallbackRule = unboundRule; - } - } - } - finally { - if ((xamlStream != null)) { - ((System.IDisposable)(xamlStream)).Dispose(); - } - } - } - this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext"); - Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext"); - this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName); - } - } - - internal partial class RazorProjectProperties { - - private static System.Func>, object, RazorConfiguration> CreateRazorConfigurationPropertiesDelegate = new System.Func>, object, RazorConfiguration>(CreateRazorConfigurationProperties); - - private static RazorConfiguration CreateRazorConfigurationProperties(System.Threading.Tasks.Task> namedCatalogs, object state) { - RazorProjectProperties that = ((RazorProjectProperties)(state)); - return new RazorConfiguration(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName); - } - - /// Gets the strongly-typed property accessor used to get and set Configuration Properties properties. - internal System.Threading.Tasks.Task GetRazorConfigurationPropertiesAsync() { - System.Threading.Tasks.Task> namedCatalogsTask = this.GetNamedCatalogsAsync(); - return namedCatalogsTask.ContinueWith(CreateRazorConfigurationPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.xaml b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.xaml deleted file mode 100644 index 9632054a75..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorConfiguration.xaml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.cs deleted file mode 100644 index 0ce503811b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.cs +++ /dev/null @@ -1,235 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules { - - - internal partial class RazorExtension { - - /// Backing field for deserialized rule.. - private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule; - - /// The name of the schema to look for at runtime to fulfill property access. - internal const string SchemaName = "RazorExtension"; - - /// The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource. - internal const string PrimaryDataSourceItemType = "RazorExtension"; - - /// The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource. - internal const string PrimaryDataSourceLabel = ""; - - /// Razor Extension Assembly Name (The "AssemblyName" property). - internal const string AssemblyNameProperty = "AssemblyName"; - - /// Razor Extension Assembly File Path (The "AssemblyFilePath" property). - internal const string AssemblyFilePathProperty = "AssemblyFilePath"; - - /// Backing field for the property. - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule; - - /// Backing field for the file name of the rule property. - private string file; - - /// Backing field for the ItemType property. - private string itemType; - - /// Backing field for the ItemName property. - private string itemName; - - /// Configured Project - private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject; - - /// The dictionary of named catalogs. - private System.Collections.Immutable.IImmutableDictionary catalogs; - - /// Backing field for the property. - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule; - - /// Thread locking object - private object locker = new object(); - - /// Initializes a new instance of the RazorExtension class. - internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule) { - this.rule = rule; - } - - /// Initializes a new instance of the RazorExtension class. - internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs, string context, string file, string itemType, string itemName) : - this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName)) { - if ((configuredProject == null)) { - throw new System.ArgumentNullException("configuredProject"); - } - this.configuredProject = configuredProject; - this.catalogs = catalogs; - this.file = file; - this.itemType = itemType; - this.itemName = itemName; - } - - /// Initializes a new instance of the RazorExtension class. - internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) : - this(rule) { - if ((rule == null)) { - throw new System.ArgumentNullException("rule"); - } - if ((configuredProject == null)) { - throw new System.ArgumentNullException("configuredProject"); - } - this.configuredProject = configuredProject; - this.rule = rule; - this.file = this.rule.File; - this.itemType = this.rule.ItemType; - this.itemName = this.rule.ItemName; - } - - /// Initializes a new instance of the RazorExtension class. - internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) : - this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName) { - } - - /// Initializes a new instance of the RazorExtension class that assumes a project context (neither property sheet nor items). - internal RazorExtension(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs) : - this(configuredProject, catalogs, "Project", null, null, null) { - } - - /// Gets the IRule used to get and set properties. - public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule { - get { - return this.rule; - } - } - - /// Razor Extension Assembly Name - internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty AssemblyName { - get { - Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; - if ((localRule == null)) { - localRule = this.GeneratedFallbackRule; - } - if ((localRule == null)) { - return null; - } - Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyNameProperty))); - if (((property == null) - && (this.GeneratedFallbackRule != null))) { - localRule = this.GeneratedFallbackRule; - property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyNameProperty))); - } - return property; - } - } - - /// Razor Extension Assembly File Path - internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty AssemblyFilePath { - get { - Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; - if ((localRule == null)) { - localRule = this.GeneratedFallbackRule; - } - if ((localRule == null)) { - return null; - } - Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyFilePathProperty))); - if (((property == null) - && (this.GeneratedFallbackRule != null))) { - localRule = this.GeneratedFallbackRule; - property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(AssemblyFilePathProperty))); - } - return property; - } - } - - /// Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule { - get { - if (((this.fallbackRule == null) - && (this.configuredProject != null))) { - System.Threading.Monitor.Enter(this.locker); - try { - if ((this.fallbackRule == null)) { - this.InitializeFallbackRule(); - } - } - finally { - System.Threading.Monitor.Exit(this.locker); - } - } - return this.fallbackRule; - } - } - - private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) { - if ((catalog == null)) { - return null; - } - return catalog.BindToContext(SchemaName, file, itemType, itemName); - } - - private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext) { - if ((propertiesContext.IsProjectFile == true)) { - return null; - } - else { - return propertiesContext.File; - } - } - - private void InitializeFallbackRule() { - if ((this.configuredProject == null)) { - return; - } - Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorExtension.deserializedFallbackRule; - if ((unboundRule == null)) { - System.IO.Stream xamlStream = null; - System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); - try { - xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorExtension.xaml"); - Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream))); - System.Collections.Generic.IEnumerator ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator(); - for ( - ; ((unboundRule == null) - && ruleEnumerator.MoveNext()); - ) { - Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current)); - if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) { - unboundRule = t; - unboundRule.Name = "6b577687-703b-41a1-8f5f-c44644f65f2a"; - RazorExtension.deserializedFallbackRule = unboundRule; - } - } - } - finally { - if ((xamlStream != null)) { - ((System.IDisposable)(xamlStream)).Dispose(); - } - } - } - this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext"); - Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext"); - this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName); - } - } - - internal partial class RazorProjectProperties { - - private static System.Func>, object, RazorExtension> CreateRazorExtensionPropertiesDelegate = new System.Func>, object, RazorExtension>(CreateRazorExtensionProperties); - - private static RazorExtension CreateRazorExtensionProperties(System.Threading.Tasks.Task> namedCatalogs, object state) { - RazorProjectProperties that = ((RazorProjectProperties)(state)); - return new RazorExtension(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName); - } - - /// Gets the strongly-typed property accessor used to get and set Extension Properties properties. - internal System.Threading.Tasks.Task GetRazorExtensionPropertiesAsync() { - System.Threading.Tasks.Task> namedCatalogsTask = this.GetNamedCatalogsAsync(); - return namedCatalogsTask.ContinueWith(CreateRazorExtensionPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.xaml b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.xaml deleted file mode 100644 index f68eef7107..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorExtension.xaml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.cs deleted file mode 100644 index 860fb1a80b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.cs +++ /dev/null @@ -1,235 +0,0 @@ -//------------------------------------------------------------------------------ -// -// This code was generated by a tool. -// Runtime Version:4.0.30319.42000 -// -// Changes to this file may cause incorrect behavior and will be lost if -// the code is regenerated. -// -//------------------------------------------------------------------------------ - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules { - - - internal partial class RazorGeneral { - - /// Backing field for deserialized rule.. - private static Microsoft.Build.Framework.XamlTypes.Rule deserializedFallbackRule; - - /// The name of the schema to look for at runtime to fulfill property access. - internal const string SchemaName = "RazorGeneral"; - - /// The ItemType given in the Rule.DataSource property. May not apply to every Property's individual DataSource. - internal const string PrimaryDataSourceItemType = null; - - /// The Label given in the Rule.DataSource property. May not apply to every Property's individual DataSource. - internal const string PrimaryDataSourceLabel = ""; - - /// Razor Language Version (The "RazorLangVersion" property). - internal const string RazorLangVersionProperty = "RazorLangVersion"; - - /// Razor Configuration Name (The "RazorDefaultConfiguration" property). - internal const string RazorDefaultConfigurationProperty = "RazorDefaultConfiguration"; - - /// Backing field for the property. - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule; - - /// Backing field for the file name of the rule property. - private string file; - - /// Backing field for the ItemType property. - private string itemType; - - /// Backing field for the ItemName property. - private string itemName; - - /// Configured Project - private Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject; - - /// The dictionary of named catalogs. - private System.Collections.Immutable.IImmutableDictionary catalogs; - - /// Backing field for the property. - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule fallbackRule; - - /// Thread locking object - private object locker = new object(); - - /// Initializes a new instance of the RazorGeneral class. - internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule) { - this.rule = rule; - } - - /// Initializes a new instance of the RazorGeneral class. - internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs, string context, string file, string itemType, string itemName) : - this(GetRule(System.Collections.Immutable.ImmutableDictionary.GetValueOrDefault(catalogs, context), file, itemType, itemName)) { - if ((configuredProject == null)) { - throw new System.ArgumentNullException("configuredProject"); - } - this.configuredProject = configuredProject; - this.catalogs = catalogs; - this.file = file; - this.itemType = itemType; - this.itemName = itemName; - } - - /// Initializes a new instance of the RazorGeneral class. - internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.Properties.IRule rule, Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject) : - this(rule) { - if ((rule == null)) { - throw new System.ArgumentNullException("rule"); - } - if ((configuredProject == null)) { - throw new System.ArgumentNullException("configuredProject"); - } - this.configuredProject = configuredProject; - this.rule = rule; - this.file = this.rule.File; - this.itemType = this.rule.ItemType; - this.itemName = this.rule.ItemName; - } - - /// Initializes a new instance of the RazorGeneral class. - internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs, string context, Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertyContext) : - this(configuredProject, catalogs, context, GetContextFile(propertyContext), propertyContext.ItemType, propertyContext.ItemName) { - } - - /// Initializes a new instance of the RazorGeneral class that assumes a project context (neither property sheet nor items). - internal RazorGeneral(Microsoft.VisualStudio.ProjectSystem.ConfiguredProject configuredProject, System.Collections.Immutable.IImmutableDictionary catalogs) : - this(configuredProject, catalogs, "Project", null, null, null) { - } - - /// Gets the IRule used to get and set properties. - public Microsoft.VisualStudio.ProjectSystem.Properties.IRule Rule { - get { - return this.rule; - } - } - - /// Razor Language Version - internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty RazorLangVersion { - get { - Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; - if ((localRule == null)) { - localRule = this.GeneratedFallbackRule; - } - if ((localRule == null)) { - return null; - } - Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorLangVersionProperty))); - if (((property == null) - && (this.GeneratedFallbackRule != null))) { - localRule = this.GeneratedFallbackRule; - property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorLangVersionProperty))); - } - return property; - } - } - - /// Razor Configuration Name - internal Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty RazorDefaultConfiguration { - get { - Microsoft.VisualStudio.ProjectSystem.Properties.IRule localRule = this.rule; - if ((localRule == null)) { - localRule = this.GeneratedFallbackRule; - } - if ((localRule == null)) { - return null; - } - Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorDefaultConfigurationProperty))); - if (((property == null) - && (this.GeneratedFallbackRule != null))) { - localRule = this.GeneratedFallbackRule; - property = ((Microsoft.VisualStudio.ProjectSystem.Properties.IEvaluatedProperty)(localRule.GetProperty(RazorDefaultConfigurationProperty))); - } - return property; - } - } - - /// Get the fallback rule if the current rule on disk is missing or a property in the rule on disk is missing - private Microsoft.VisualStudio.ProjectSystem.Properties.IRule GeneratedFallbackRule { - get { - if (((this.fallbackRule == null) - && (this.configuredProject != null))) { - System.Threading.Monitor.Enter(this.locker); - try { - if ((this.fallbackRule == null)) { - this.InitializeFallbackRule(); - } - } - finally { - System.Threading.Monitor.Exit(this.locker); - } - } - return this.fallbackRule; - } - } - - private static Microsoft.VisualStudio.ProjectSystem.Properties.IRule GetRule(Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog, string file, string itemType, string itemName) { - if ((catalog == null)) { - return null; - } - return catalog.BindToContext(SchemaName, file, itemType, itemName); - } - - private static string GetContextFile(Microsoft.VisualStudio.ProjectSystem.Properties.IProjectPropertiesContext propertiesContext) { - if ((propertiesContext.IsProjectFile == true)) { - return null; - } - else { - return propertiesContext.File; - } - } - - private void InitializeFallbackRule() { - if ((this.configuredProject == null)) { - return; - } - Microsoft.Build.Framework.XamlTypes.Rule unboundRule = RazorGeneral.deserializedFallbackRule; - if ((unboundRule == null)) { - System.IO.Stream xamlStream = null; - System.Reflection.Assembly thisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); - try { - xamlStream = thisAssembly.GetManifestResourceStream("XamlRuleToCode:RazorGeneral.xaml"); - Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode root = ((Microsoft.Build.Framework.XamlTypes.IProjectSchemaNode)(System.Xaml.XamlServices.Load(xamlStream))); - System.Collections.Generic.IEnumerator ruleEnumerator = root.GetSchemaObjects(typeof(Microsoft.Build.Framework.XamlTypes.Rule)).GetEnumerator(); - for ( - ; ((unboundRule == null) - && ruleEnumerator.MoveNext()); - ) { - Microsoft.Build.Framework.XamlTypes.Rule t = ((Microsoft.Build.Framework.XamlTypes.Rule)(ruleEnumerator.Current)); - if (System.StringComparer.OrdinalIgnoreCase.Equals(t.Name, SchemaName)) { - unboundRule = t; - unboundRule.Name = "e0400917-b7e9-4731-b3e6-447b229db9d4"; - RazorGeneral.deserializedFallbackRule = unboundRule; - } - } - } - finally { - if ((xamlStream != null)) { - ((System.IDisposable)(xamlStream)).Dispose(); - } - } - } - this.configuredProject.Services.AdditionalRuleDefinitions.AddRuleDefinition(unboundRule, "FallbackRuleCodeGenerationContext"); - Microsoft.VisualStudio.ProjectSystem.Properties.IPropertyPagesCatalog catalog = this.configuredProject.Services.PropertyPagesCatalog.GetMemoryOnlyCatalog("FallbackRuleCodeGenerationContext"); - this.fallbackRule = catalog.BindToContext(unboundRule.Name, this.file, this.itemType, this.itemName); - } - } - - internal partial class RazorProjectProperties { - - private static System.Func>, object, RazorGeneral> CreateRazorGeneralPropertiesDelegate = new System.Func>, object, RazorGeneral>(CreateRazorGeneralProperties); - - private static RazorGeneral CreateRazorGeneralProperties(System.Threading.Tasks.Task> namedCatalogs, object state) { - RazorProjectProperties that = ((RazorProjectProperties)(state)); - return new RazorGeneral(that.ConfiguredProject, namedCatalogs.Result, "Project", that.File, that.ItemType, that.ItemName); - } - - /// Gets the strongly-typed property accessor used to get and set Razor Properties properties. - internal System.Threading.Tasks.Task GetRazorGeneralPropertiesAsync() { - System.Threading.Tasks.Task> namedCatalogsTask = this.GetNamedCatalogsAsync(); - return namedCatalogsTask.ContinueWith(CreateRazorGeneralPropertiesDelegate, this, System.Threading.CancellationToken.None, System.Threading.Tasks.TaskContinuationOptions.ExecuteSynchronously, System.Threading.Tasks.TaskScheduler.Default); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.xaml b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.xaml deleted file mode 100644 index a2e5150160..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorGeneral.xaml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorProjectProperties.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorProjectProperties.cs deleted file mode 100644 index cc8f28a6f1..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/Rules/RazorProjectProperties.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.Composition; -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.Properties; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem.Rules -{ - [Export] - internal partial class RazorProjectProperties : StronglyTypedPropertyAccess - { - [ImportingConstructor] - public RazorProjectProperties(ConfiguredProject configuredProject) - : base(configuredProject) - { - } - - public RazorProjectProperties(ConfiguredProject configuredProject, UnconfiguredProject unconfiguredProject) - : base(configuredProject, unconfiguredProject) - { - } - - public RazorProjectProperties(ConfiguredProject configuredProject, IProjectPropertiesContext projectPropertiesContext) - : base(configuredProject, projectPropertiesContext) - { - } - - public RazorProjectProperties(ConfiguredProject configuredProject, string file, string itemType, string itemName) - : base(configuredProject, file, itemType, itemName) - { - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/UnconfiguredProjectCommonServices.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/UnconfiguredProjectCommonServices.cs deleted file mode 100644 index d84595a1c3..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/ProjectSystem/UnconfiguredProjectCommonServices.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.References; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - [Export(typeof(IUnconfiguredProjectCommonServices))] - internal class UnconfiguredProjectCommonServices : IUnconfiguredProjectCommonServices - { - private readonly ActiveConfiguredProject _activeConfiguredProject; - private readonly ActiveConfiguredProject _activeConfiguredProjectAssemblyReferences; - private readonly ActiveConfiguredProject _activeConfiguredProjectPackageReferences; - private readonly ActiveConfiguredProject _activeConfiguredProjectProperties; - - [ImportingConstructor] - public UnconfiguredProjectCommonServices( - [Import(ExportContractNames.Scopes.UnconfiguredProject)] IProjectAsynchronousTasksService tasksService, - IProjectThreadingService threadingService, - UnconfiguredProject unconfiguredProject, - IActiveConfiguredProjectSubscriptionService activeConfiguredProjectSubscription, - ActiveConfiguredProject activeConfiguredProject, - ActiveConfiguredProject activeConfiguredProjectAssemblyReferences, - ActiveConfiguredProject activeConfiguredProjectPackageReferences, - ActiveConfiguredProject activeConfiguredProjectRazorProperties) - { - if (tasksService == null) - { - throw new ArgumentNullException(nameof(tasksService)); - } - - if (threadingService == null) - { - throw new ArgumentNullException(nameof(threadingService)); - } - - if (unconfiguredProject == null) - { - throw new ArgumentNullException(nameof(unconfiguredProject)); - } - - if (activeConfiguredProjectSubscription == null) - { - throw new ArgumentNullException(nameof(ActiveConfiguredProjectSubscription)); - } - - if (activeConfiguredProject == null) - { - throw new ArgumentNullException(nameof(activeConfiguredProject)); - } - - if (activeConfiguredProjectAssemblyReferences == null) - { - throw new ArgumentNullException(nameof(activeConfiguredProjectAssemblyReferences)); - } - - if (activeConfiguredProjectPackageReferences == null) - { - throw new ArgumentNullException(nameof(activeConfiguredProjectPackageReferences)); - } - - if (activeConfiguredProjectRazorProperties == null) - { - throw new ArgumentNullException(nameof(activeConfiguredProjectRazorProperties)); - } - - TasksService = tasksService; - ThreadingService = threadingService; - UnconfiguredProject = unconfiguredProject; - ActiveConfiguredProjectSubscription = activeConfiguredProjectSubscription; - _activeConfiguredProject = activeConfiguredProject; - _activeConfiguredProjectAssemblyReferences = activeConfiguredProjectAssemblyReferences; - _activeConfiguredProjectPackageReferences = activeConfiguredProjectPackageReferences; - _activeConfiguredProjectProperties = activeConfiguredProjectRazorProperties; - } - - public ConfiguredProject ActiveConfiguredProject => _activeConfiguredProject.Value; - - public IAssemblyReferencesService ActiveConfiguredProjectAssemblyReferences => _activeConfiguredProjectAssemblyReferences.Value; - - public IPackageReferencesService ActiveConfiguredProjectPackageReferences => _activeConfiguredProjectPackageReferences.Value; - - public Rules.RazorProjectProperties ActiveConfiguredProjectRazorProperties => _activeConfiguredProjectProperties.Value; - - public IActiveConfiguredProjectSubscriptionService ActiveConfiguredProjectSubscription { get; } - - public IProjectAsynchronousTasksService TasksService { get; } - - public IProjectThreadingService ThreadingService { get; } - - public UnconfiguredProject UnconfiguredProject { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Properties/AssemblyInfo.cs deleted file mode 100644 index a827ebd2da..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Properties/Resources.Designer.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Properties/Resources.Designer.cs deleted file mode 100644 index 2237686c54..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Properties/Resources.Designer.cs +++ /dev/null @@ -1,58 +0,0 @@ -// -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - using System.Globalization; - using System.Reflection; - using System.Resources; - - internal static class Resources - { - private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.VisualStudio.LanguageServices.Razor.Resources", typeof(Resources).GetTypeInfo().Assembly); - - /// - /// Value cannot be null or an empty string. - /// - internal static string ArgumentCannotBeNullOrEmpty - { - get => GetString("ArgumentCannotBeNullOrEmpty"); - } - - /// - /// Value cannot be null or an empty string. - /// - internal static string FormatArgumentCannotBeNullOrEmpty() - => GetString("ArgumentCannotBeNullOrEmpty"); - - /// - /// An unexpected exception occurred when invoking '{0}.{1}' on the Razor language service. - /// - internal static string UnexpectedException - { - get => GetString("UnexpectedException"); - } - - /// - /// An unexpected exception occurred when invoking '{0}.{1}' on the Razor language service. - /// - internal static string FormatUnexpectedException(object p0, object p1) - => string.Format(CultureInfo.CurrentCulture, GetString("UnexpectedException"), p0, p1); - - private static string GetString(string name, params string[] formatterNames) - { - var value = _resourceManager.GetString(name); - - System.Diagnostics.Debug.Assert(value != null); - - if (formatterNames != null) - { - for (var i = 0; i < formatterNames.Length; i++) - { - value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); - } - } - - return value; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorEngineDocument.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorEngineDocument.cs deleted file mode 100644 index 6e0de2da42..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorEngineDocument.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - internal class RazorEngineDocument - { - public string Text { get; set; } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Resources.resx b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Resources.resx deleted file mode 100644 index 87f559339f..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Resources.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Value cannot be null or an empty string. - - - An unexpected exception occurred when invoking '{0}.{1}' on the Razor language service. - - \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/JsonConverterCollectionExtensions.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/JsonConverterCollectionExtensions.cs deleted file mode 100644 index 1f008fd63d..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/JsonConverterCollectionExtensions.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.VisualStudio.LanguageServices.Razor.Serialization; -using Newtonsoft.Json; - -namespace Microsoft.CodeAnalysis.Razor -{ - internal static class JsonConverterCollectionExtensions - { - public static void RegisterRazorConverters(this JsonConverterCollection collection) - { - if (collection == null) - { - throw new ArgumentNullException(nameof(collection)); - } - - collection.Add(TagHelperDescriptorJsonConverter.Instance); - collection.Add(RazorDiagnosticJsonConverter.Instance); - collection.Add(RazorExtensionJsonConverter.Instance); - collection.Add(RazorConfigurationJsonConverter.Instance); - collection.Add(ProjectSnapshotJsonConverter.Instance); - collection.Add(ProjectSnapshotHandleJsonConverter.Instance); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotHandle.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotHandle.cs deleted file mode 100644 index d186db2ec8..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotHandle.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal sealed class ProjectSnapshotHandle - { - public ProjectSnapshotHandle(string filePath, RazorConfiguration configuration, ProjectId workspaceProjectId) - { - if (filePath == null) - { - throw new ArgumentNullException(nameof(filePath)); - } - - FilePath = filePath; - Configuration = configuration; - WorkspaceProjectId = workspaceProjectId; - } - - public RazorConfiguration Configuration { get; } - - public string FilePath { get; } - - public ProjectId WorkspaceProjectId { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotHandleJsonConverter.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotHandleJsonConverter.cs deleted file mode 100644 index 5b72763912..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotHandleJsonConverter.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Serialization -{ - internal class ProjectSnapshotHandleJsonConverter : JsonConverter - { - public static readonly ProjectSnapshotHandleJsonConverter Instance = new ProjectSnapshotHandleJsonConverter(); - - public override bool CanConvert(Type objectType) - { - return typeof(ProjectSnapshotHandle).IsAssignableFrom(objectType); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType != JsonToken.StartObject) - { - return null; - } - - var obj = JObject.Load(reader); - var filePath = obj[nameof(ProjectSnapshotHandle.FilePath)].Value(); - var configuration = obj[nameof(ProjectSnapshotHandle.Configuration)].ToObject(serializer); - - var id = obj[nameof(ProjectSnapshotHandle.WorkspaceProjectId)].Value(); - var workspaceProjectId = id == null ? null : ProjectId.CreateFromSerialized(Guid.Parse(id)); - - return new ProjectSnapshotHandle(filePath, configuration, workspaceProjectId); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var handle = (ProjectSnapshotHandle)value; - - writer.WriteStartObject(); - - writer.WritePropertyName(nameof(ProjectSnapshotHandle.FilePath)); - writer.WriteValue(handle.FilePath); - - if (handle.Configuration == null) - { - writer.WritePropertyName(nameof(ProjectSnapshotHandle.Configuration)); - writer.WriteNull(); - } - else - { - writer.WritePropertyName(nameof(ProjectSnapshotHandle.Configuration)); - serializer.Serialize(writer, handle.Configuration); - } - - if (handle.WorkspaceProjectId == null) - { - writer.WritePropertyName(nameof(ProjectSnapshotHandle.WorkspaceProjectId)); - writer.WriteNull(); - } - else - { - writer.WritePropertyName(nameof(ProjectSnapshotHandle.WorkspaceProjectId)); - writer.WriteValue(handle.WorkspaceProjectId.Id); - } - - writer.WriteEndObject(); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotJsonConverter.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotJsonConverter.cs deleted file mode 100644 index 988d42b44d..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/ProjectSnapshotJsonConverter.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Newtonsoft.Json; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Serialization -{ - // We can't truly serialize a snapshot because it has access to a Workspace Project\ - // - // Instead we serialize to a ProjectSnapshotHandle and then use that to re-create the snapshot - // inside the remote host. - internal class ProjectSnapshotJsonConverter : JsonConverter - { - public static readonly ProjectSnapshotJsonConverter Instance = new ProjectSnapshotJsonConverter(); - - public override bool CanRead => false; - - public override bool CanWrite => true; - - public override bool CanConvert(Type objectType) - { - return typeof(ProjectSnapshot).IsAssignableFrom(objectType); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - throw new NotSupportedException(); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var project = (ProjectSnapshot)value; - var handle = new ProjectSnapshotHandle(project.FilePath, project.Configuration, project.WorkspaceProject?.Id); - - ProjectSnapshotHandleJsonConverter.Instance.WriteJson(writer, handle, serializer); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorConfigurationJsonConverter.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorConfigurationJsonConverter.cs deleted file mode 100644 index 26be8c52b7..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorConfigurationJsonConverter.cs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Serialization -{ - internal class RazorConfigurationJsonConverter : JsonConverter - { - public static readonly RazorConfigurationJsonConverter Instance = new RazorConfigurationJsonConverter(); - - public override bool CanConvert(Type objectType) - { - return typeof(RazorConfiguration).IsAssignableFrom(objectType); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType != JsonToken.StartObject) - { - return null; - } - - var obj = JObject.Load(reader); - var configurationName = obj[nameof(RazorConfiguration.ConfigurationName)].Value(); - var languageVersion = obj[nameof(RazorConfiguration.LanguageVersion)].Value(); - var extensions = obj[nameof(RazorConfiguration.Extensions)].ToObject(serializer); - - return RazorConfiguration.Create(RazorLanguageVersion.Parse(languageVersion), configurationName, extensions); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var configuration = (RazorConfiguration)value; - - writer.WriteStartObject(); - - writer.WritePropertyName(nameof(RazorConfiguration.ConfigurationName)); - writer.WriteValue(configuration.ConfigurationName); - - writer.WritePropertyName(nameof(RazorConfiguration.LanguageVersion)); - writer.WriteValue(configuration.LanguageVersion.ToString()); - - writer.WritePropertyName(nameof(RazorConfiguration.Extensions)); - serializer.Serialize(writer, configuration.Extensions); - - writer.WriteEndObject(); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorExtensionJsonConverter.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorExtensionJsonConverter.cs deleted file mode 100644 index 0d84b8c939..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/RazorExtensionJsonConverter.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Newtonsoft.Json; -using Newtonsoft.Json.Linq; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Serialization -{ - internal class RazorExtensionJsonConverter : JsonConverter - { - public static readonly RazorExtensionJsonConverter Instance = new RazorExtensionJsonConverter(); - - public override bool CanConvert(Type objectType) - { - return typeof(RazorExtension).IsAssignableFrom(objectType); - } - - public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) - { - if (reader.TokenType != JsonToken.StartObject) - { - return null; - } - - var obj = JObject.Load(reader); - var extensionName = obj[nameof(RazorExtension.ExtensionName)].Value(); - - return new SerializedRazorExtension(extensionName); - } - - public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) - { - var extension = (RazorExtension)value; - - writer.WriteStartObject(); - - writer.WritePropertyName(nameof(RazorExtension.ExtensionName)); - writer.WriteValue(extension.ExtensionName); - - writer.WriteEndObject(); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/SerializedRazorExtension.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/SerializedRazorExtension.cs deleted file mode 100644 index 0f0292534f..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Serialization/SerializedRazorExtension.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Serialization -{ - internal class SerializedRazorExtension : RazorExtension - { - public SerializedRazorExtension(string extensionName) - { - if (extensionName == null) - { - throw new ArgumentNullException(nameof(extensionName)); - } - - ExtensionName = extensionName; - } - - public override string ExtensionName { get; } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioErrorReporter.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioErrorReporter.cs deleted file mode 100644 index 766494cf1b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioErrorReporter.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - internal class VisualStudioErrorReporter : ErrorReporter - { - private readonly IServiceProvider _services; - - public VisualStudioErrorReporter(IServiceProvider services) - { - if (services == null) - { - throw new ArgumentNullException(nameof(services)); - } - - _services = services; - } - - public override void ReportError(Exception exception) - { - if (exception == null) - { - return; - } - - var activityLog = GetActivityLog(); - if (activityLog != null) - { - var hr = activityLog.LogEntry( - (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, - "Razor Language Services", - $"Error encountered:{Environment.NewLine}{exception}"); - ErrorHandler.ThrowOnFailure(hr); - } - } - - public override void ReportError(Exception exception, ProjectSnapshot project) - { - if (exception == null) - { - return; - } - - var activityLog = GetActivityLog(); - if (activityLog != null) - { - var hr = activityLog.LogEntry( - (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, - "Razor Language Services", - $"Error encountered from project '{project?.FilePath}':{Environment.NewLine}{exception}"); - ErrorHandler.ThrowOnFailure(hr); - } - } - - public override void ReportError(Exception exception, Project workspaceProject) - { - if (exception == null) - { - return; - } - - var activityLog = GetActivityLog(); - if (activityLog != null) - { - var hr = activityLog.LogEntry( - (uint)__ACTIVITYLOG_ENTRYTYPE.ALE_ERROR, - "Razor Language Services", - $"Error encountered from project '{workspaceProject?.Name}' '{workspaceProject?.FilePath}':{Environment.NewLine}{exception}"); - ErrorHandler.ThrowOnFailure(hr); - } - } - - private IVsActivityLog GetActivityLog() - { - return _services.GetService(typeof(SVsActivityLog)) as IVsActivityLog; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs deleted file mode 100644 index 5a59a5a77e..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Shell; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - [Shared] - [ExportWorkspaceServiceFactory(typeof(ErrorReporter), ServiceLayer.Host)] - internal class VisualStudioErrorReporterFactory : IWorkspaceServiceFactory - { - private readonly IServiceProvider _serviceProvider; - - [ImportingConstructor] - public VisualStudioErrorReporterFactory(SVsServiceProvider serviceProvider) - { - if (serviceProvider == null) - { - throw new ArgumentNullException(nameof(serviceProvider)); - } - - _serviceProvider = serviceProvider; - } - - public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) - { - return new VisualStudioErrorReporter(_serviceProvider); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs deleted file mode 100644 index 6b80023b68..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.Composition; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Shell; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - [System.Composition.Shared] - [Export(typeof(ForegroundDispatcher))] - internal class VisualStudioForegroundDispatcher : ForegroundDispatcher - { - public override TaskScheduler BackgroundScheduler { get; } = TaskScheduler.Default; - - public override TaskScheduler ForegroundScheduler { get; } = TaskScheduler.FromCurrentSynchronizationContext(); - - public override bool IsForegroundThread => ThreadHelper.CheckAccess(); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VsSolutionUpdatesProjectSnapshotChangeTrigger.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VsSolutionUpdatesProjectSnapshotChangeTrigger.cs deleted file mode 100644 index ae66202b22..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/VsSolutionUpdatesProjectSnapshotChangeTrigger.cs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using System.Runtime.InteropServices; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - [Export(typeof(ProjectSnapshotChangeTrigger))] - internal class VsSolutionUpdatesProjectSnapshotChangeTrigger : ProjectSnapshotChangeTrigger, IVsUpdateSolutionEvents2 - { - private readonly IServiceProvider _services; - private readonly TextBufferProjectService _projectService; - - private ProjectSnapshotManagerBase _projectManager; - - [ImportingConstructor] - public VsSolutionUpdatesProjectSnapshotChangeTrigger( - [Import(typeof(SVsServiceProvider))] IServiceProvider services, - TextBufferProjectService projectService) - { - if (services == null) - { - throw new ArgumentNullException(nameof(services)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - _services = services; - _projectService = projectService; - } - - public override void Initialize(ProjectSnapshotManagerBase projectManager) - { - _projectManager = projectManager; - - // Attach the event sink to solution update events. - var solutionBuildManager = _services.GetService(typeof(SVsSolutionBuildManager)) as IVsSolutionBuildManager; - if (solutionBuildManager != null) - { - // We expect this to be called only once. So we don't need to Unadvise. - var hr = solutionBuildManager.AdviseUpdateSolutionEvents(this, out var cookie); - Marshal.ThrowExceptionForHR(hr); - } - } - - public int UpdateSolution_Begin(ref int pfCancelUpdate) - { - return VSConstants.S_OK; - } - - public int UpdateSolution_Done(int fSucceeded, int fModified, int fCancelCommand) - { - return VSConstants.S_OK; - } - - public int UpdateSolution_StartUpdate(ref int pfCancelUpdate) - { - return VSConstants.S_OK; - } - - public int UpdateSolution_Cancel() - { - return VSConstants.S_OK; - } - - public int OnActiveProjectCfgChange(IVsHierarchy pIVsHierarchy) - { - return VSConstants.S_OK; - } - - public int UpdateProjectCfg_Begin(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, ref int pfCancel) - { - return VSConstants.S_OK; - } - - // This gets called when the project has finished building. - public int UpdateProjectCfg_Done(IVsHierarchy pHierProj, IVsCfg pCfgProj, IVsCfg pCfgSln, uint dwAction, int fSuccess, int fCancel) - { - var projectPath = _projectService.GetProjectPath(pHierProj); - - // Get the corresponding roslyn project by matching the project name and the project path. - foreach (var projectSnapshot in _projectManager.Projects) - { - if (string.Equals(projectPath, projectSnapshot.FilePath, StringComparison.OrdinalIgnoreCase)) - { - _projectManager.HostProjectBuildComplete(projectSnapshot.HostProject); - break; - } - } - - return VSConstants.S_OK; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTracker.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTracker.cs deleted file mode 100644 index 2848dadb88..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTracker.cs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using MonoDevelop.Core; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - internal class DefaultFileChangeTracker : FileChangeTracker - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly string _normalizedFilePath; - private bool _listening; - - public override event EventHandler Changed; - - public DefaultFileChangeTracker( - string filePath, - ForegroundDispatcher foregroundDispatcher) - { - if (string.IsNullOrEmpty(filePath)) - { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath)); - } - - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - FilePath = filePath; - _normalizedFilePath = NormalizePath(FilePath); - _foregroundDispatcher = foregroundDispatcher; - } - - public override string FilePath { get; } - - public override void StartListening() - { - _foregroundDispatcher.AssertForegroundThread(); - - if (_listening) - { - return; - } - - AttachToFileServiceEvents(); - - _listening = true; - } - - public override void StopListening() - { - _foregroundDispatcher.AssertForegroundThread(); - - if (!_listening) - { - return; - } - - DetachFromFileServiceEvents(); - - _listening = false; - } - - // Virtual for testing - protected virtual void AttachToFileServiceEvents() - { - FileService.FileChanged += FileService_FileChanged; - FileService.FileCreated += FileService_FileCreated; - FileService.FileRemoved += FileService_FileRemoved; - } - - // Virtual for testing - protected virtual void DetachFromFileServiceEvents() - { - FileService.FileChanged -= FileService_FileChanged; - FileService.FileCreated -= FileService_FileCreated; - FileService.FileRemoved -= FileService_FileRemoved; - } - - private void FileService_FileChanged(object sender, FileEventArgs args) => HandleFileChangeEvent(FileChangeKind.Changed, args); - - private void FileService_FileCreated(object sender, FileEventArgs args) => HandleFileChangeEvent(FileChangeKind.Added, args); - - private void FileService_FileRemoved(object sender, FileEventArgs args) => HandleFileChangeEvent(FileChangeKind.Removed, args); - - private void HandleFileChangeEvent(FileChangeKind changeKind, FileEventArgs args) - { - _foregroundDispatcher.AssertForegroundThread(); - - if (Changed == null) - { - return; - } - - foreach (var fileEvent in args) - { - if (fileEvent.IsDirectory) - { - continue; - } - - var normalizedEventPath = NormalizePath(fileEvent.FileName.FullPath); - if (string.Equals(_normalizedFilePath, normalizedEventPath, StringComparison.OrdinalIgnoreCase)) - { - OnChanged(changeKind); - return; - } - } - } - - private void OnChanged(FileChangeKind changeKind) - { - _foregroundDispatcher.AssertForegroundThread(); - - var args = new FileChangeEventArgs(FilePath, changeKind); - Changed?.Invoke(this, args); - } - - private static string NormalizePath(string path) - { - path = path.Replace('\\', '/'); - - return path; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactory.cs deleted file mode 100644 index 33aa73fd41..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactory.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - internal class DefaultFileChangeTrackerFactory : FileChangeTrackerFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - - public DefaultFileChangeTrackerFactory(ForegroundDispatcher foregroundDispatcher) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - _foregroundDispatcher = foregroundDispatcher; - } - - public override FileChangeTracker Create(string filePath) - { - if (string.IsNullOrEmpty(filePath)) - { - throw new ArgumentException(Resources.ArgumentCannotBeNullOrEmpty, nameof(filePath)); - } - - var fileChangeTracker = new DefaultFileChangeTracker(filePath, _foregroundDispatcher); - return fileChangeTracker; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs deleted file mode 100644 index d30ae0e667..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultFileChangeTrackerFactoryFactory.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(FileChangeTrackerFactory), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultFileChangeTrackerFactoryFactory : ILanguageServiceFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - - [ImportingConstructor] - public DefaultFileChangeTrackerFactoryFactory(ForegroundDispatcher foregroundDispatcher) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - _foregroundDispatcher = foregroundDispatcher; - } - - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - return new DefaultFileChangeTrackerFactory(_foregroundDispatcher); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultVisualStudioMacWorkspaceAccessor.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultVisualStudioMacWorkspaceAccessor.cs deleted file mode 100644 index eeac75968a..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/DefaultVisualStudioMacWorkspaceAccessor.cs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Text; -using MonoDevelop.Ide.TypeSystem; -using MonoDevelop.Projects; -using Workspace = Microsoft.CodeAnalysis.Workspace; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - [System.Composition.Shared] - [Export(typeof(VisualStudioWorkspaceAccessor))] - [Export(typeof(VisualStudioMacWorkspaceAccessor))] - internal class DefaultVisualStudioMacWorkspaceAccessor : VisualStudioMacWorkspaceAccessor - { - private readonly TextBufferProjectService _projectService; - - [ImportingConstructor] - public DefaultVisualStudioMacWorkspaceAccessor(TextBufferProjectService projectService) - { - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - _projectService = projectService; - } - - public override bool TryGetWorkspace(ITextBuffer textBuffer, out Workspace workspace) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - // We do a best effort approach in this method to get the workspace that belongs to the TextBuffer. - // Below we try and find the project and then the solution that contains the given text buffer. If - // we're able to find both the project and solution then we use the solution to look up the corresponding - // Workspace using MonoDevelops TypeSystemService. - - var hostProject = (DotNetProject)_projectService.GetHostProject(textBuffer); - if (hostProject == null) - { - // Does not have a host project. - workspace = null; - return false; - } - - var hostSolution = hostProject.ParentSolution; - if (hostSolution == null) - { - // Project does not have a solution - workspace = null; - return false; - } - - return TryGetWorkspace(hostSolution, out workspace); - } - - public override bool TryGetWorkspace(Solution solution, out Workspace workspace) - { - if (solution == null) - { - throw new ArgumentNullException(nameof(solution)); - } - - workspace = TypeSystemService.GetWorkspace(solution); - - // Workspace cannot be null at this point. If TypeSystemService.GetWorkspace isn't able to find a corresponding - // workspace it returns an empty workspace. Therefore, in order to see if we have a valid workspace we need to - // cross-check it against the list of active non-empty workspaces. - - if (!TypeSystemService.AllWorkspaces.Contains(workspace)) - { - // We were returned the empty workspace which is equivalent to us not finding a valid workspace for our text buffer. - workspace = null; - return false; - } - - return true; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultTextBufferProjectService.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultTextBufferProjectService.cs deleted file mode 100644 index 02a4541958..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultTextBufferProjectService.cs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Text; -using MonoDevelop.Ide; -using MonoDevelop.Projects; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor -{ - /// - /// Infrastructure methods to find project information from an . - /// - [System.Composition.Shared] - [Export(typeof(TextBufferProjectService))] - internal class DefaultTextBufferProjectService : TextBufferProjectService - { - private const string DotNetCoreRazorCapability = "DotNetCoreRazor | AspNetCore"; - private readonly ITextDocumentFactoryService _documentFactory; - - [ImportingConstructor] - public DefaultTextBufferProjectService(ITextDocumentFactoryService documentFactory) - { - if (documentFactory == null) - { - throw new ArgumentNullException(nameof(documentFactory)); - } - - _documentFactory = documentFactory; - } - - public override object GetHostProject(ITextBuffer textBuffer) - { - if (textBuffer == null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - - // If there's no document we can't find the FileName, or look for an associated project. - if (!_documentFactory.TryGetTextDocument(textBuffer, out var textDocument)) - { - return null; - } - - var projectsContainingFilePath = IdeApp.Workspace.GetProjectsContainingFile(textDocument.FilePath); - foreach (var project in projectsContainingFilePath) - { - if (!(project is DotNetProject)) - { - continue; - } - - var projectFile = project.GetProjectFile(textDocument.FilePath); - if (!projectFile.IsHidden) - { - return project; - } - } - - return null; - } - - public override string GetProjectPath(object project) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - var dotnetProject = (DotNetProject)project; - return dotnetProject.FileName.FullPath; - } - - // VisualStudio for Mac only supports ASP.NET Core Razor. - public override bool IsSupportedProject(object project) - { - if (!(project is DotNetProject dotNetProject)) - { - return false; - } - - if (!dotNetProject.IsCapabilityMatch(DotNetCoreRazorCapability)) - { - return false; - } - - return true; - } - - public override string GetProjectName(object project) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - var dotnetProject = (DotNetProject)project; - - return dotnetProject.Name; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs deleted file mode 100644 index 6f932b4191..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBroker.cs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Text.Editor; -using MonoDevelop.Ide.CodeCompletion; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor -{ - internal class DefaultVisualStudioCompletionBroker : VisualStudioCompletionBroker - { - private const string IsCompletionActiveKey = "RoslynCompletionPresenterSession.IsCompletionActive"; - - public override bool IsCompletionActive(ITextView textView) - { - if (textView == null) - { - throw new ArgumentNullException(nameof(textView)); - } - - if (!textView.HasAggregateFocus) - { - // Text view does not have focus, if the completion window is visible it's for a different text view. - return false; - } - - if (CompletionWindowManager.IsVisible) - { - return true; - } - - if (textView.Properties.TryGetProperty(IsCompletionActiveKey, out var visible)) - { - return visible; - } - - return false; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs deleted file mode 100644 index a087c17471..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Editor/DefaultVisualStudioCompletionBrokerFactory.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.Editor -{ - [Shared] - [ExportLanguageServiceFactory(typeof(VisualStudioCompletionBroker), RazorLanguage.Name, ServiceLayer.Default)] - internal class DefaultVisualStudioCompletionBrokerFactory : ILanguageServiceFactory - { - public ILanguageService CreateLanguageService(HostLanguageServices languageServices) - { - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - return new DefaultVisualStudioCompletionBroker(); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj deleted file mode 100644 index 69e9071704..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Microsoft.VisualStudio.Mac.LanguageServices.Razor.csproj +++ /dev/null @@ -1,18 +0,0 @@ - - - - net461 - Razor is a markup syntax for adding server-side logic to web pages. This package contains the Razor design-time infrastructure for Visual Studio for Mac. - false - - - - - - - - - - - - diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectBuildChangeTrigger.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectBuildChangeTrigger.cs deleted file mode 100644 index 14f0e7515b..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectBuildChangeTrigger.cs +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Editor.Razor; -using MonoDevelop.Ide; -using MonoDevelop.Projects; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - [Export(typeof(ProjectSnapshotChangeTrigger))] - internal class ProjectBuildChangeTrigger : ProjectSnapshotChangeTrigger - { - private readonly TextBufferProjectService _projectService; - private readonly ForegroundDispatcher _foregroundDispatcher; - private ProjectSnapshotManagerBase _projectManager; - - [ImportingConstructor] - public ProjectBuildChangeTrigger(ForegroundDispatcher foregroundDispatcher, TextBufferProjectService projectService) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - _foregroundDispatcher = foregroundDispatcher; - _projectService = projectService; - } - - // Internal for testing - internal ProjectBuildChangeTrigger( - ForegroundDispatcher foregroundDispatcher, - TextBufferProjectService projectService, - ProjectSnapshotManagerBase projectManager) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - if (projectManager == null) - { - throw new ArgumentNullException(nameof(projectManager)); - } - - _foregroundDispatcher = foregroundDispatcher; - _projectService = projectService; - _projectManager = projectManager; - } - - public override void Initialize(ProjectSnapshotManagerBase projectManager) - { - if (projectManager == null) - { - throw new ArgumentNullException(nameof(projectManager)); - } - - _projectManager = projectManager; - - IdeApp.ProjectOperations.EndBuild += ProjectOperations_EndBuild; - } - - // Internal for testing - internal void ProjectOperations_EndBuild(object sender, BuildEventArgs args) - { - if (args == null) - { - throw new ArgumentNullException(nameof(args)); - } - - _foregroundDispatcher.AssertForegroundThread(); - - if (!args.Success) - { - // Build failed - return; - } - - var projectItem = args.SolutionItem; - if (!_projectService.IsSupportedProject(projectItem)) - { - // We're hooked into all build events, it's possible to get called with an unsupported project item type. - return; - } - - var projectPath = _projectService.GetProjectPath(projectItem); - - // Get the corresponding roslyn project by matching the project name and the project path. - foreach (var projectSnapshot in _projectManager.Projects) - { - if (string.Equals(projectPath, projectSnapshot.FilePath, StringComparison.OrdinalIgnoreCase)) - { - _projectManager.HostProjectBuildComplete(projectSnapshot.HostProject); - break; - } - } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DefaultDotNetProjectHost.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DefaultDotNetProjectHost.cs deleted file mode 100644 index f66d2774fb..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DefaultDotNetProjectHost.cs +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Editor.Razor; -using MonoDevelop.Projects; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - internal class DefaultDotNetProjectHost : DotNetProjectHost - { - private const string ExplicitRazorConfigurationCapability = "DotNetCoreRazorConfiguration"; - - private readonly DotNetProject _project; - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly VisualStudioMacWorkspaceAccessor _workspaceAccessor; - private readonly TextBufferProjectService _projectService; - private RazorProjectHostBase _razorProjectHost; - - public DefaultDotNetProjectHost( - DotNetProject project, - ForegroundDispatcher foregroundDispatcher, - VisualStudioMacWorkspaceAccessor workspaceAccessor, - TextBufferProjectService projectService) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (workspaceAccessor == null) - { - throw new ArgumentNullException(nameof(workspaceAccessor)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - _project = project; - _foregroundDispatcher = foregroundDispatcher; - _workspaceAccessor = workspaceAccessor; - _projectService = projectService; - } - - // Internal for testing - internal DefaultDotNetProjectHost( - ForegroundDispatcher foregroundDispatcher, - VisualStudioMacWorkspaceAccessor workspaceAccessor, - TextBufferProjectService projectService) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (workspaceAccessor == null) - { - throw new ArgumentNullException(nameof(workspaceAccessor)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - _foregroundDispatcher = foregroundDispatcher; - _workspaceAccessor = workspaceAccessor; - _projectService = projectService; - } - - public override DotNetProject Project => _project; - - public override void Subscribe() - { - _foregroundDispatcher.AssertForegroundThread(); - - UpdateRazorHostProject(); - - _project.ProjectCapabilitiesChanged += Project_ProjectCapabilitiesChanged; - _project.Disposing += Project_Disposing; - } - - private void Project_Disposing(object sender, EventArgs e) - { - _foregroundDispatcher.AssertForegroundThread(); - - _project.ProjectCapabilitiesChanged -= Project_ProjectCapabilitiesChanged; - _project.Disposing -= Project_Disposing; - - DetatchCurrentRazorProjectHost(); - } - - private void Project_ProjectCapabilitiesChanged(object sender, EventArgs e) => UpdateRazorHostProject(); - - // Internal for testing - internal void UpdateRazorHostProject() - { - _foregroundDispatcher.AssertForegroundThread(); - - DetatchCurrentRazorProjectHost(); - - if (!_projectService.IsSupportedProject(_project)) - { - // Not a Razor compatible project. - return; - } - - if (!TryGetProjectSnapshotManager(out var projectSnapshotManager)) - { - // Could not get a ProjectSnapshotManager for the current project. - return; - } - - if (_project.IsCapabilityMatch(ExplicitRazorConfigurationCapability)) - { - // SDK >= 2.1 - _razorProjectHost = new DefaultRazorProjectHost(_project, _foregroundDispatcher, projectSnapshotManager); - return; - } - - // We're an older version of Razor at this point, SDK < 2.1 - _razorProjectHost = new FallbackRazorProjectHost(_project, _foregroundDispatcher, projectSnapshotManager); - } - - private bool TryGetProjectSnapshotManager(out ProjectSnapshotManagerBase projectSnapshotManagerBase) - { - if (!_workspaceAccessor.TryGetWorkspace(_project.ParentSolution, out var workspace)) - { - // Could not locate workspace for razor project. Project is most likely tearing down. - projectSnapshotManagerBase = null; - return false; - } - - var languageService = workspace.Services.GetLanguageServices(RazorLanguage.Name); - projectSnapshotManagerBase = (ProjectSnapshotManagerBase)languageService.GetRequiredService(); - - return true; - } - - private void DetatchCurrentRazorProjectHost() - { - _razorProjectHost?.Detatch(); - _razorProjectHost = null; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs deleted file mode 100644 index 587c7f7b9e..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DefaultRazorProjectHost.cs +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using MonoDevelop.Projects; -using MonoDevelop.Projects.MSBuild; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - internal class DefaultRazorProjectHost : RazorProjectHostBase - { - private const string RazorLangVersionProperty = "RazorLangVersion"; - private const string RazorDefaultConfigurationProperty = "RazorDefaultConfiguration"; - private const string RazorExtensionItemType = "RazorExtension"; - private const string RazorConfigurationItemType = "RazorConfiguration"; - private const string RazorConfigurationItemTypeExtensionsProperty = "Extensions"; - - public DefaultRazorProjectHost( - DotNetProject project, - ForegroundDispatcher foregroundDispatcher, - ProjectSnapshotManagerBase projectSnapshotManager) - : base(project, foregroundDispatcher, projectSnapshotManager) - { - } - - protected override async Task OnProjectChangedAsync() - { - ForegroundDispatcher.AssertBackgroundThread(); - - await ExecuteWithLockAsync(async () => - { - var projectProperties = DotNetProject.MSBuildProject.EvaluatedProperties; - var projectItems = DotNetProject.MSBuildProject.EvaluatedItems; - - if (TryGetConfiguration(projectProperties, projectItems, out var configuration)) - { - var hostProject = new HostProject(DotNetProject.FileName.FullPath, configuration); - await UpdateHostProjectUnsafeAsync(hostProject).ConfigureAwait(false); - } - else - { - // Ok we can't find a configuration. Let's assume this project isn't using Razor then. - await UpdateHostProjectUnsafeAsync(null).ConfigureAwait(false); - } - }); - } - - // Internal for testing - internal static bool TryGetConfiguration( - IMSBuildEvaluatedPropertyCollection projectProperties, - IEnumerable projectItems, - out RazorConfiguration configuration) - { - if (!TryGetDefaultConfiguration(projectProperties, out var defaultConfiguration)) - { - configuration = null; - return false; - } - - if (!TryGetLanguageVersion(projectProperties, out var languageVersion)) - { - configuration = null; - return false; - } - - if (!TryGetConfigurationItem(defaultConfiguration, projectItems, out var configurationItem)) - { - configuration = null; - return false; - } - - if (!TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionNames)) - { - configuration = null; - return false; - } - - var extensions = GetExtensions(configuredExtensionNames, projectItems); - configuration = new ProjectSystemRazorConfiguration(languageVersion, configurationItem.Include, extensions); - return true; - } - - - // Internal for testing - internal static bool TryGetDefaultConfiguration(IMSBuildEvaluatedPropertyCollection projectProperties, out string defaultConfiguration) - { - defaultConfiguration = projectProperties.GetValue(RazorDefaultConfigurationProperty); - if (string.IsNullOrEmpty(defaultConfiguration)) - { - defaultConfiguration = null; - return false; - } - - return true; - } - - // Internal for testing - internal static bool TryGetLanguageVersion(IMSBuildEvaluatedPropertyCollection projectProperties, out RazorLanguageVersion languageVersion) - { - var languageVersionValue = projectProperties.GetValue(RazorLangVersionProperty); - if (string.IsNullOrEmpty(languageVersionValue)) - { - languageVersion = null; - return false; - } - - if (!RazorLanguageVersion.TryParse(languageVersionValue, out languageVersion)) - { - languageVersion = RazorLanguageVersion.Latest; - } - - return true; - } - - // Internal for testing - internal static bool TryGetConfigurationItem( - string configuration, - IEnumerable projectItems, - out IMSBuildItemEvaluated configurationItem) - { - foreach (var item in projectItems) - { - if (item.Name == RazorConfigurationItemType && item.Include == configuration) - { - configurationItem = item; - return true; - } - } - - configurationItem = null; - return false; - } - - // Internal for testing - internal static bool TryGetConfiguredExtensionNames(IMSBuildItemEvaluated configurationItem, out string[] configuredExtensionNames) - { - var extensionNamesValue = configurationItem.Metadata.GetValue(RazorConfigurationItemTypeExtensionsProperty); - - if (string.IsNullOrEmpty(extensionNamesValue)) - { - configuredExtensionNames = null; - return false; - } - - configuredExtensionNames = extensionNamesValue.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries); - return true; - } - - // Internal for testing - internal static ProjectSystemRazorExtension[] GetExtensions( - string[] configuredExtensionNames, - IEnumerable projectItems) - { - var extensions = new List(); - - foreach (var item in projectItems) - { - if (item.Name != RazorExtensionItemType) - { - // Not a RazorExtension - continue; - } - - var extensionName = item.Include; - if (configuredExtensionNames.Contains(extensionName)) - { - extensions.Add(new ProjectSystemRazorExtension(extensionName)); - } - } - - return extensions.ToArray(); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DotNetProjectHost.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DotNetProjectHost.cs deleted file mode 100644 index d5933ef90f..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DotNetProjectHost.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using MonoDevelop.Projects; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - internal abstract class DotNetProjectHost - { - public abstract DotNetProject Project { get; } - - public abstract void Subscribe(); - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DotNetProjectHostFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DotNetProjectHostFactory.cs deleted file mode 100644 index 9755b2dc19..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/DotNetProjectHostFactory.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using MonoDevelop.Projects; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - [System.Composition.Shared] - [Export(typeof(DotNetProjectHostFactory))] - internal class DotNetProjectHostFactory - { - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly VisualStudioMacWorkspaceAccessor _workspaceAccessor; - private readonly TextBufferProjectService _projectService; - - [ImportingConstructor] - public DotNetProjectHostFactory( - ForegroundDispatcher foregroundDispatcher, - VisualStudioMacWorkspaceAccessor workspaceAccessor, - TextBufferProjectService projectService) - { - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (workspaceAccessor == null) - { - throw new ArgumentNullException(nameof(workspaceAccessor)); - } - - if (projectService == null) - { - throw new ArgumentNullException(nameof(projectService)); - } - - _foregroundDispatcher = foregroundDispatcher; - _workspaceAccessor = workspaceAccessor; - _projectService = projectService; - } - - public DotNetProjectHost Create(DotNetProject project) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - var projectHost = new DefaultDotNetProjectHost(project, _foregroundDispatcher, _workspaceAccessor, _projectService); - return projectHost; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs deleted file mode 100644 index 170dd51ca2..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/FallbackRazorProjectHost.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.IO; -using System.Linq; -using System.Reflection.Metadata; -using System.Reflection.PortableExecutable; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using MonoDevelop.Projects; -using AssemblyReference = MonoDevelop.Projects.AssemblyReference; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - internal class FallbackRazorProjectHost : RazorProjectHostBase - { - private const string MvcAssemblyFileName = "Microsoft.AspNetCore.Mvc.Razor.dll"; - - public FallbackRazorProjectHost( - DotNetProject project, - ForegroundDispatcher foregroundDispatcher, - ProjectSnapshotManagerBase projectSnapshotManager) - : base(project, foregroundDispatcher, projectSnapshotManager) - { - } - - protected override async Task OnProjectChangedAsync() - { - ForegroundDispatcher.AssertBackgroundThread(); - - await ExecuteWithLockAsync(async () => - { - var referencedAssemblies = await DotNetProject.GetReferencedAssemblies(ConfigurationSelector.Default); - var mvcReference = referencedAssemblies.FirstOrDefault(IsMvcAssembly); - - if (mvcReference == null) - { - // Ok we can't find an MVC version. Let's assume this project isn't using Razor then. - await UpdateHostProjectUnsafeAsync(null).ConfigureAwait(false); - return; - } - - var version = GetAssemblyVersion(mvcReference.FilePath); - if (version == null) - { - // Ok we can't find an MVC version. Let's assume this project isn't using Razor then. - await UpdateHostProjectUnsafeAsync(null).ConfigureAwait(false); - return; - } - - var configuration = FallbackRazorConfiguration.SelectConfiguration(version); - var hostProject = new HostProject(DotNetProject.FileName.FullPath, configuration); - await UpdateHostProjectUnsafeAsync(hostProject).ConfigureAwait(false); - }); - } - - // Internal for testing - internal static bool IsMvcAssembly(AssemblyReference reference) - { - var fileName = reference?.FilePath.FileName; - - if (string.IsNullOrEmpty(fileName)) - { - return false; - } - - if (string.Equals(reference.FilePath.FileName, MvcAssemblyFileName, StringComparison.OrdinalIgnoreCase)) - { - // Mvc assembly - return true; - } - - return false; - } - - private static Version GetAssemblyVersion(string filePath) - { - try - { - using (var stream = new FileStream(filePath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete)) - using (var reader = new PEReader(stream)) - { - var metadataReader = reader.GetMetadataReader(); - - var assemblyDefinition = metadataReader.GetAssemblyDefinition(); - return assemblyDefinition.Version; - } - } - catch - { - // We're purposely silencing any kinds of I/O exceptions here, just in case something wacky is going on. - return null; - } - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs deleted file mode 100644 index c6afacad93..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/ProjectSystem/RazorProjectHostBase.cs +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Threading; -using MonoDevelop.Projects; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - internal abstract class RazorProjectHostBase - { - // References changes are always triggered when project changes happen. - private const string ProjectChangedHint = "References"; - - private bool _batchingProjectChanges; - private readonly DotNetProject _dotNetProject; - private readonly ForegroundDispatcher _foregroundDispatcher; - private readonly ProjectSnapshotManagerBase _projectSnapshotManager; - private readonly AsyncSemaphore _onProjectChangedInnerSemaphore; - private readonly AsyncSemaphore _projectChangedSemaphore; - private HostProject _currentHostProject; - - public RazorProjectHostBase( - DotNetProject project, - ForegroundDispatcher foregroundDispatcher, - ProjectSnapshotManagerBase projectSnapshotManager) - { - if (project == null) - { - throw new ArgumentNullException(nameof(project)); - } - - if (foregroundDispatcher == null) - { - throw new ArgumentNullException(nameof(foregroundDispatcher)); - } - - if (projectSnapshotManager == null) - { - throw new ArgumentNullException(nameof(projectSnapshotManager)); - } - - _dotNetProject = project; - _foregroundDispatcher = foregroundDispatcher; - _projectSnapshotManager = projectSnapshotManager; - _onProjectChangedInnerSemaphore = new AsyncSemaphore(initialCount: 1); - _projectChangedSemaphore = new AsyncSemaphore(initialCount: 1); - - AttachToProject(); - } - - public DotNetProject DotNetProject => _dotNetProject; - - public HostProject HostProject => _currentHostProject; - - protected ForegroundDispatcher ForegroundDispatcher => _foregroundDispatcher; - - public void Detatch() - { - _foregroundDispatcher.AssertForegroundThread(); - - DotNetProject.Modified -= DotNetProject_Modified; - - UpdateHostProjectForeground(null); - } - - protected abstract Task OnProjectChangedAsync(); - - // Protected virtual for testing - protected virtual void AttachToProject() - { - ForegroundDispatcher.AssertForegroundThread(); - - DotNetProject.Modified += DotNetProject_Modified; - - // Trigger the initial update to the project. - _batchingProjectChanges = true; - Task.Factory.StartNew(ProjectChangedBackgroundAsync, null, CancellationToken.None, TaskCreationOptions.None, ForegroundDispatcher.BackgroundScheduler); - } - - // Must be called inside the lock. - protected async Task UpdateHostProjectUnsafeAsync(HostProject newHostProject) - { - _foregroundDispatcher.AssertBackgroundThread(); - - await Task.Factory.StartNew(UpdateHostProjectForeground, newHostProject, CancellationToken.None, TaskCreationOptions.None, ForegroundDispatcher.ForegroundScheduler); - } - - protected async Task ExecuteWithLockAsync(Func func) - { - using (await _projectChangedSemaphore.EnterAsync().ConfigureAwait(false)) - { - await func().ConfigureAwait(false); - } - } - - private async Task ProjectChangedBackgroundAsync(object state) - { - ForegroundDispatcher.AssertBackgroundThread(); - - _batchingProjectChanges = false; - - // Ensure ordering, typically we'll only have 1 background thread in flight at a time. However, - // between this line and the one prior another background thread could have also entered this - // method. This is here to protect against us changing the order of project changed events. - using (await _onProjectChangedInnerSemaphore.EnterAsync().ConfigureAwait(false)) - { - await OnProjectChangedAsync(); - } - } - - private void DotNetProject_Modified(object sender, SolutionItemModifiedEventArgs args) - { - if (args == null) - { - throw new ArgumentNullException(nameof(args)); - } - - ForegroundDispatcher.AssertForegroundThread(); - - if (_batchingProjectChanges) - { - // Already waiting to recompute host project, no need to do any more work to determine if we're dirty. - return; - } - - var projectChanged = args.Any(arg => string.Equals(arg.Hint, ProjectChangedHint, StringComparison.Ordinal)); - if (projectChanged) - { - // This method can be spammed for tons of project change events but all we really care about is "are we dirty?". - // Therefore, we re-dispatch here to allow any remaining project change events to fire and to then only have 1 host - // project change trigger; this way we don't spam our own system with re-configure calls. - _batchingProjectChanges = true; - Task.Factory.StartNew(ProjectChangedBackgroundAsync, null, CancellationToken.None, TaskCreationOptions.None, ForegroundDispatcher.BackgroundScheduler); - } - } - - private void UpdateHostProjectForeground(object state) - { - _foregroundDispatcher.AssertForegroundThread(); - - var newHostProject = (HostProject)state; - - if (_currentHostProject == null && newHostProject == null) - { - // This is a no-op. This project isn't using Razor. - } - else if (_currentHostProject == null && newHostProject != null) - { - _projectSnapshotManager.HostProjectAdded(newHostProject); - } - else if (_currentHostProject != null && newHostProject == null) - { - _projectSnapshotManager.HostProjectRemoved(HostProject); - } - else - { - _projectSnapshotManager.HostProjectChanged(newHostProject); - } - - _currentHostProject = newHostProject; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/AssemblyInfo.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/AssemblyInfo.cs deleted file mode 100644 index e8a39ba34e..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; - -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.RazorAddin, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/Resources.Designer.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/Resources.Designer.cs deleted file mode 100644 index 9b9b6fb28f..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Properties/Resources.Designer.cs +++ /dev/null @@ -1,88 +0,0 @@ -// -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - using System.Globalization; - using System.Reflection; - using System.Resources; - - internal static class Resources - { - private static readonly ResourceManager _resourceManager - = new ResourceManager("Microsoft.VisualStudio.Mac.LanguageServices.Razor.Resources", typeof(Resources).GetTypeInfo().Assembly); - - /// - /// Value cannot be null or an empty string. - /// - internal static string ArgumentCannotBeNullOrEmpty - { - get => GetString("ArgumentCannotBeNullOrEmpty"); - } - - /// - /// Value cannot be null or an empty string. - /// - internal static string FormatArgumentCannotBeNullOrEmpty() - => GetString("ArgumentCannotBeNullOrEmpty"); - - /// - /// Razor Language Service error encountered. - /// - internal static string RazorLanguageServiceGeneralError - { - get => GetString("RazorLanguageServiceGeneralError"); - } - - /// - /// Razor Language Service error encountered. - /// - internal static string FormatRazorLanguageServiceGeneralError() - => GetString("RazorLanguageServiceGeneralError"); - - /// - /// Razor Language Service error encountered from project '{0}'. - /// - internal static string RazorLanguageServiceProjectError - { - get => GetString("RazorLanguageServiceProjectError"); - } - - /// - /// Razor Language Service error encountered from project '{0}'. - /// - internal static string FormatRazorLanguageServiceProjectError(object p0) - => string.Format(CultureInfo.CurrentCulture, GetString("RazorLanguageServiceProjectError"), p0); - - /// - /// Error encountered from project '{0}': - /// {1} - /// - internal static string RazorLanguageServiceProjectSnapshotError - { - get => GetString("RazorLanguageServiceProjectSnapshotError"); - } - - /// - /// Error encountered from project '{0}': - /// {1} - /// - internal static string FormatRazorLanguageServiceProjectSnapshotError(object p0, object p1) - => string.Format(CultureInfo.CurrentCulture, GetString("RazorLanguageServiceProjectSnapshotError"), p0, p1); - - private static string GetString(string name, params string[] formatterNames) - { - var value = _resourceManager.GetString(name); - - System.Diagnostics.Debug.Assert(value != null); - - if (formatterNames != null) - { - for (var i = 0; i < formatterNames.Length; i++) - { - value = value.Replace("{" + formatterNames[i] + "}", "{" + i + "}"); - } - } - - return value; - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Resources.resx b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Resources.resx deleted file mode 100644 index b5fa0a3947..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/Resources.resx +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - Value cannot be null or an empty string. - - - Razor Language Service error encountered. - - - Razor Language Service error encountered from project '{0}'. - - - Error encountered from project '{0}': -{1} - - \ No newline at end of file diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporter.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporter.cs deleted file mode 100644 index 6535dfa999..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporter.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using MonoDevelop.Core; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - internal class VisualStudioErrorReporter : ErrorReporter - { - public override void ReportError(Exception exception) - { - if (exception == null) - { - Debug.Fail("Null exceptions should not be reported."); - return; - } - - LoggingService.LogError( - Resources.RazorLanguageServiceGeneralError, - exception); - } - - public override void ReportError(Exception exception, Project project) - { - if (exception == null) - { - Debug.Fail("Null exceptions should not be reported."); - return; - } - - LoggingService.LogError( - Resources.FormatRazorLanguageServiceProjectError(project?.Name), - exception); - } - - public override void ReportError(Exception exception, ProjectSnapshot project) - { - if (exception == null) - { - Debug.Fail("Null exceptions should not be reported."); - return; - } - - LoggingService.LogError( - Resources.FormatRazorLanguageServiceProjectSnapshotError(project?.FilePath, exception), - exception); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs deleted file mode 100644 index 779cd87a54..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioErrorReporterFactory.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Host.Mef; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - [Shared] - [ExportWorkspaceServiceFactory(typeof(ErrorReporter), ServiceLayer.Host)] - internal class VisualStudioErrorReporterFactory : IWorkspaceServiceFactory - { - public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) - { - return new VisualStudioErrorReporter(); - } - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs deleted file mode 100644 index 789171cf05..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioForegroundDispatcher.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.ComponentModel.Composition; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - [System.Composition.Shared] - [Export(typeof(ForegroundDispatcher))] - internal class VisualStudioForegroundDispatcher : ForegroundDispatcher - { - public override TaskScheduler BackgroundScheduler { get; } = TaskScheduler.Default; - - public override TaskScheduler ForegroundScheduler { get; } = MonoDevelop.Core.Runtime.MainTaskScheduler; - - public override bool IsForegroundThread => MonoDevelop.Core.Runtime.IsMainThread; - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioMacWorkspaceAccessor.cs b/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioMacWorkspaceAccessor.cs deleted file mode 100644 index 9056f3864d..0000000000 --- a/src/Razor/src/Microsoft.VisualStudio.Mac.LanguageServices.Razor/VisualStudioMacWorkspaceAccessor.cs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.Editor.Razor; -using MonoDevelop.Projects; -using Workspace = Microsoft.CodeAnalysis.Workspace; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - internal abstract class VisualStudioMacWorkspaceAccessor : VisualStudioWorkspaceAccessor - { - public abstract bool TryGetWorkspace(Solution solution, out Workspace workspace); - } -} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common.csproj b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common.csproj deleted file mode 100644 index c32bd85577..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common.csproj +++ /dev/null @@ -1,16 +0,0 @@ - - - - net46;$(StandardTestTfms) - - - - - - - - - - - - diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestRazorLanguageServices.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestRazorLanguageServices.cs deleted file mode 100644 index fe33148ab0..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestRazorLanguageServices.cs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.CodeAnalysis.Host -{ - internal class TestRazorLanguageServices : HostLanguageServices - { - private readonly HostWorkspaceServices _workspaceServices; - private readonly IEnumerable _languageServices; - - public TestRazorLanguageServices(HostWorkspaceServices workspaceServices, IEnumerable languageServices) - { - if (workspaceServices == null) - { - throw new ArgumentNullException(nameof(workspaceServices)); - } - - if (languageServices == null) - { - throw new ArgumentNullException(nameof(languageServices)); - } - - _workspaceServices = workspaceServices; - _languageServices = languageServices; - } - - public override HostWorkspaceServices WorkspaceServices => _workspaceServices; - - public override string Language => RazorLanguage.Name; - - public override TLanguageService GetService() - { - var service = _languageServices.OfType().FirstOrDefault(); - - if (service == null) - { - throw new InvalidOperationException($"Test Razor language services not configured properly, missing language service '{typeof(TLanguageService).FullName}'."); - } - - return service; - } - } -} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestServices.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestServices.cs deleted file mode 100644 index a9e53de621..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestServices.cs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; - -namespace Microsoft.CodeAnalysis.Host -{ - public class TestServices : HostServices - { - private readonly IEnumerable _workspaceServices; - private readonly IEnumerable _razorLanguageServices; - - private TestServices(IEnumerable workspaceServices, IEnumerable razorLanguageServices) - { - if (workspaceServices == null) - { - throw new ArgumentNullException(nameof(workspaceServices)); - } - - if (razorLanguageServices == null) - { - throw new ArgumentNullException(nameof(razorLanguageServices)); - } - - _workspaceServices = workspaceServices; - _razorLanguageServices = razorLanguageServices; - } - - protected override HostWorkspaceServices CreateWorkspaceServices(Workspace workspace) - { - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - return new TestWorkspaceServices(this, _workspaceServices, _razorLanguageServices, workspace); - } - - public static HostServices Create(IEnumerable razorLanguageServices) - => Create(Enumerable.Empty(), razorLanguageServices); - - public static HostServices Create(IEnumerable workspaceServices, IEnumerable razorLanguageServices) - => new TestServices(workspaceServices, razorLanguageServices); - } -} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestWorkspace.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestWorkspace.cs deleted file mode 100644 index 02dcab53d5..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestWorkspace.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Host; - -namespace Microsoft.CodeAnalysis -{ - public static class TestWorkspace - { - private static readonly object WorkspaceLock = new object(); - - public static Workspace Create(Action configure = null) => Create(services: null, configure: configure); - - public static Workspace Create(HostServices services, Action configure = null) - { - lock (WorkspaceLock) - { - var workspace = services == null ? new AdhocWorkspace() : new AdhocWorkspace(services); - configure?.Invoke(workspace); - - return workspace; - } - } - } -} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestWorkspaceServices.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestWorkspaceServices.cs deleted file mode 100644 index 66d8f42f27..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.Common/TestWorkspaceServices.cs +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.CodeAnalysis.Razor; - -namespace Microsoft.CodeAnalysis.Host -{ - internal class TestWorkspaceServices : HostWorkspaceServices - { - private static readonly Workspace DefaultWorkspace = TestWorkspace.Create(); - - private readonly HostServices _hostServices; - private readonly IEnumerable _workspaceServices; - private readonly TestRazorLanguageServices _razorLanguageServices; - private readonly Workspace _workspace; - - public TestWorkspaceServices( - HostServices hostServices, - IEnumerable workspaceServices, - IEnumerable razorLanguageServices, - Workspace workspace) - { - if (hostServices == null) - { - throw new ArgumentNullException(nameof(hostServices)); - } - - if (workspaceServices == null) - { - throw new ArgumentNullException(nameof(workspaceServices)); - } - - if (razorLanguageServices == null) - { - throw new ArgumentNullException(nameof(razorLanguageServices)); - } - - if (workspace == null) - { - throw new ArgumentNullException(nameof(workspace)); - } - - _hostServices = hostServices; - _workspaceServices = workspaceServices; - _razorLanguageServices = new TestRazorLanguageServices(this, razorLanguageServices); - _workspace = workspace; - } - - public override HostServices HostServices => _hostServices; - - public override Workspace Workspace => _workspace; - - public override TWorkspaceService GetService() - { - var service = _workspaceServices.OfType().FirstOrDefault(); - - if (service == null) - { - // Fallback to default host services to resolve roslyn specific features. - service = DefaultWorkspace.Services.GetService(); - } - - return service; - } - - public override HostLanguageServices GetLanguageServices(string languageName) - { - if (languageName != RazorLanguage.Name) - { - throw new InvalidOperationException($"Test services do not support language service '{languageName}'. The only language services supported are '{RazorLanguage.Name}'."); - } - - return _razorLanguageServices; - } - - public override IEnumerable SupportedLanguages => new[] { RazorLanguage.Name }; - - public override bool IsSupported(string languageName) => languageName == RazorLanguage.Name; - - public override IEnumerable FindLanguageServices(MetadataFilter filter) => throw new NotImplementedException(); - } -} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj deleted file mode 100644 index 1967009f1f..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Microsoft.CodeAnalysis.Razor.Workspaces.Test.csproj +++ /dev/null @@ -1,30 +0,0 @@ - - - - $(StandardTestTfms) - true - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs deleted file mode 100644 index 796b1a4e99..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Xunit; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - public class DefaultProjectSnapshotTest - { - [Fact] - public void WithWorkspaceProject_CreatesSnapshot_UpdatesUnderlyingProject() - { - // Arrange - var hostProject = new HostProject("Test.cshtml", FallbackRazorConfiguration.MVC_2_0); - var workspaceProject = GetWorkspaceProject("Test1"); - var original = new DefaultProjectSnapshot(hostProject, workspaceProject); - - var anotherProject = GetWorkspaceProject("Test1"); - - // Act - var snapshot = original.WithWorkspaceProject(anotherProject); - - // Assert - Assert.Same(anotherProject, snapshot.WorkspaceProject); - Assert.Equal(original.ComputedVersion, snapshot.ComputedVersion); - Assert.Equal(original.Configuration, snapshot.Configuration); - Assert.Equal(original.TagHelpers, snapshot.TagHelpers); - } - - [Fact] - public void WithProjectChange_WithProject_CreatesSnapshot_UpdatesValues() - { - // Arrange - var hostProject = new HostProject("Test.cshtml", FallbackRazorConfiguration.MVC_2_0); - var workspaceProject = GetWorkspaceProject("Test1"); - var original = new DefaultProjectSnapshot(hostProject, workspaceProject); - - var anotherProject = GetWorkspaceProject("Test1"); - var update = new ProjectSnapshotUpdateContext(original.FilePath, hostProject, anotherProject, original.Version) - { - TagHelpers = Array.Empty(), - }; - - // Act - var snapshot = original.WithComputedUpdate(update); - - // Assert - Assert.Same(original.WorkspaceProject, snapshot.WorkspaceProject); - Assert.Same(update.TagHelpers, snapshot.TagHelpers); - } - - [Fact] - public void HaveTagHelpersChanged_NoUpdatesToTagHelpers_ReturnsFalse() - { - // Arrange - var hostProject = new HostProject("Test1.csproj", RazorConfiguration.Default); - var workspaceProject = GetWorkspaceProject("Test1"); - var original = new DefaultProjectSnapshot(hostProject, workspaceProject); - - var anotherProject = GetWorkspaceProject("Test1"); - var update = new ProjectSnapshotUpdateContext("Test1.csproj", hostProject, anotherProject, VersionStamp.Default); - var snapshot = original.WithComputedUpdate(update); - - // Act - var result = snapshot.HaveTagHelpersChanged(original); - - // Assert - Assert.False(result); - } - - [Fact] - public void HaveTagHelpersChanged_TagHelpersUpdated_ReturnsTrue() - { - // Arrange - var hostProject = new HostProject("Test1.csproj", RazorConfiguration.Default); - var workspaceProject = GetWorkspaceProject("Test1"); - var original = new DefaultProjectSnapshot(hostProject, workspaceProject); - - var anotherProject = GetWorkspaceProject("Test1"); - var update = new ProjectSnapshotUpdateContext("Test1.csproj", hostProject, anotherProject, VersionStamp.Default) - { - TagHelpers = new[] - { - TagHelperDescriptorBuilder.Create("One", "TestAssembly").Build(), - TagHelperDescriptorBuilder.Create("Two", "TestAssembly").Build(), - }, - }; - var snapshot = original.WithComputedUpdate(update); - - // Act - var result = snapshot.HaveTagHelpersChanged(original); - - // Assert - Assert.True(result); - } - - private Project GetWorkspaceProject(string name) - { - Project project = null; - TestWorkspace.Create(workspace => - { - project = workspace.AddProject(name, LanguageNames.CSharp); - }); - return project; - } - } -} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/WorkspaceProjectSnapshotChangeTriggerTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/WorkspaceProjectSnapshotChangeTriggerTest.cs deleted file mode 100644 index 86872c08ea..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/WorkspaceProjectSnapshotChangeTriggerTest.cs +++ /dev/null @@ -1,236 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Moq; -using Xunit; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - public class WorkspaceProjectSnapshotChangeTriggerTest - { - public WorkspaceProjectSnapshotChangeTriggerTest() - { - Workspace = TestWorkspace.Create(); - EmptySolution = Workspace.CurrentSolution.GetIsolatedSolution(); - - var projectId1 = ProjectId.CreateNewId("One"); - var projectId2 = ProjectId.CreateNewId("Two"); - var projectId3 = ProjectId.CreateNewId("Three"); - - SolutionWithTwoProjects = Workspace.CurrentSolution - .AddProject(ProjectInfo.Create( - projectId1, - VersionStamp.Default, - "One", - "One", - LanguageNames.CSharp, - filePath: "One.csproj")) - .AddProject(ProjectInfo.Create( - projectId2, - VersionStamp.Default, - "Two", - "Two", - LanguageNames.CSharp, - filePath: "Two.csproj")); - - SolutionWithOneProject = EmptySolution.GetIsolatedSolution() - .AddProject(ProjectInfo.Create( - projectId3, - VersionStamp.Default, - "Three", - "Three", - LanguageNames.CSharp, - filePath: "Three.csproj")); - - ProjectNumberOne = SolutionWithTwoProjects.GetProject(projectId1); - ProjectNumberTwo = SolutionWithTwoProjects.GetProject(projectId2); - ProjectNumberThree = SolutionWithOneProject.GetProject(projectId3); - - HostProjectOne = new HostProject("One.csproj", FallbackRazorConfiguration.MVC_1_1); - HostProjectTwo = new HostProject("Two.csproj", FallbackRazorConfiguration.MVC_1_1); - HostProjectThree = new HostProject("Three.csproj", FallbackRazorConfiguration.MVC_1_1); - } - - private HostProject HostProjectOne { get; } - - private HostProject HostProjectTwo { get; } - - private HostProject HostProjectThree { get; } - - private Solution EmptySolution { get; } - - private Solution SolutionWithOneProject { get; } - - private Solution SolutionWithTwoProjects { get; } - - private Project ProjectNumberOne { get; } - - private Project ProjectNumberTwo { get; } - - private Project ProjectNumberThree { get; } - - private Workspace Workspace { get; } - - [Theory] - [InlineData(WorkspaceChangeKind.SolutionAdded)] - [InlineData(WorkspaceChangeKind.SolutionChanged)] - [InlineData(WorkspaceChangeKind.SolutionCleared)] - [InlineData(WorkspaceChangeKind.SolutionReloaded)] - [InlineData(WorkspaceChangeKind.SolutionRemoved)] - public void WorkspaceChanged_SolutionEvents_AddsProjectsInSolution(WorkspaceChangeKind kind) - { - // Arrange - var trigger = new WorkspaceProjectSnapshotChangeTrigger(); - var projectManager = new TestProjectSnapshotManager(new[] { trigger }, Workspace); - projectManager.HostProjectAdded(HostProjectOne); - projectManager.HostProjectAdded(HostProjectTwo); - - var e = new WorkspaceChangeEventArgs(kind, oldSolution: EmptySolution, newSolution: SolutionWithTwoProjects); - - // Act - trigger.Workspace_WorkspaceChanged(Workspace, e); - - // Assert - Assert.Collection( - projectManager.Projects.OrderBy(p => p.WorkspaceProject.Name), - p => Assert.Equal(ProjectNumberOne.Id, p.WorkspaceProject.Id), - p => Assert.Equal(ProjectNumberTwo.Id, p.WorkspaceProject.Id)); - } - - [Theory] - [InlineData(WorkspaceChangeKind.SolutionAdded)] - [InlineData(WorkspaceChangeKind.SolutionChanged)] - [InlineData(WorkspaceChangeKind.SolutionCleared)] - [InlineData(WorkspaceChangeKind.SolutionReloaded)] - [InlineData(WorkspaceChangeKind.SolutionRemoved)] - public void WorkspaceChanged_SolutionEvents_ClearsExistingProjects_AddsProjectsInSolution(WorkspaceChangeKind kind) - { - // Arrange - var trigger = new WorkspaceProjectSnapshotChangeTrigger(); - var projectManager = new TestProjectSnapshotManager(new[] { trigger }, Workspace); - projectManager.HostProjectAdded(HostProjectOne); - projectManager.HostProjectAdded(HostProjectTwo); - projectManager.HostProjectAdded(HostProjectThree); - - // Initialize with a project. This will get removed. - var e = new WorkspaceChangeEventArgs(WorkspaceChangeKind.SolutionAdded, oldSolution: EmptySolution, newSolution: SolutionWithOneProject); - trigger.Workspace_WorkspaceChanged(Workspace, e); - - e = new WorkspaceChangeEventArgs(kind, oldSolution: SolutionWithOneProject, newSolution: SolutionWithTwoProjects); - - // Act - trigger.Workspace_WorkspaceChanged(Workspace, e); - - // Assert - Assert.Collection( - projectManager.Projects.OrderBy(p => p.WorkspaceProject?.Name), - p => Assert.Null(p.WorkspaceProject), - p => Assert.Equal(ProjectNumberOne.Id, p.WorkspaceProject.Id), - p => Assert.Equal(ProjectNumberTwo.Id, p.WorkspaceProject.Id)); - } - - [Theory] - [InlineData(WorkspaceChangeKind.ProjectChanged)] - [InlineData(WorkspaceChangeKind.ProjectReloaded)] - public void WorkspaceChanged_ProjectChangeEvents_UpdatesProject(WorkspaceChangeKind kind) - { - // Arrange - var trigger = new WorkspaceProjectSnapshotChangeTrigger(); - var projectManager = new TestProjectSnapshotManager(new[] { trigger }, Workspace); - projectManager.HostProjectAdded(HostProjectOne); - projectManager.HostProjectAdded(HostProjectTwo); - - // Initialize with some projects. - var e = new WorkspaceChangeEventArgs(WorkspaceChangeKind.SolutionAdded, oldSolution: EmptySolution, newSolution: SolutionWithTwoProjects); - trigger.Workspace_WorkspaceChanged(Workspace, e); - - var solution = SolutionWithTwoProjects.WithProjectAssemblyName(ProjectNumberOne.Id, "Changed"); - e = new WorkspaceChangeEventArgs(kind, oldSolution: SolutionWithTwoProjects, newSolution: solution, projectId: ProjectNumberOne.Id); - - // Act - trigger.Workspace_WorkspaceChanged(Workspace, e); - - // Assert - Assert.Collection( - projectManager.Projects.OrderBy(p => p.WorkspaceProject.Name), - p => - { - Assert.Equal(ProjectNumberOne.Id, p.WorkspaceProject.Id); - Assert.Equal("Changed", p.WorkspaceProject.AssemblyName); - }, - p => Assert.Equal(ProjectNumberTwo.Id, p.WorkspaceProject.Id)); - } - - [Fact] - public void WorkspaceChanged_ProjectRemovedEvent_RemovesProject() - { - // Arrange - var trigger = new WorkspaceProjectSnapshotChangeTrigger(); - var projectManager = new TestProjectSnapshotManager(new[] { trigger }, Workspace); - projectManager.HostProjectAdded(HostProjectOne); - projectManager.HostProjectAdded(HostProjectTwo); - - // Initialize with some projects project. - var e = new WorkspaceChangeEventArgs(WorkspaceChangeKind.SolutionAdded, oldSolution: EmptySolution, newSolution: SolutionWithTwoProjects); - trigger.Workspace_WorkspaceChanged(Workspace, e); - - var solution = SolutionWithTwoProjects.RemoveProject(ProjectNumberOne.Id); - e = new WorkspaceChangeEventArgs(WorkspaceChangeKind.ProjectRemoved, oldSolution: SolutionWithTwoProjects, newSolution: solution, projectId: ProjectNumberOne.Id); - - // Act - trigger.Workspace_WorkspaceChanged(Workspace, e); - - // Assert - Assert.Collection( - projectManager.Projects.OrderBy(p => p.WorkspaceProject?.Name), - p => Assert.Null(p.WorkspaceProject), - p => Assert.Equal(ProjectNumberTwo.Id, p.WorkspaceProject.Id)); - } - - [Fact] - public void WorkspaceChanged_ProjectAddedEvent_AddsProject() - { - // Arrange - var trigger = new WorkspaceProjectSnapshotChangeTrigger(); - var projectManager = new TestProjectSnapshotManager(new[] { trigger }, Workspace); - projectManager.HostProjectAdded(HostProjectThree); - - var solution = SolutionWithOneProject; - var e = new WorkspaceChangeEventArgs(WorkspaceChangeKind.ProjectAdded, oldSolution: EmptySolution, newSolution: solution, projectId: ProjectNumberThree.Id); - - // Act - trigger.Workspace_WorkspaceChanged(Workspace, e); - - // Assert - Assert.Collection( - projectManager.Projects.OrderBy(p => p.WorkspaceProject.Name), - p => Assert.Equal(ProjectNumberThree.Id, p.WorkspaceProject.Id)); - } - - private class TestProjectSnapshotManager : DefaultProjectSnapshotManager - { - public TestProjectSnapshotManager(IEnumerable triggers, Workspace workspace) - : base(Mock.Of(), Mock.Of(), new TestProjectSnapshotWorker(), triggers, workspace) - { - } - - protected override void NotifyBackgroundWorker(ProjectSnapshotUpdateContext context) - { - Assert.NotNull(context.HostProject); - Assert.NotNull(context.WorkspaceProject); - } - } - - private class TestProjectSnapshotWorker : ProjectSnapshotWorker - { - public override Task ProcessUpdateAsync(ProjectSnapshotUpdateContext update, CancellationToken cancellationToken = default(CancellationToken)) - { - return Task.CompletedTask; - } - } - } -} diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/xunit.runner.json b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/xunit.runner.json deleted file mode 100644 index c04bb61fe6..0000000000 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/xunit.runner.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "methodDisplay": "method", - "shadowCopy": false -} \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Microsoft.VisualStudio.Editor.Razor.Test.Common.csproj b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Microsoft.VisualStudio.Editor.Razor.Test.Common.csproj deleted file mode 100644 index 18327289a4..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Microsoft.VisualStudio.Editor.Razor.Test.Common.csproj +++ /dev/null @@ -1,20 +0,0 @@ - - - - net46 - - - - - - - - - - - - - - - - diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Properties/AssemblyInfo.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Properties/AssemblyInfo.cs deleted file mode 100644 index 2ef25d5390..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,9 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Microsoft.CodeAnalysis.Razor.Workspaces.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Editor.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/StringTextSnapshot.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/StringTextSnapshot.cs deleted file mode 100644 index 39ef523739..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/StringTextSnapshot.cs +++ /dev/null @@ -1,223 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.VisualStudio.Utilities; - -namespace Microsoft.VisualStudio.Text -{ - public class StringTextSnapshot : ITextSnapshot - { - private readonly List _lines; - - public StringTextSnapshot(string content) - { - Content = content; - _lines = new List(); - - var start = 0; - var delimiterIndex = 0; - while (delimiterIndex != -1) - { - var delimiterLength = 2; - delimiterIndex = Content.IndexOf("\r\n", start); - - if (delimiterIndex == -1) - { - delimiterLength = 1; - delimiterIndex = Content.IndexOfAny(ParserHelpers.NewLineCharacters, start); - } - - var nextLineStartIndex = delimiterIndex != -1 ? delimiterIndex + delimiterLength : Content.Length; - - var lineText = Content.Substring(start, nextLineStartIndex - start); - _lines.Add(new SnapshotLine(lineText, start, this)); - - start = nextLineStartIndex; - } - } - - public string Content { get; } - - public char this[int position] => Content[position]; - - public ITextVersion Version { get; } = new TextVersion(); - - public int Length => Content.Length; - - public ITextBuffer TextBuffer => throw new NotImplementedException(); - - public IContentType ContentType => throw new NotImplementedException(); - - public int LineCount => throw new NotImplementedException(); - - public IEnumerable Lines => throw new NotImplementedException(); - - public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count) => Content.CopyTo(sourceIndex, destination, destinationIndex, count); - - public string GetText(int startIndex, int length) => Content.Substring(startIndex, length); - - public string GetText() => Content; - - public char[] ToCharArray(int startIndex, int length) => Content.ToCharArray(); - - public ITextSnapshotLine GetLineFromPosition(int position) - { - var matchingLine = _lines.FirstOrDefault(line => line.Start + line.LengthIncludingLineBreak > position); - - if (position < 0 || matchingLine == null) - { - throw new ArgumentOutOfRangeException(); - } - - return matchingLine; - } - - public ITextSnapshotLine GetLineFromLineNumber(int lineNumber) - { - if (lineNumber < 0 || lineNumber >= _lines.Count) - { - throw new ArgumentOutOfRangeException(nameof(lineNumber)); - } - - return _lines[lineNumber]; - } - - public ITrackingPoint CreateTrackingPoint(int position, PointTrackingMode trackingMode) - { - return new SnapshotTrackingPoint(position); - } - - public ITrackingPoint CreateTrackingPoint(int position, PointTrackingMode trackingMode, TrackingFidelityMode trackingFidelity) => throw new NotImplementedException(); - - public ITrackingSpan CreateTrackingSpan(VisualStudio.Text.Span span, SpanTrackingMode trackingMode) => throw new NotImplementedException(); - - public ITrackingSpan CreateTrackingSpan(VisualStudio.Text.Span span, SpanTrackingMode trackingMode, TrackingFidelityMode trackingFidelity) => throw new NotImplementedException(); - - public ITrackingSpan CreateTrackingSpan(int start, int length, SpanTrackingMode trackingMode) => throw new NotImplementedException(); - - public ITrackingSpan CreateTrackingSpan(int start, int length, SpanTrackingMode trackingMode, TrackingFidelityMode trackingFidelity) => throw new NotImplementedException(); - - public int GetLineNumberFromPosition(int position) => throw new NotImplementedException(); - - public string GetText(VisualStudio.Text.Span span) => throw new NotImplementedException(); - - public void Write(TextWriter writer, VisualStudio.Text.Span span) => throw new NotImplementedException(); - - public void Write(TextWriter writer) => throw new NotImplementedException(); - - private class TextVersion : ITextVersion - { - public INormalizedTextChangeCollection Changes { get; } = new TextChangeCollection(); - - public ITextVersion Next => throw new NotImplementedException(); - - public int Length => throw new NotImplementedException(); - - public ITextBuffer TextBuffer => throw new NotImplementedException(); - - public int VersionNumber => throw new NotImplementedException(); - - public int ReiteratedVersionNumber => throw new NotImplementedException(); - - public ITrackingSpan CreateCustomTrackingSpan(VisualStudio.Text.Span span, TrackingFidelityMode trackingFidelity, object customState, CustomTrackToVersion behavior) => throw new NotImplementedException(); - - public ITrackingPoint CreateTrackingPoint(int position, PointTrackingMode trackingMode) => throw new NotImplementedException(); - - public ITrackingPoint CreateTrackingPoint(int position, PointTrackingMode trackingMode, TrackingFidelityMode trackingFidelity) => throw new NotImplementedException(); - - public ITrackingSpan CreateTrackingSpan(VisualStudio.Text.Span span, SpanTrackingMode trackingMode) => throw new NotImplementedException(); - - public ITrackingSpan CreateTrackingSpan(VisualStudio.Text.Span span, SpanTrackingMode trackingMode, TrackingFidelityMode trackingFidelity) => throw new NotImplementedException(); - - public ITrackingSpan CreateTrackingSpan(int start, int length, SpanTrackingMode trackingMode) => throw new NotImplementedException(); - - public ITrackingSpan CreateTrackingSpan(int start, int length, SpanTrackingMode trackingMode, TrackingFidelityMode trackingFidelity) => throw new NotImplementedException(); - - private class TextChangeCollection : List, INormalizedTextChangeCollection - { - public bool IncludesLineChanges => false; - } - } - - private class SnapshotTrackingPoint : ITrackingPoint - { - private readonly int _position; - - public SnapshotTrackingPoint(int position) - { - _position = position; - } - - public ITextBuffer TextBuffer => throw new NotImplementedException(); - - public PointTrackingMode TrackingMode => throw new NotImplementedException(); - - public TrackingFidelityMode TrackingFidelity => throw new NotImplementedException(); - - public char GetCharacter(ITextSnapshot snapshot) => throw new NotImplementedException(); - - public SnapshotPoint GetPoint(ITextSnapshot snapshot) => throw new NotImplementedException(); - - public int GetPosition(ITextSnapshot snapshot) => _position; - - public int GetPosition(ITextVersion version) => throw new NotImplementedException(); - } - - private class SnapshotLine : ITextSnapshotLine - { - private readonly string _contentWithLineBreak; - private readonly string _content; - - public SnapshotLine(string contentWithLineBreak, int start, ITextSnapshot owner) - { - _contentWithLineBreak = contentWithLineBreak; - _content = contentWithLineBreak; - - if (_content.EndsWith("\r\n")) - { - _content = _content.Substring(0, _content.Length - 2); - } - else if(_content.Length > 0 && ParserHelpers.NewLineCharacters.Contains(_content[_content.Length - 1])) - { - _content = _content.Substring(0, _content.Length - 1); - } - - Start = new SnapshotPoint(owner, start); - End = new SnapshotPoint(owner, start + _content.Length); - Snapshot = owner; - LineNumber = (owner as StringTextSnapshot)._lines.Count; - } - - public ITextSnapshot Snapshot { get; } - - public SnapshotPoint Start { get; } - - public int Length => _content.Length; - - public int LengthIncludingLineBreak => _contentWithLineBreak.Length; - - public int LineBreakLength => _contentWithLineBreak.Length - _content.Length; - - public string GetText() => _content; - - public string GetLineBreakText() => _contentWithLineBreak.Substring(_content.Length); - - public string GetTextIncludingLineBreak() => _contentWithLineBreak; - - public int LineNumber { get; } - - public SnapshotPoint End { get; } - - public SnapshotSpan Extent => throw new NotImplementedException(); - - public SnapshotSpan ExtentIncludingLineBreak => throw new NotImplementedException(); - - public SnapshotPoint EndIncludingLineBreak => throw new NotImplementedException(); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundDispatcherTestBase.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundDispatcherTestBase.cs deleted file mode 100644 index 0bcbb7b697..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundDispatcherTestBase.cs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor; - -namespace Xunit -{ - public abstract class ForegroundDispatcherTestBase - { - internal ForegroundDispatcher Dispatcher { get; } = new SingleThreadedForegroundDispatcher(); - - private class SingleThreadedForegroundDispatcher : ForegroundDispatcher - { - public SingleThreadedForegroundDispatcher() - { - ForegroundScheduler = SynchronizationContext.Current == null ? new ThrowingTaskScheduler() : TaskScheduler.FromCurrentSynchronizationContext(); - BackgroundScheduler = TaskScheduler.Default; - } - - public override TaskScheduler ForegroundScheduler { get; } - - public override TaskScheduler BackgroundScheduler { get; } - - private Thread Thread { get; } = Thread.CurrentThread; - - public override bool IsForegroundThread => Thread.CurrentThread == Thread; - } - - private class ThrowingTaskScheduler : TaskScheduler - { - protected override IEnumerable GetScheduledTasks() - { - return Enumerable.Empty(); - } - - protected override void QueueTask(Task task) - { - throw new InvalidOperationException($"Use [{nameof(ForegroundFactAttribute)}]"); - } - - protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued) - { - throw new InvalidOperationException($"Use [{nameof(ForegroundFactAttribute)}]"); - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactAttribute.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactAttribute.cs deleted file mode 100644 index 1e09fb01f6..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - // Similar to WpfFactAttribute https://github.com/xunit/samples.xunit/blob/969d9f7e887836f01a6c525324bf3db55658c28f/STAExamples/WpfFactAttribute.cs - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - [XunitTestCaseDiscoverer("Xunit." + nameof(ForegroundFactDiscoverer), "Microsoft.VisualStudio.Editor.Razor.Test.Common")] - internal class ForegroundFactAttribute : FactAttribute - { - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactDiscoverer.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactDiscoverer.cs deleted file mode 100644 index 9551fd13e9..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactDiscoverer.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit -{ - internal class ForegroundFactDiscoverer : IXunitTestCaseDiscoverer - { - private readonly FactDiscoverer _inner; - - public ForegroundFactDiscoverer(IMessageSink diagnosticMessageSink) - { - _inner = new FactDiscoverer(diagnosticMessageSink); - } - - public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) - { - return _inner.Discover(discoveryOptions, testMethod, factAttribute).Select(t => new ForegroundFactTestCase(t)); - } - } -} \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactTestCase.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactTestCase.cs deleted file mode 100644 index dd0bec5456..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundFactTestCase.cs +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Threading; -using System.Threading.Tasks; -using System.Windows.Threading; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit -{ - internal class ForegroundFactTestCase : LongLivedMarshalByRefObject, IXunitTestCase - { - private IXunitTestCase _inner; - - [EditorBrowsable(EditorBrowsableState.Never)] - [Obsolete("Called by the de-serializer", error: true)] - public ForegroundFactTestCase() - { - } - - public ForegroundFactTestCase(IXunitTestCase testCase) - { - _inner = testCase; - } - - public string DisplayName => _inner.DisplayName; - - public IMethodInfo Method => _inner.Method; - - public string SkipReason => _inner.SkipReason; - - public ISourceInformation SourceInformation - { - get => _inner.SourceInformation; - set => _inner.SourceInformation = value; - } - - public ITestMethod TestMethod => _inner.TestMethod; - - public object[] TestMethodArguments => _inner.TestMethodArguments; - - public Dictionary> Traits => _inner.Traits; - - public string UniqueID => _inner.UniqueID; - - public void Deserialize(IXunitSerializationInfo info) - { - _inner = info.GetValue("InnerTestCase"); - } - - public void Serialize(IXunitSerializationInfo info) - { - info.AddValue("InnerTestCase", _inner); - } - - public Task RunAsync( - IMessageSink diagnosticMessageSink, - IMessageBus messageBus, - object[] constructorArguments, - ExceptionAggregator aggregator, - CancellationTokenSource cancellationTokenSource) - { - var tcs = new TaskCompletionSource(); - var thread = new Thread(() => - { - try - { - SynchronizationContext.SetSynchronizationContext(new DispatcherSynchronizationContext()); - - var worker = _inner.RunAsync(diagnosticMessageSink, messageBus, constructorArguments, aggregator, cancellationTokenSource); - - Exception caught = null; - var frame = new DispatcherFrame(); - Task.Run(async () => - { - try - { - await worker; - } - catch (Exception ex) - { - caught = ex; - } - finally - { - frame.Continue = false; - } - }); - - Dispatcher.PushFrame(frame); - - if (caught == null) - { - tcs.SetResult(worker.Result); - } - else - { - tcs.SetException(caught); - } - } - catch (Exception e) - { - tcs.SetException(e); - } - }); - - thread.SetApartmentState(ApartmentState.STA); - thread.Start(); - - return tcs.Task; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundTheoryAttribute.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundTheoryAttribute.cs deleted file mode 100644 index 2c13256d9a..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundTheoryAttribute.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Xunit.Sdk; - -namespace Xunit -{ - // Similar to WpfTheoryAttribute https://github.com/xunit/samples.xunit/blob/969d9f7e887836f01a6c525324bf3db55658c28f/STAExamples/WpfTheoryAttribute.cs - [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)] - [XunitTestCaseDiscoverer("Xunit.ForegroundTheoryDiscoverer", "Microsoft.VisualStudio.LanguageServices.Razor.Test")] - internal class ForegroundTheoryAttribute : TheoryAttribute - { - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundTheoryDiscoverer.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundTheoryDiscoverer.cs deleted file mode 100644 index 7088dbb7b8..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test.Common/Xunit/ForegroundTheoryDiscoverer.cs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Xunit.Abstractions; -using Xunit.Sdk; - -namespace Xunit -{ - internal class ForegroundTheoryDiscoverer : IXunitTestCaseDiscoverer - { - private readonly TheoryDiscoverer _inner; - - public ForegroundTheoryDiscoverer(IMessageSink diagnosticMessageSink) - { - _inner = new TheoryDiscoverer(diagnosticMessageSink); - } - - public IEnumerable Discover(ITestFrameworkDiscoveryOptions discoveryOptions, ITestMethod testMethod, IAttributeInfo factAttribute) - { - return _inner.Discover(discoveryOptions, testMethod, factAttribute).Select(t => new ForegroundFactTestCase(t)); - } - } -} \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterIntegrationTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterIntegrationTest.cs deleted file mode 100644 index cf7337b86f..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterIntegrationTest.cs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.VisualStudio.Test; -using Microsoft.VisualStudio.Text; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class BraceSmartIndenterIntegrationTest : BraceSmartIndenterTestBase - { - [ForegroundFact] - public void TextBuffer_OnPostChanged_IndentsInbetweenBraces_BaseIndentation() - { - // Arrange - var change = Environment.NewLine; - var initialSnapshot = new StringTextSnapshot("@{ }"); - var afterChangeSnapshot = new StringTextSnapshot("@{ " + change + "}"); - var edit = new TestEdit(3, 0, initialSnapshot, change.Length, afterChangeSnapshot, change); - var expectedIndentResult = "@{ " + change + change + "}"; - - var caret = CreateCaretFrom(3 + change.Length, afterChangeSnapshot); - TestTextBuffer textBuffer = null; - var focusedTextView = CreateFocusedTextView(() => textBuffer, caret); - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - var editorOperationsFactory = CreateOperationsFactoryService(); - var braceSmartIndenter = new BraceSmartIndenter(Dispatcher, documentTracker, editorOperationsFactory); - - // Act - textBuffer.ApplyEdit(edit); - - // Assert - Assert.Equal(expectedIndentResult, ((StringTextSnapshot)textBuffer.CurrentSnapshot).Content); - } - - [ForegroundFact] - public void TextBuffer_OnPostChanged_IndentsInbetweenBraces_OneLevelOfIndentation() - { - // Arrange - var change = "\r"; - var initialSnapshot = new StringTextSnapshot(" @{ }"); - var afterChangeSnapshot = new StringTextSnapshot(" @{ " + change + "}"); - var edit = new TestEdit(7, 0, initialSnapshot, change.Length, afterChangeSnapshot, change); - var expectedIndentResult = " @{ " + change + change + " }"; - - var caret = CreateCaretFrom(7 + change.Length, afterChangeSnapshot); - TestTextBuffer textBuffer = null; - var focusedTextView = CreateFocusedTextView(() => textBuffer, caret); - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - var editorOperationsFactory = CreateOperationsFactoryService(); - var braceSmartIndenter = new BraceSmartIndenter(Dispatcher, documentTracker, editorOperationsFactory); - - // Act - textBuffer.ApplyEdit(edit); - - // Assert - Assert.Equal(expectedIndentResult, ((StringTextSnapshot)textBuffer.CurrentSnapshot).Content); - } - - [ForegroundFact] - public void TextBuffer_OnPostChanged_IndentsInbetweenDirectiveBlockBraces() - { - // Arrange - var change = Environment.NewLine; - var initialSnapshot = new StringTextSnapshot(" @functions {}"); - var afterChangeSnapshot = new StringTextSnapshot(" @functions {" + change + "}"); - var edit = new TestEdit(16, 0, initialSnapshot, change.Length, afterChangeSnapshot, change); - var expectedIndentResult = " @functions {" + change + change + " }"; - - var caret = CreateCaretFrom(16 + change.Length, afterChangeSnapshot); - TestTextBuffer textBuffer = null; - var focusedTextView = CreateFocusedTextView(() => textBuffer, caret); - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - var editorOperationsFactory = CreateOperationsFactoryService(); - var braceSmartIndenter = new BraceSmartIndenter(Dispatcher, documentTracker, editorOperationsFactory); - - // Act - textBuffer.ApplyEdit(edit); - - // Assert - Assert.Equal(expectedIndentResult, ((StringTextSnapshot)textBuffer.CurrentSnapshot).Content); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterTest.cs deleted file mode 100644 index 9dcab10341..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterTest.cs +++ /dev/null @@ -1,299 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.VisualStudio.Test; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.Text.Operations; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class BraceSmartIndenterTest : BraceSmartIndenterTestBase - { - [Fact] - public void InsertIndent_InsertsProvidedIndentIntoBuffer() - { - // Arrange - var initialSnapshot = new StringTextSnapshot("@{ \n}"); - var expectedIndentResult = "@{ anything\n}"; - ITextBuffer textBuffer = null; - var textView = CreateFocusedTextView(() => textBuffer); - var documentTracker = CreateDocumentTracker(() => textBuffer, textView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - - // Act - BraceSmartIndenter.InsertIndent(3, "anything", textBuffer); - - // Assert - Assert.Equal(expectedIndentResult, ((StringTextSnapshot)textBuffer.CurrentSnapshot).Content); - } - - [Fact] - public void RestoreCaretTo_PlacesCursorAtProvidedPosition() - { - // Arrange - var initialSnapshot = new StringTextSnapshot("@{ \n\n}"); - var bufferPosition = new VirtualSnapshotPoint(initialSnapshot, 4); - var caret = new Mock(); - caret.Setup(c => c.MoveTo(It.IsAny())) - .Callback(point => - { - Assert.Equal(3, point.Position); - Assert.Same(initialSnapshot, point.Snapshot); - }); - ITextBuffer textBuffer = null; - var textView = CreateFocusedTextView(() => textBuffer, caret.Object); - var documentTracker = CreateDocumentTracker(() => textBuffer, textView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - - // Act - BraceSmartIndenter.RestoreCaretTo(3, textView); - - // Assert - caret.VerifyAll(); - } - - [Fact] - public void TriggerSmartIndent_ForcesEditorToMoveToEndOfLine() - { - // Arrange - var textView = CreateFocusedTextView(); - var editorOperations = new Mock(); - editorOperations.Setup(operations => operations.MoveToEndOfLine(false)); - var editorOperationsFactory = new Mock(); - var documentTracker = CreateDocumentTracker(() => Mock.Of(), textView); - editorOperationsFactory.Setup(factory => factory.GetEditorOperations(textView)) - .Returns(editorOperations.Object); - var smartIndenter = new BraceSmartIndenter(Dispatcher, documentTracker, editorOperationsFactory.Object); - - // Act - smartIndenter.TriggerSmartIndent(textView); - - // Assert - editorOperations.VerifyAll(); - } - - [Fact] - public void AfterClosingBrace_ContentAfterBrace_ReturnsFalse() - { - // Arrange - var fileSnapshot = new StringTextSnapshot("@functions\n{a\n}"); - var changePosition = 13; - var line = fileSnapshot.GetLineFromPosition(changePosition); - - // Act & Assert - Assert.False(BraceSmartIndenter.BeforeClosingBrace(0, line)); - } - - [Theory] - [InlineData("@functions\n{\n}")] - [InlineData("@functions\n{ \n}")] - [InlineData("@functions\n { \n}")] - [InlineData("@functions\n\t\t{\t\t\n}")] - public void AfterClosingBrace_BraceBeforePosition_ReturnsTrue(string fileContent) - { - // Arrange - var fileSnapshot = new StringTextSnapshot(fileContent); - var changePosition = fileContent.Length - 3 /* \n} */; - var line = fileSnapshot.GetLineFromPosition(changePosition); - - // Act & Assert - Assert.True(BraceSmartIndenter.AfterOpeningBrace(line.Length - 1, line)); - } - - [Fact] - public void BeforeClosingBrace_ContentPriorToBrace_ReturnsFalse() - { - // Arrange - var fileSnapshot = new StringTextSnapshot("@functions\n{\na}"); - var changePosition = 12; - var line = fileSnapshot.GetLineFromPosition(changePosition + 1 /* \n */); - - // Act & Assert - Assert.False(BraceSmartIndenter.BeforeClosingBrace(0, line)); - } - - [Theory] - [InlineData("@functions\n{\n}")] - [InlineData("@functions\n{\n }")] - [InlineData("@functions\n{\n } ")] - [InlineData("@functions\n{\n\t\t } ")] - public void BeforeClosingBrace_BraceAfterPosition_ReturnsTrue(string fileContent) - { - // Arrange - var fileSnapshot = new StringTextSnapshot(fileContent); - var changePosition = 12; - var line = fileSnapshot.GetLineFromPosition(changePosition + 1 /* \n */); - - // Act & Assert - Assert.True(BraceSmartIndenter.BeforeClosingBrace(0, line)); - } - - [ForegroundFact] - public void TextBuffer_OnChanged_NoopsIfNoChanges() - { - // Arrange - var editorOperationsFactory = new Mock(); - var changeCollection = new TestTextChangeCollection(); - var textContentChangeArgs = new TestTextContentChangedEventArgs(changeCollection); - var documentTracker = CreateDocumentTracker(() => Mock.Of(), Mock.Of()); - var braceSmartIndenter = new BraceSmartIndenter(Dispatcher, documentTracker, editorOperationsFactory.Object); - - // Act & Assert - braceSmartIndenter.TextBuffer_OnChanged(null, textContentChangeArgs); - } - - [ForegroundFact] - public void TextBuffer_OnChanged_NoopsIfChangesThatResultInNoChange() - { - // Arrange - var initialSnapshot = new StringTextSnapshot("Hello World"); - var textBuffer = new TestTextBuffer(initialSnapshot); - var edit = new TestEdit(0, 0, initialSnapshot, 0, initialSnapshot, string.Empty); - var editorOperationsFactory = new Mock(); - var documentTracker = CreateDocumentTracker(() => textBuffer, Mock.Of()); - var braceSmartIndenter = new BraceSmartIndenter(Dispatcher, documentTracker, editorOperationsFactory.Object); - - // Act & Assert - textBuffer.ApplyEdits(edit, edit); - } - - [Fact] - public void TryCreateIndentationContext_ReturnsFalseIfNoFocusedTextView() - { - // Arrange - var snapshot = new StringTextSnapshot(Environment.NewLine + "Hello World"); - ITextBuffer textBuffer = null; - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView: null); - textBuffer = CreateTextBuffer(snapshot, documentTracker); - - // Act - var result = BraceSmartIndenter.TryCreateIndentationContext(0, Environment.NewLine.Length, Environment.NewLine, documentTracker, out var context); - - // Assert - Assert.Null(context); - Assert.False(result); - } - - [Fact] - public void TryCreateIndentationContext_ReturnsFalseIfTextChangeIsNotNewline() - { - // Arrange - var snapshot = new StringTextSnapshot("This Hello World"); - ITextBuffer textBuffer = null; - var focusedTextView = CreateFocusedTextView(() => textBuffer); - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView); - textBuffer = CreateTextBuffer(snapshot, documentTracker); - - // Act - var result = BraceSmartIndenter.TryCreateIndentationContext(0, 5, "This ", documentTracker, out var context); - - // Assert - Assert.Null(context); - Assert.False(result); - } - - [Fact] - public void TryCreateIndentationContext_ReturnsFalseIfNewLineIsNotPrecededByOpenBrace_FileStart() - { - // Arrange - var initialSnapshot = new StringTextSnapshot(Environment.NewLine + "Hello World"); - ITextBuffer textBuffer = null; - var focusedTextView = CreateFocusedTextView(() => textBuffer); - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - - // Act - var result = BraceSmartIndenter.TryCreateIndentationContext(0, Environment.NewLine.Length, Environment.NewLine, documentTracker, out var context); - - // Assert - Assert.Null(context); - Assert.False(result); - } - - [Fact] - public void TryCreateIndentationContext_ReturnsFalseIfNewLineIsNotPrecededByOpenBrace_MidFile() - { - // Arrange - var initialSnapshot = new StringTextSnapshot("Hello\u0085World"); - ITextBuffer textBuffer = null; - var focusedTextView = CreateFocusedTextView(() => textBuffer); - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - - // Act - var result = BraceSmartIndenter.TryCreateIndentationContext(5, 1, "\u0085", documentTracker, out var context); - - // Assert - Assert.Null(context); - Assert.False(result); - } - - [Fact] - public void TryCreateIndentationContext_ReturnsFalseIfNewLineIsNotFollowedByCloseBrace() - { - // Arrange - var initialSnapshot = new StringTextSnapshot("@{ " + Environment.NewLine + "World"); - ITextBuffer textBuffer = null; - var focusedTextView = CreateFocusedTextView(() => textBuffer); - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - - // Act - var result = BraceSmartIndenter.TryCreateIndentationContext(3, Environment.NewLine.Length, Environment.NewLine, documentTracker, out var context); - - // Assert - Assert.Null(context); - Assert.False(result); - } - - [Fact] - public void TryCreateIndentationContext_ReturnsTrueIfNewLineIsSurroundedByBraces() - { - // Arrange - var initialSnapshot = new StringTextSnapshot("@{ \n}"); - ITextBuffer textBuffer = null; - var focusedTextView = CreateFocusedTextView(() => textBuffer); - var documentTracker = CreateDocumentTracker(() => textBuffer, focusedTextView); - textBuffer = CreateTextBuffer(initialSnapshot, documentTracker); - - // Act - var result = BraceSmartIndenter.TryCreateIndentationContext(3, 1, "\n", documentTracker, out var context); - - // Assert - Assert.NotNull(context); - Assert.Same(focusedTextView, context.FocusedTextView); - Assert.Equal(3, context.ChangePosition); - Assert.True(result); - } - - protected class TestTextContentChangedEventArgs : TextContentChangedEventArgs - { - public TestTextContentChangedEventArgs(INormalizedTextChangeCollection changeCollection) - : base(CreateBeforeSnapshot(changeCollection), new Mock().Object, EditOptions.DefaultMinimalChange, null) - { - } - - protected static ITextSnapshot CreateBeforeSnapshot(INormalizedTextChangeCollection collection) - { - var version = new Mock(); - version.Setup(v => v.Changes) - .Returns(collection); - var snapshot = new Mock(); - snapshot.Setup(obj => obj.Version) - .Returns(version.Object); - - return snapshot.Object; - } - } - - protected class TestTextChangeCollection : List, INormalizedTextChangeCollection - { - public bool IncludesLineChanges => throw new NotImplementedException(); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterTestBase.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterTestBase.cs deleted file mode 100644 index 679d2674c5..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/BraceSmartIndenterTestBase.cs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.VisualStudio.Test; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.Text.Operations; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class BraceSmartIndenterTestBase : ForegroundDispatcherTestBase - { - protected static VisualStudioDocumentTracker CreateDocumentTracker(Func bufferAccessor, ITextView focusedTextView) - { - var tracker = new Mock(); - tracker.Setup(t => t.TextBuffer) - .Returns(bufferAccessor); - tracker.Setup(t => t.GetFocusedTextView()) - .Returns(focusedTextView); - - return tracker.Object; - } - - protected static ITextView CreateFocusedTextView(Func textBufferAccessor = null, ITextCaret caret = null) - { - var focusedTextView = new Mock(); - focusedTextView.Setup(textView => textView.HasAggregateFocus) - .Returns(true); - - if (textBufferAccessor != null) - { - focusedTextView.Setup(textView => textView.TextBuffer) - .Returns(textBufferAccessor); - } - - if (caret != null) - { - focusedTextView.Setup(textView => textView.Caret) - .Returns(caret); - } - - return focusedTextView.Object; - } - - protected static ITextCaret CreateCaretFrom(int position, ITextSnapshot snapshot) - { - var bufferPosition = new VirtualSnapshotPoint(snapshot, position); - var caret = new Mock(); - caret.Setup(c => c.Position) - .Returns(new CaretPosition(bufferPosition, new Mock().Object, PositionAffinity.Predecessor)); - caret.Setup(c => c.MoveTo(It.IsAny())); - - return caret.Object; - } - - protected static IEditorOperationsFactoryService CreateOperationsFactoryService() - { - var editorOperations = new Mock(); - editorOperations.Setup(operations => operations.MoveToEndOfLine(false)); - var editorOperationsFactory = new Mock(); - editorOperationsFactory.Setup(factory => factory.GetEditorOperations(It.IsAny())) - .Returns(editorOperations.Object); - - return editorOperationsFactory.Object; - } - - protected static TestTextBuffer CreateTextBuffer(ITextSnapshot initialSnapshot, VisualStudioDocumentTracker documentTracker) - { - var textBuffer = new TestTextBuffer(initialSnapshot); - textBuffer.Properties.AddProperty(typeof(VisualStudioDocumentTracker), documentTracker); - - return textBuffer; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultCodeDocumentProviderTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultCodeDocumentProviderTest.cs deleted file mode 100644 index 41e382cc04..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultCodeDocumentProviderTest.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.VisualStudio.Text; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultCodeDocumentProviderTest - { - [Fact] - public void TryGetFromDocument_ReturnsFalseIfBufferProviderCanNotGetAssociatedBuffer() - { - // Arrange - ITextBuffer textBuffer; - RazorCodeDocument codeDocument; - var bufferProvider = new Mock(); - bufferProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out textBuffer)) - .Returns(false); - var vsCodeDocumentProvider = new Mock(); - vsCodeDocumentProvider.Setup(provider => provider.TryGetFromBuffer(It.IsAny(), out codeDocument)) - .Returns(true); - var codeDocumentProvider = new DefaultCodeDocumentProvider(bufferProvider.Object, vsCodeDocumentProvider.Object); - var document = new Mock(); - - // Act - var result = codeDocumentProvider.TryGetFromDocument(document.Object, out codeDocument); - - // Assert - Assert.False(result); - Assert.Null(codeDocument); - } - - [Fact] - public void TryGetFromDocument_ReturnsFalseIfVSProviderCanNotGetCodeDocument() - { - // Arrange - var textBuffer = new Mock().Object; - RazorCodeDocument codeDocument; - var bufferProvider = new Mock(); - bufferProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out textBuffer)) - .Returns(true); - var vsCodeDocumentProvider = new Mock(); - vsCodeDocumentProvider.Setup(provider => provider.TryGetFromBuffer(It.Is(val => val == textBuffer), out codeDocument)) - .Returns(false); - var codeDocumentProvider = new DefaultCodeDocumentProvider(bufferProvider.Object, vsCodeDocumentProvider.Object); - var document = new Mock(); - - // Act - var result = codeDocumentProvider.TryGetFromDocument(document.Object, out codeDocument); - - // Assert - Assert.False(result); - Assert.Null(codeDocument); - } - - [Fact] - public void TryGetFromDocument_ReturnsTrueIfBothBufferAndVSProviderReturnTrue() - { - // Arrange - var textBuffer = new Mock().Object; - var expectedCodeDocument = new Mock().Object; - var bufferProvider = new Mock(); - bufferProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out textBuffer)) - .Returns(true); - var vsCodeDocumentProvider = new Mock(); - vsCodeDocumentProvider.Setup(provider => provider.TryGetFromBuffer(It.Is(val => val == textBuffer), out expectedCodeDocument)) - .Returns(true); - var codeDocumentProvider = new DefaultCodeDocumentProvider(bufferProvider.Object, vsCodeDocumentProvider.Object); - var document = new Mock(); - - // Act - var result = codeDocumentProvider.TryGetFromDocument(document.Object, out var codeDocument); - - // Assert - Assert.True(result); - Assert.Same(expectedCodeDocument, codeDocument); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultEditorSettingsManagerTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultEditorSettingsManagerTest.cs deleted file mode 100644 index fdf27056d3..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultEditorSettingsManagerTest.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Razor.Editor; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultEditorSettingsManagerTest : ForegroundDispatcherTestBase - { - [Fact] - public void InitialSettingsAreDefault() - { - // Act - var manager = new DefaultEditorSettingsManager(Dispatcher); - - // Assert - Assert.Equal(EditorSettings.Default, manager.Current); - } - - [Fact] - public void Update_TriggersChangedIfEditorSettingsAreDifferent() - { - // Arrange - var manager = new DefaultEditorSettingsManager(Dispatcher); - var called = false; - manager.Changed += (caller, args) => - { - called = true; - }; - var settings = new EditorSettings(indentWithTabs: true, indentSize: 7); - - // Act - manager.Update(settings); - - // Assert - Assert.True(called); - Assert.Equal(settings, manager.Current); - } - - [Fact] - public void Update_DoesNotTriggerChangedIfEditorSettingsAreSame() - { - // Arrange - var manager = new DefaultEditorSettingsManager(Dispatcher); - var called = false; - manager.Changed += (caller, args) => - { - called = true; - }; - var originalSettings = manager.Current; - - // Act - manager.Update(EditorSettings.Default); - - // Assert - Assert.False(called); - Assert.Same(originalSettings, manager.Current); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultImportDocumentManagerIntegrationTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultImportDocumentManagerIntegrationTest.cs deleted file mode 100644 index 7a818f8c54..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultImportDocumentManagerIntegrationTest.cs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Mvc.Razor.Extensions; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultImportDocumentManagerIntegrationTest : ForegroundDispatcherTestBase - { - [ForegroundFact] - public void Changed_TrackerChanged_ResultsInChangedHavingCorrectArgs() - { - // Arrange - var filePath = "C:\\path\\to\\project\\Views\\Home\\file.cshtml"; - var anotherFilePath = "C:\\path\\to\\project\\anotherFile.cshtml"; - var projectPath = "C:\\path\\to\\project\\project.csproj"; - var testImportsPath = "C:\\path\\to\\project\\_ViewImports.cshtml"; - var tracker = Mock.Of(t => t.FilePath == filePath && t.ProjectPath == projectPath); - var anotherTracker = Mock.Of(t => t.FilePath == anotherFilePath && t.ProjectPath == projectPath); - var projectEngineFactoryService = GetProjectEngineFactoryService(); - var fileChangeTracker = new Mock(); - fileChangeTracker.Setup(f => f.FilePath).Returns(testImportsPath); - var fileChangeTrackerFactory = new Mock(); - fileChangeTrackerFactory - .Setup(f => f.Create(testImportsPath)) - .Returns(fileChangeTracker.Object); - fileChangeTrackerFactory - .Setup(f => f.Create("C:\\path\\to\\project\\Views\\_ViewImports.cshtml")) - .Returns(Mock.Of()); - fileChangeTrackerFactory - .Setup(f => f.Create("C:\\path\\to\\project\\Views\\Home\\_ViewImports.cshtml")) - .Returns(Mock.Of()); - - var called = false; - var manager = new DefaultImportDocumentManager(Dispatcher, new DefaultErrorReporter(), fileChangeTrackerFactory.Object, projectEngineFactoryService); - manager.OnSubscribed(tracker); - manager.OnSubscribed(anotherTracker); - manager.Changed += (sender, args) => - { - called = true; - Assert.Same(sender, manager); - Assert.Equal(testImportsPath, args.FilePath); - Assert.Equal(FileChangeKind.Changed, args.Kind); - Assert.Collection( - args.AssociatedDocuments, - f => Assert.Equal(filePath, f), - f => Assert.Equal(anotherFilePath, f)); - }; - - // Act - fileChangeTracker.Raise(t => t.Changed += null, new FileChangeEventArgs(testImportsPath, FileChangeKind.Changed)); - - // Assert - Assert.True(called); - } - - private RazorProjectEngineFactoryService GetProjectEngineFactoryService() - { - var projectManager = new Mock(); - projectManager.Setup(p => p.Projects).Returns(Array.Empty()); - - var projectEngineFactory = new Mock(); - projectEngineFactory.Setup(s => s.Create(It.IsAny(), It.IsAny(), It.IsAny>())) - .Returns>( - (c, fs, b) => RazorProjectEngine.Create( - RazorConfiguration.Default, - fs, - builder => RazorExtensions.Register(builder))); - - var service = new DefaultProjectEngineFactoryService( - projectManager.Object, - projectEngineFactory.Object, - new Lazy[0]); - return service; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultImportDocumentManagerTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultImportDocumentManagerTest.cs deleted file mode 100644 index 0afd8a633a..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultImportDocumentManagerTest.cs +++ /dev/null @@ -1,162 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Mvc.Razor.Extensions; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultImportDocumentManagerTest : ForegroundDispatcherTestBase - { - [ForegroundFact] - public void OnSubscribed_StartsFileChangeTrackers() - { - // Arrange - var filePath = "C:\\path\\to\\project\\Views\\Home\\file.cshtml"; - var projectPath = "C:\\path\\to\\project\\project.csproj"; - var tracker = Mock.Of(t => t.FilePath == filePath && t.ProjectPath == projectPath); - var projectEngineService = GetProjectEngineFactoryService(); - var fileChangeTracker1 = new Mock(); - fileChangeTracker1.Setup(f => f.StartListening()).Verifiable(); - var fileChangeTrackerFactory = new Mock(); - fileChangeTrackerFactory - .Setup(f => f.Create("C:\\path\\to\\project\\Views\\Home\\_ViewImports.cshtml")) - .Returns(fileChangeTracker1.Object) - .Verifiable(); - var fileChangeTracker2 = new Mock(); - fileChangeTracker2.Setup(f => f.StartListening()).Verifiable(); - fileChangeTrackerFactory - .Setup(f => f.Create("C:\\path\\to\\project\\Views\\_ViewImports.cshtml")) - .Returns(fileChangeTracker2.Object) - .Verifiable(); - var fileChangeTracker3 = new Mock(); - fileChangeTracker3.Setup(f => f.StartListening()).Verifiable(); - fileChangeTrackerFactory - .Setup(f => f.Create("C:\\path\\to\\project\\_ViewImports.cshtml")) - .Returns(fileChangeTracker3.Object) - .Verifiable(); - - var manager = new DefaultImportDocumentManager(Dispatcher, new DefaultErrorReporter(), fileChangeTrackerFactory.Object, projectEngineService); - - // Act - manager.OnSubscribed(tracker); - - // Assert - fileChangeTrackerFactory.Verify(); - fileChangeTracker1.Verify(); - fileChangeTracker2.Verify(); - fileChangeTracker3.Verify(); - } - - [ForegroundFact] - public void OnSubscribed_AlreadySubscribed_DoesNothing() - { - // Arrange - var filePath = "C:\\path\\to\\project\\file.cshtml"; - var projectPath = "C:\\path\\to\\project\\project.csproj"; - var tracker = Mock.Of(t => t.FilePath == filePath && t.ProjectPath == projectPath); - var projectEngineService = GetProjectEngineFactoryService(); - - var callCount = 0; - var fileChangeTrackerFactory = new Mock(); - fileChangeTrackerFactory - .Setup(f => f.Create(It.IsAny())) - .Returns(Mock.Of()) - .Callback(() => callCount++); - - var manager = new DefaultImportDocumentManager(Dispatcher, new DefaultErrorReporter(), fileChangeTrackerFactory.Object, projectEngineService); - manager.OnSubscribed(tracker); // Start tracking the import. - - var anotherFilePath = "C:\\path\\to\\project\\anotherFile.cshtml"; - var anotherTracker = Mock.Of(t => t.FilePath == anotherFilePath && t.ProjectPath == projectPath); - - // Act - manager.OnSubscribed(anotherTracker); - - // Assert - Assert.Equal(1, callCount); - } - - [ForegroundFact] - public void OnUnsubscribed_StopsFileChangeTracker() - { - // Arrange - var filePath = "C:\\path\\to\\project\\file.cshtml"; - var projectPath = "C:\\path\\to\\project\\project.csproj"; - var tracker = Mock.Of(t => t.FilePath == filePath && t.ProjectPath == projectPath); - var projectEngineService = GetProjectEngineFactoryService(); - - var fileChangeTracker = new Mock(); - fileChangeTracker.Setup(f => f.StopListening()).Verifiable(); - var fileChangeTrackerFactory = new Mock(MockBehavior.Strict); - fileChangeTrackerFactory - .Setup(f => f.Create("C:\\path\\to\\project\\_ViewImports.cshtml")) - .Returns(fileChangeTracker.Object) - .Verifiable(); - - var manager = new DefaultImportDocumentManager(Dispatcher, new DefaultErrorReporter(), fileChangeTrackerFactory.Object, projectEngineService); - manager.OnSubscribed(tracker); // Start tracking the import. - - // Act - manager.OnUnsubscribed(tracker); - - // Assert - fileChangeTrackerFactory.Verify(); - fileChangeTracker.Verify(); - } - - [ForegroundFact] - public void OnUnsubscribed_AnotherDocumentTrackingImport_DoesNotStopFileChangeTracker() - { - // Arrange - var filePath = "C:\\path\\to\\project\\file.cshtml"; - var projectPath = "C:\\path\\to\\project\\project.csproj"; - var tracker = Mock.Of(t => t.FilePath == filePath && t.ProjectPath == projectPath); - var projectEngineService = GetProjectEngineFactoryService(); - - var fileChangeTracker = new Mock(); - fileChangeTracker - .Setup(f => f.StopListening()) - .Throws(new InvalidOperationException()); - var fileChangeTrackerFactory = new Mock(); - fileChangeTrackerFactory - .Setup(f => f.Create(It.IsAny())) - .Returns(fileChangeTracker.Object); - - var manager = new DefaultImportDocumentManager(Dispatcher, new DefaultErrorReporter(), fileChangeTrackerFactory.Object, projectEngineService); - manager.OnSubscribed(tracker); // Starts tracking import for the first document. - - var anotherFilePath = "C:\\path\\to\\project\\anotherFile.cshtml"; - var anotherTracker = Mock.Of(t => t.FilePath == anotherFilePath && t.ProjectPath == projectPath); - manager.OnSubscribed(anotherTracker); // Starts tracking import for the second document. - - // Act & Assert (Does not throw) - manager.OnUnsubscribed(tracker); - } - - private RazorProjectEngineFactoryService GetProjectEngineFactoryService() - { - var projectManager = new Mock(); - projectManager.Setup(p => p.Projects).Returns(Array.Empty()); - - var projectEngineFactory = new Mock(); - projectEngineFactory.Setup(s => s.Create(It.IsAny(), It.IsAny(), It.IsAny>())) - .Returns>( - (c, fs, b) => RazorProjectEngine.Create( - RazorConfiguration.Default, - fs, - builder => RazorExtensions.Register(builder))); - - var service = new DefaultProjectEngineFactoryService( - projectManager.Object, - projectEngineFactory.Object, - new Lazy[0]); - return service; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultProjectEngineFactoryServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultProjectEngineFactoryServiceTest.cs deleted file mode 100644 index 3470d61409..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultProjectEngineFactoryServiceTest.cs +++ /dev/null @@ -1,238 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Linq; -using System.Reflection; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Moq; -using Xunit; -using Mvc1_X = Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X; -using MvcLatest = Microsoft.AspNetCore.Mvc.Razor.Extensions; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultProjectEngineFactoryServiceTest - { - public DefaultProjectEngineFactoryServiceTest() - { - Project project = null; - - Workspace = TestWorkspace.Create(workspace => - { - var info = ProjectInfo.Create(ProjectId.CreateNewId("Test"), VersionStamp.Default, "Test", "Test", LanguageNames.CSharp, filePath: "/TestPath/SomePath/Test.csproj"); - project = workspace.CurrentSolution.AddProject(info).GetProject(info.Id); - }); - - WorkspaceProject = project; - - HostProject_For_1_0 = new HostProject("/TestPath/SomePath/Test.csproj", FallbackRazorConfiguration.MVC_1_0); - HostProject_For_1_1 = new HostProject("/TestPath/SomePath/Test.csproj", FallbackRazorConfiguration.MVC_1_1); - HostProject_For_2_0 = new HostProject("/TestPath/SomePath/Test.csproj", FallbackRazorConfiguration.MVC_2_0); - - HostProject_For_2_1 = new HostProject( - "/TestPath/SomePath/Test.csproj", - new ProjectSystemRazorConfiguration(RazorLanguageVersion.Version_2_1, "MVC-2.1", Array.Empty())); - HostProject_For_UnknownConfiguration = new HostProject( - "/TestPath/SomePath/Test.csproj", - new ProjectSystemRazorConfiguration(RazorLanguageVersion.Version_2_1, "Blazor-0.1", Array.Empty())); - - - CustomFactories = new Lazy[] - { - new Lazy( - () => new LegacyProjectEngineFactory_1_0(), - typeof(LegacyProjectEngineFactory_1_0).GetCustomAttribute()), - new Lazy( - () => new LegacyProjectEngineFactory_1_1(), - typeof(LegacyProjectEngineFactory_1_1).GetCustomAttribute()), - new Lazy( - () => new LegacyProjectEngineFactory_2_0(), - typeof(LegacyProjectEngineFactory_2_0).GetCustomAttribute()), - new Lazy( - () => new LegacyProjectEngineFactory_2_1(), - typeof(LegacyProjectEngineFactory_2_1).GetCustomAttribute()), - }; - - FallbackFactory = new FallbackProjectEngineFactory(); - } - - private Lazy[] CustomFactories { get; } - - private IFallbackProjectEngineFactory FallbackFactory { get; } - - private HostProject HostProject_For_1_0 { get; } - - private HostProject HostProject_For_1_1 { get; } - - private HostProject HostProject_For_2_0 { get; } - - private HostProject HostProject_For_2_1 { get; } - - private HostProject HostProject_For_UnknownConfiguration { get; } - - // We don't actually look at the project, we rely on the ProjectStateManager - private Project WorkspaceProject { get; } - - private Workspace Workspace { get; } - - [Fact] - public void Create_CreatesDesignTimeTemplateEngine_ForVersion2_1() - { - // Arrange - var projectManager = new TestProjectSnapshotManager(Workspace); - projectManager.HostProjectAdded(HostProject_For_2_1); - projectManager.WorkspaceProjectAdded(WorkspaceProject); - - var factoryService = new DefaultProjectEngineFactoryService(projectManager, FallbackFactory, CustomFactories); - - // Act - var engine = factoryService.Create("/TestPath/SomePath/", b => - { - b.Features.Add(new MyCoolNewFeature()); - }); - - // Assert - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - } - - [Fact] - public void Create_CreatesDesignTimeTemplateEngine_ForVersion2_0() - { - // Arrange - var projectManager = new TestProjectSnapshotManager(Workspace); - projectManager.HostProjectAdded(HostProject_For_2_0); - projectManager.WorkspaceProjectAdded(WorkspaceProject); - - var factoryService = new DefaultProjectEngineFactoryService(projectManager, FallbackFactory, CustomFactories); - - // Act - var engine = factoryService.Create("/TestPath/SomePath/", b => - { - b.Features.Add(new MyCoolNewFeature()); - }); - - // Assert - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - } - - [Fact] - public void Create_CreatesTemplateEngine_ForVersion1_1() - { - // Arrange - var projectManager = new TestProjectSnapshotManager(Workspace); - projectManager.HostProjectAdded(HostProject_For_1_1); - projectManager.WorkspaceProjectAdded(WorkspaceProject); - - var factoryService = new DefaultProjectEngineFactoryService(projectManager, FallbackFactory, CustomFactories); - - // Act - var engine = factoryService.Create("/TestPath/SomePath/", b => - { - b.Features.Add(new MyCoolNewFeature()); - }); - - // Assert - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - } - - [Fact] - public void Create_DoesNotSupportViewComponentTagHelpers_ForVersion1_0() - { - // Arrange - var projectManager = new TestProjectSnapshotManager(Workspace); - projectManager.HostProjectAdded(HostProject_For_1_0); - projectManager.WorkspaceProjectAdded(WorkspaceProject); - - var factoryService = new DefaultProjectEngineFactoryService(projectManager, FallbackFactory, CustomFactories); - - // Act - var engine = factoryService.Create("/TestPath/SomePath/", b => - { - b.Features.Add(new MyCoolNewFeature()); - }); - - // Assert - Assert.Single(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); - } - - [Fact] - public void Create_UnknownProject_UsesVersion2_0() - { - // Arrange - var projectManager = new TestProjectSnapshotManager(Workspace); - - var factoryService = new DefaultProjectEngineFactoryService(projectManager, FallbackFactory, CustomFactories); - - // Act - var engine = factoryService.Create("/TestPath/DifferentPath/", b => - { - b.Features.Add(new MyCoolNewFeature()); - }); - - // Assert - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - Assert.Single(engine.Engine.Features.OfType()); - } - - [Fact] - public void Create_ForUnknownConfiguration_UsesFallbackFactory() - { - // Arrange - var projectManager = new TestProjectSnapshotManager(Workspace); - projectManager.HostProjectAdded(HostProject_For_UnknownConfiguration); - projectManager.WorkspaceProjectAdded(WorkspaceProject); - - var factoryService = new DefaultProjectEngineFactoryService(projectManager, FallbackFactory, CustomFactories); - - // Act - var engine = factoryService.Create("/TestPath/SomePath/", b => - { - b.Features.Add(new MyCoolNewFeature()); - }); - - // Assert - Assert.Single(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); - Assert.Empty(engine.Engine.Features.OfType()); - } - - private class MyCoolNewFeature : IRazorEngineFeature - { - public RazorEngine Engine { get; set; } - } - - private class TestProjectSnapshotManager : DefaultProjectSnapshotManager - { - public TestProjectSnapshotManager(Workspace workspace) - : base( - Mock.Of(), - Mock.Of(), - Mock.Of(), - Enumerable.Empty(), - workspace) - { - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorDocumentManagerTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorDocumentManagerTest.cs deleted file mode 100644 index 3cd9f5fb81..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorDocumentManagerTest.cs +++ /dev/null @@ -1,226 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Collections.ObjectModel; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.Utilities; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultRazorDocumentManagerTest : ForegroundDispatcherTestBase - { - private IContentType RazorCoreContentType { get; } = Mock.Of(c => c.IsOfType(RazorLanguage.CoreContentType) == true); - - private IContentType NonRazorCoreContentType { get; } = Mock.Of(c => c.IsOfType(It.IsAny()) == false); - - private string FilePath => "C:/Some/Path/TestDocumentTracker.cshtml"; - - private string ProjectPath => "C:/Some/Path/TestProject.csproj"; - - private ProjectSnapshotManager ProjectManager => Mock.Of(p => p.Projects == new List()); - - private WorkspaceEditorSettings WorkspaceEditorSettings => new DefaultWorkspaceEditorSettings(Dispatcher, Mock.Of()); - - private ImportDocumentManager ImportDocumentManager => Mock.Of(); - - private Workspace Workspace => TestWorkspace.Create(); - - private TextBufferProjectService SupportedProjectService { get; } = Mock.Of( - s => s.GetHostProject(It.IsAny()) == Mock.Of() && - s.IsSupportedProject(It.IsAny()) == true && - s.GetProjectPath(It.IsAny()) == "C:/Some/Path/TestProject.csproj"); - - private TextBufferProjectService UnsupportedProjectService { get; } = Mock.Of(s => s.IsSupportedProject(It.IsAny()) == false); - - [ForegroundFact] - public void OnTextViewOpened_ForNonRazorCoreProject_DoesNothing() - { - // Arrange - var editorFactoryService = new Mock(MockBehavior.Strict); - var documentManager = new DefaultRazorDocumentManager(Dispatcher, editorFactoryService.Object, UnsupportedProjectService); - var textView = Mock.Of(); - var buffers = new Collection() - { - Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()), - }; - - // Act & Assert - documentManager.OnTextViewOpened(textView, buffers); - } - - [ForegroundFact] - public void OnTextViewOpened_ForNonRazorTextBuffer_DoesNothing() - { - // Arrange - var editorFactoryService = new Mock(MockBehavior.Strict); - var documentManager = new DefaultRazorDocumentManager(Dispatcher, editorFactoryService.Object, SupportedProjectService); - var textView = Mock.Of(); - var buffers = new Collection() - { - Mock.Of(b => b.ContentType == NonRazorCoreContentType && b.Properties == new PropertyCollection()), - }; - - // Act & Assert - documentManager.OnTextViewOpened(textView, buffers); - } - - [ForegroundFact] - public void OnTextViewOpened_ForRazorTextBuffer_AddsTextViewToTracker() - { - // Arrange - var textView = Mock.Of(); - var buffers = new Collection() - { - Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()), - }; - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, buffers[0], ImportDocumentManager) as VisualStudioDocumentTracker; - var editorFactoryService = Mock.Of(factoryService => factoryService.TryGetDocumentTracker(It.IsAny(), out documentTracker) == true); - var documentManager = new DefaultRazorDocumentManager(Dispatcher, editorFactoryService, SupportedProjectService); - - // Act - documentManager.OnTextViewOpened(textView, buffers); - - // Assert - Assert.Collection(documentTracker.TextViews, v => Assert.Same(v, textView)); - } - - [ForegroundFact] - public void OnTextViewOpened_SubscribesAfterFirstTextViewOpened() - { - // Arrange - var textView = Mock.Of(); - var buffers = new Collection() - { - Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()), - Mock.Of(b => b.ContentType == NonRazorCoreContentType && b.Properties == new PropertyCollection()), - }; - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, buffers[0], ImportDocumentManager) as VisualStudioDocumentTracker; - var editorFactoryService = Mock.Of(f => f.TryGetDocumentTracker(It.IsAny(), out documentTracker) == true); - var documentManager = new DefaultRazorDocumentManager(Dispatcher, editorFactoryService, SupportedProjectService); - - // Assert 1 - Assert.False(documentTracker.IsSupportedProject); - - // Act - documentManager.OnTextViewOpened(textView, buffers); - - // Assert 2 - Assert.True(documentTracker.IsSupportedProject); - } - - [ForegroundFact] - public void OnTextViewClosed_FoNonRazorCoreProject_DoesNothing() - { - // Arrange - var documentManager = new DefaultRazorDocumentManager(Dispatcher, Mock.Of(), UnsupportedProjectService); - var textView = Mock.Of(); - var buffers = new Collection() - { - Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()), - }; - - // Act - documentManager.OnTextViewClosed(textView, buffers); - - // Assert - Assert.False(buffers[0].Properties.ContainsProperty(typeof(VisualStudioDocumentTracker))); - } - - [ForegroundFact] - public void OnTextViewClosed_TextViewWithoutDocumentTracker_DoesNothing() - { - // Arrange - var documentManager = new DefaultRazorDocumentManager(Dispatcher, Mock.Of(), SupportedProjectService); - var textView = Mock.Of(); - var buffers = new Collection() - { - Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()), - }; - - // Act - documentManager.OnTextViewClosed(textView, buffers); - - // Assert - Assert.False(buffers[0].Properties.ContainsProperty(typeof(VisualStudioDocumentTracker))); - } - - [ForegroundFact] - public void OnTextViewClosed_ForAnyTextBufferWithTracker_RemovesTextView() - { - // Arrange - var textView1 = Mock.Of(); - var textView2 = Mock.Of(); - var buffers = new Collection() - { - Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()), - Mock.Of(b => b.ContentType == NonRazorCoreContentType && b.Properties == new PropertyCollection()), - }; - - // Preload the buffer's properties with a tracker, so it's like we've already tracked this one. - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, buffers[0], ImportDocumentManager); - documentTracker.AddTextView(textView1); - documentTracker.AddTextView(textView2); - buffers[0].Properties.AddProperty(typeof(VisualStudioDocumentTracker), documentTracker); - - documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, buffers[1], ImportDocumentManager); - documentTracker.AddTextView(textView1); - documentTracker.AddTextView(textView2); - buffers[1].Properties.AddProperty(typeof(VisualStudioDocumentTracker), documentTracker); - - var editorFactoryService = Mock.Of(); - var documentManager = new DefaultRazorDocumentManager(Dispatcher, editorFactoryService, SupportedProjectService); - - // Act - documentManager.OnTextViewClosed(textView2, buffers); - - // Assert - documentTracker = buffers[0].Properties.GetProperty(typeof(VisualStudioDocumentTracker)); - Assert.Collection(documentTracker.TextViews, v => Assert.Same(v, textView1)); - - documentTracker = buffers[1].Properties.GetProperty(typeof(VisualStudioDocumentTracker)); - Assert.Collection(documentTracker.TextViews, v => Assert.Same(v, textView1)); - } - - [ForegroundFact] - public void OnTextViewClosed_UnsubscribesAfterLastTextViewClosed() - { - // Arrange - var textView1 = Mock.Of(); - var textView2 = Mock.Of(); - var buffers = new Collection() - { - Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()), - Mock.Of(b => b.ContentType == NonRazorCoreContentType && b.Properties == new PropertyCollection()), - }; - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, buffers[0], ImportDocumentManager); - buffers[0].Properties.AddProperty(typeof(VisualStudioDocumentTracker), documentTracker); - var editorFactoryService = Mock.Of(); - var documentManager = new DefaultRazorDocumentManager(Dispatcher, editorFactoryService, SupportedProjectService); - - // Populate the text views - documentTracker.Subscribe(); - documentTracker.AddTextView(textView1); - documentTracker.AddTextView(textView2); - - // Act 1 - documentManager.OnTextViewClosed(textView2, buffers); - - // Assert 1 - Assert.True(documentTracker.IsSupportedProject); - - // Act - documentManager.OnTextViewClosed(textView1, buffers); - - // Assert 2 - Assert.False(documentTracker.IsSupportedProject); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorEditorFactoryServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorEditorFactoryServiceTest.cs deleted file mode 100644 index 49b95010c2..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorEditorFactoryServiceTest.cs +++ /dev/null @@ -1,275 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Host; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Utilities; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultRazorEditorFactoryServiceTest - { - private IContentType RazorCoreContentType { get; } = Mock.Of(c => c.IsOfType(RazorLanguage.CoreContentType) == true); - - private IContentType NonRazorCoreContentType { get; } = Mock.Of(c => c.IsOfType(It.IsAny()) == false); - - [Fact] - public void TryGetDocumentTracker_ForRazorTextBuffer_ReturnsTrue() - { - // Arrange - var expectedDocumentTracker = Mock.Of(); - var factoryService = CreateFactoryService(expectedDocumentTracker); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryGetDocumentTracker(textBuffer, out var documentTracker); - - // Assert - Assert.True(result); - Assert.Same(expectedDocumentTracker, documentTracker); - } - - [Fact] - public void TryGetDocumentTracker_NonRazorBuffer_ReturnsFalse() - { - // Arrange - var factoryService = CreateFactoryService(); - var textBuffer = Mock.Of(b => b.ContentType == NonRazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryGetDocumentTracker(textBuffer, out var documentTracker); - - // Assert - Assert.False(result); - Assert.Null(documentTracker); - } - - [Fact] - public void TryInitializeTextBuffer_WorkspaceAccessorCanNotAccessWorkspace_ReturnsFalse() - { - // Arrange - Workspace workspace = null; - var workspaceAccessor = new Mock(); - workspaceAccessor.Setup(provider => provider.TryGetWorkspace(It.IsAny(), out workspace)) - .Returns(false); - var factoryService = new DefaultRazorEditorFactoryService(workspaceAccessor.Object); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryInitializeTextBuffer(textBuffer); - - // Assert - Assert.False(result); - } - - [Fact] - public void TryInitializeTextBuffer_StoresTracker_ReturnsTrue() - { - // Arrange - var expectedDocumentTracker = Mock.Of(); - var factoryService = CreateFactoryService(expectedDocumentTracker); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryInitializeTextBuffer(textBuffer); - - // Assert - Assert.True(result); - Assert.True(textBuffer.Properties.TryGetProperty(typeof(VisualStudioDocumentTracker), out VisualStudioDocumentTracker documentTracker)); - Assert.Same(expectedDocumentTracker, documentTracker); - } - - [Fact] - public void TryInitializeTextBuffer_OnlyStoresTrackerOnTextBufferOnce_ReturnsTrue() - { - // Arrange - var factoryService = CreateFactoryService(); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - factoryService.TryInitializeTextBuffer(textBuffer); - var expectedDocumentTracker = textBuffer.Properties[typeof(VisualStudioDocumentTracker)]; - - // Create a second factory service so it generates a different tracker - factoryService = CreateFactoryService(); - - // Act - var result = factoryService.TryInitializeTextBuffer(textBuffer); - - // Assert - Assert.True(result); - Assert.True(textBuffer.Properties.TryGetProperty(typeof(VisualStudioDocumentTracker), out VisualStudioDocumentTracker documentTracker)); - Assert.Same(expectedDocumentTracker, documentTracker); - } - - [Fact] - public void TryGetParser_ForRazorTextBuffer_ReturnsTrue() - { - // Arrange - var expectedParser = Mock.Of(); - var factoryService = CreateFactoryService(parser: expectedParser); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryGetParser(textBuffer, out var parser); - - // Assert - Assert.True(result); - Assert.Same(expectedParser, parser); - } - - [Fact] - public void TryGetParser_NonRazorBuffer_ReturnsFalse() - { - // Arrange - var factoryService = CreateFactoryService(); - var textBuffer = Mock.Of(b => b.ContentType == NonRazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryGetParser(textBuffer, out var parser); - - // Assert - Assert.False(result); - Assert.Null(parser); - } - - [Fact] - public void TryInitializeTextBuffer_StoresParser_ReturnsTrue() - { - // Arrange - var expectedParser = Mock.Of(); - var factoryService = CreateFactoryService(parser: expectedParser); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryInitializeTextBuffer(textBuffer); - - // Assert - Assert.True(result); - Assert.True(textBuffer.Properties.TryGetProperty(typeof(VisualStudioRazorParser), out VisualStudioRazorParser parser)); - Assert.Same(expectedParser, parser); - } - - [Fact] - public void TryInitializeTextBuffer_OnlyStoresParserOnTextBufferOnce_ReturnsTrue() - { - // Arrange - var factoryService = CreateFactoryService(); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - factoryService.TryInitializeTextBuffer(textBuffer); - var expectedParser = textBuffer.Properties[typeof(VisualStudioRazorParser)]; - - // Create a second factory service so it generates a different parser - factoryService = CreateFactoryService(); - - // Act - var result = factoryService.TryInitializeTextBuffer(textBuffer); - - // Assert - Assert.True(result); - Assert.True(textBuffer.Properties.TryGetProperty(typeof(VisualStudioRazorParser), out VisualStudioRazorParser parser)); - Assert.Same(expectedParser, parser); - } - - [Fact] - public void TryGetSmartIndenter_ForRazorTextBuffer_ReturnsTrue() - { - // Arrange - var expectedSmartIndenter = Mock.Of(); - var factoryService = CreateFactoryService(smartIndenter: expectedSmartIndenter); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryGetSmartIndenter(textBuffer, out var smartIndenter); - - // Assert - Assert.True(result); - Assert.Same(expectedSmartIndenter, smartIndenter); - } - - [Fact] - public void TryGetSmartIndenter_NonRazorBuffer_ReturnsFalse() - { - // Arrange - var factoryService = CreateFactoryService(); - var textBuffer = Mock.Of(b => b.ContentType == NonRazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryGetSmartIndenter(textBuffer, out var smartIndenter); - - // Assert - Assert.False(result); - Assert.Null(smartIndenter); - } - - [Fact] - public void TryInitializeTextBuffer_StoresSmartIndenter_ReturnsTrue() - { - // Arrange - var expectedSmartIndenter = Mock.Of(); - var factoryService = CreateFactoryService(smartIndenter: expectedSmartIndenter); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - - // Act - var result = factoryService.TryInitializeTextBuffer(textBuffer); - - // Assert - Assert.True(result); - Assert.True(textBuffer.Properties.TryGetProperty(typeof(BraceSmartIndenter), out BraceSmartIndenter smartIndenter)); - Assert.Same(expectedSmartIndenter, smartIndenter); - } - - [Fact] - public void TryInitializeTextBuffer_OnlyStoresSmartIndenterOnTextBufferOnce_ReturnsTrue() - { - // Arrange - var factoryService = CreateFactoryService(); - var textBuffer = Mock.Of(b => b.ContentType == RazorCoreContentType && b.Properties == new PropertyCollection()); - factoryService.TryInitializeTextBuffer(textBuffer); - var expectedSmartIndenter = textBuffer.Properties[typeof(BraceSmartIndenter)]; - - // Create a second factory service so it generates a different smart indenter - factoryService = CreateFactoryService(); - - // Act - var result = factoryService.TryInitializeTextBuffer(textBuffer); - - // Assert - Assert.True(result); - Assert.True(textBuffer.Properties.TryGetProperty(typeof(BraceSmartIndenter), out BraceSmartIndenter smartIndenter)); - Assert.Same(expectedSmartIndenter, smartIndenter); - } - - private static DefaultRazorEditorFactoryService CreateFactoryService( - VisualStudioDocumentTracker documentTracker = null, - VisualStudioRazorParser parser = null, - BraceSmartIndenter smartIndenter = null) - { - documentTracker = documentTracker ?? Mock.Of(); - parser = parser ?? Mock.Of(); - smartIndenter = smartIndenter ?? Mock.Of(); - - var documentTrackerFactory = Mock.Of(f => f.Create(It.IsAny()) == documentTracker); - var parserFactory = Mock.Of(f => f.Create(It.IsAny()) == parser); - var smartIndenterFactory = Mock.Of(f => f.Create(It.IsAny()) == smartIndenter); - - var services = TestServices.Create(new ILanguageService[] - { - documentTrackerFactory, - parserFactory, - smartIndenterFactory - }); - - var workspace = TestWorkspace.Create(services); - var workspaceAccessor = new Mock(); - workspaceAccessor.Setup(p => p.TryGetWorkspace(It.IsAny(), out workspace)) - .Returns(true); - - var factoryService = new DefaultRazorEditorFactoryService(workspaceAccessor.Object); - - return factoryService; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorIndentationFactsServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorIndentationFactsServiceTest.cs deleted file mode 100644 index 2623f67e0d..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorIndentationFactsServiceTest.cs +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.VisualStudio.Text; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultRazorIndentationFactsServiceTest - { - [Fact] - public void GetPreviousLineEndIndex_ReturnsPreviousLine() - { - // Arrange - var textSnapshot = new StringTextSnapshot(@"@{ -

Hello World

-}"); - var line = textSnapshot.GetLineFromLineNumber(2); - - // Act - var previousLineEndIndex = DefaultRazorIndentationFactsService.GetPreviousLineEndIndex(textSnapshot, line); - - // Assert - Assert.Equal(24 + Environment.NewLine.Length, previousLineEndIndex); - } - - [Fact] - public void IsCSharpOpenCurlyBrace_SpanWithLeftBrace_ReturnTrue() - { - // Arrange - var childBuilder = new SpanBuilder(SourceLocation.Zero); - childBuilder.Accept(new CSharpSymbol("{", CSharpSymbolType.LeftBrace)); - var child = childBuilder.Build(); - - // Act - var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child); - - // Assert - Assert.True(result); - } - - [Theory] - [InlineData("if", CSharpSymbolType.Keyword)] - [InlineData("}", CSharpSymbolType.RightBrace)] - [InlineData("++", CSharpSymbolType.Increment)] - [InlineData("text", CSharpSymbolType.Identifier)] - public void IsCSharpOpenCurlyBrace_SpanWithUnsupportedSymbolType_ReturnFalse(string content, object symbolTypeObject) - { - // Arrange - var symbolType = (CSharpSymbolType)symbolTypeObject; - var childBuilder = new SpanBuilder(SourceLocation.Zero); - childBuilder.Accept(new CSharpSymbol(content, symbolType)); - var child = childBuilder.Build(); - - // Act - var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child); - - // Assert - Assert.False(result); - } - - [Fact] - public void IsCSharpOpenCurlyBrace_MultipleSymbols_ReturnFalse() - { - // Arrange - var childBuilder = new SpanBuilder(SourceLocation.Zero); - childBuilder.Accept(new CSharpSymbol("hello", CSharpSymbolType.Identifier)); - childBuilder.Accept(new CSharpSymbol(",", CSharpSymbolType.Comma)); - var child = childBuilder.Build(); - - // Act - var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child); - - // Assert - Assert.False(result); - } - - [Fact] - public void IsCSharpOpenCurlyBrace_SpanWithHtmlSymbol_ReturnFalse() - { - // Arrange - var childBuilder = new SpanBuilder(SourceLocation.Zero); - childBuilder.Accept(new HtmlSymbol("hello", HtmlSymbolType.Text)); - var child = childBuilder.Build(); - - // Act - var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child); - - // Assert - Assert.False(result); - } - - [Fact] - public void IsCSharpOpenCurlyBrace_Blocks_ReturnFalse() - { - // Arrange - var child = new BlockBuilder() - { - Type = BlockKindInternal.Markup, - }.Build(); - - // Act - var result = DefaultRazorIndentationFactsService.IsCSharpOpenCurlyBrace(child); - - // Assert - Assert.False(result); - } - - [Fact] - public void GetIndentLevelOfLine_AddsTabsOnlyAtBeginningOfLine() - { - // Arrange - var text = "\t\tHello\tWorld.\t"; - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentLevel = service.GetIndentLevelOfLine(text, 4); - - // Assert - Assert.Equal(8, indentLevel); - } - - [Fact] - public void GetIndentLevelOfLine_AddsSpacesOnlyAtBeginningOfLine() - { - // Arrange - var text = " Hello World. "; - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentLevel = service.GetIndentLevelOfLine(text, 4); - - // Assert - Assert.Equal(3, indentLevel); - } - - [Fact] - public void GetIndentLevelOfLine_AddsTabsAndSpacesOnlyAtBeginningOfLine() - { - // Arrange - var text = " \t \tHello\t World.\t "; - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentLevel = service.GetIndentLevelOfLine(text, 4); - - // Assert - Assert.Equal(11, indentLevel); - } - - [Fact] - public void GetIndentLevelOfLine_NoIndent() - { - // Arrange - var text = "Hello World."; - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentLevel = service.GetIndentLevelOfLine(text, 4); - - // Assert - Assert.Equal(0, indentLevel); - } - - [Fact] - public void GetDesiredIndentation_ReturnsNull_IfOwningSpanIsCode() - { - // Arrange - var source = new StringTextSnapshot($@" -@{{ -"); - var syntaxTree = GetSyntaxTree(source); - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentation = service.GetDesiredIndentation( - syntaxTree, - source, - source.GetLineFromLineNumber(2), - indentSize: 4, - tabSize: 1); - - // Assert - Assert.Null(indentation); - } - - [Fact] - public void GetDesiredIndentation_ReturnsNull_IfOwningSpanIsNone() - { - // Arrange - var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom"); - var source = new StringTextSnapshot($@" -@custom -"); - var syntaxTree = GetSyntaxTree(source, new[] { customDirective }); - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentation = service.GetDesiredIndentation( - syntaxTree, - source, - source.GetLineFromLineNumber(2), - indentSize: 4, - tabSize: 1); - - // Assert - Assert.Null(indentation); - } - - [Fact] - public void GetDesiredIndentation_ReturnsCorrectIndentation_ForMarkupWithinCodeBlock() - { - // Arrange - var source = new StringTextSnapshot($@"@{{ -
-"); - var syntaxTree = GetSyntaxTree(source); - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentation = service.GetDesiredIndentation( - syntaxTree, - source, - source.GetLineFromLineNumber(2), - indentSize: 4, - tabSize: 4); - - // Assert - Assert.Equal(4, indentation); - } - - [Fact] - public void GetDesiredIndentation_ReturnsCorrectIndentation_ForMarkupWithinDirectiveBlock() - { - // Arrange - var customDirective = DirectiveDescriptor.CreateRazorBlockDirective("custom"); - var source = new StringTextSnapshot($@"@custom -{{ -
-}}"); - var syntaxTree = GetSyntaxTree(source, new[] { customDirective }); - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentation = service.GetDesiredIndentation( - syntaxTree, - source, - source.GetLineFromLineNumber(3), - indentSize: 4, - tabSize: 4); - - // Assert - Assert.Equal(4, indentation); - } - - [Fact] - public void GetDesiredIndentation_ReturnsCorrectIndentation_ForNestedMarkupWithinCodeBlock() - { - // Arrange - var source = new StringTextSnapshot($@" -
- @{{ - - }} -
-"); - var syntaxTree = GetSyntaxTree(source); - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentation = service.GetDesiredIndentation( - syntaxTree, - source, - source.GetLineFromLineNumber(4), - indentSize: 4, - tabSize: 4); - - // Assert - Assert.Equal(8, indentation); - } - - [Fact] - public void GetDesiredIndentation_ReturnsCorrectIndentation_ForMarkupWithinCodeBlockInADirectiveBlock() - { - // Arrange - var customDirective = DirectiveDescriptor.CreateRazorBlockDirective("custom"); - var source = new StringTextSnapshot($@"@custom -{{ - @{{ -
- }} -}}"); - var syntaxTree = GetSyntaxTree(source, new[] { customDirective }); - var service = new DefaultRazorIndentationFactsService(); - - // Act - var indentation = service.GetDesiredIndentation( - syntaxTree, - source, - source.GetLineFromLineNumber(4), - indentSize: 4, - tabSize: 4); - - // Assert - Assert.Equal(8, indentation); - } - - private static RazorSyntaxTree GetSyntaxTree(StringTextSnapshot source, IEnumerable directives = null) - { - directives = directives ?? Enumerable.Empty(); - var engine = RazorProjectEngine.Create(builder => - { - foreach (var directive in directives) - { - builder.AddDirective(directive); - } - }); - - var sourceProjectItem = new TestRazorProjectItem("test.cshtml") - { - Content = source.GetText() - }; - - var codeDocument = engine.ProcessDesignTime(sourceProjectItem); - - return codeDocument.GetSyntaxTree(); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorSyntaxFactsServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorSyntaxFactsServiceTest.cs deleted file mode 100644 index 7888cb39a3..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultRazorSyntaxFactsServiceTest.cs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultRazorSyntaxFactsServiceTest - { - [Fact] - public void GetClassifiedSpans_ReturnsExpectedSpans() - { - // Arrange - var expectedSpans = new[] - { - new ClassifiedSpan(new SourceSpan("test.cshtml", 0, 0, 0, 5), new SourceSpan("test.cshtml", 0, 0, 0, 5), SpanKind.Markup, BlockKind.Tag, AcceptedCharacters.Any), - new ClassifiedSpan(new SourceSpan("test.cshtml", 5, 0, 5, 6), new SourceSpan("test.cshtml", 0, 0, 0, 42), SpanKind.Markup, BlockKind.Markup, AcceptedCharacters.Any), - new ClassifiedSpan(new SourceSpan("test.cshtml", 34, 1, 27, 2), new SourceSpan("test.cshtml", 0, 0, 0, 42), SpanKind.Markup, BlockKind.Markup, AcceptedCharacters.Any), - new ClassifiedSpan(new SourceSpan("test.cshtml", 36, 2, 0, 6), new SourceSpan("test.cshtml", 36, 2, 0, 6), SpanKind.Markup, BlockKind.Tag, AcceptedCharacters.Any), - }; - var codeDocument = GetCodeDocument( -@"
- -
"); - var syntaxTree = codeDocument.GetSyntaxTree(); - var service = new DefaultRazorSyntaxFactsService(); - - // Act - var spans = service.GetClassifiedSpans(syntaxTree); - - // Assert - Assert.Equal(expectedSpans, spans); - } - - [Fact] - public void GetClassifiedSpans_ReturnsAttributeSpansInDocumentOrder() - { - // Arrange - var expectedSpans = new[] - { - new ClassifiedSpan(new SourceSpan("test.cshtml", 14, 0, 14, 1), new SourceSpan("test.cshtml", 0, 0, 0, 49), SpanKind.Code, BlockKind.Tag, AcceptedCharacters.AnyExceptNewline), - new ClassifiedSpan(new SourceSpan("test.cshtml", 23, 0, 23, 2), new SourceSpan("test.cshtml", 0, 0, 0, 49), SpanKind.Markup, BlockKind.Tag, AcceptedCharacters.Any), - new ClassifiedSpan(new SourceSpan("test.cshtml", 32, 0, 32, 4), new SourceSpan("test.cshtml", 0, 0, 0, 49), SpanKind.Code, BlockKind.Tag, AcceptedCharacters.AnyExceptNewline), - }; - var codeDocument = GetCodeDocument( -@""); - var syntaxTree = codeDocument.GetSyntaxTree(); - var service = new DefaultRazorSyntaxFactsService(); - - // Act - var spans = service.GetClassifiedSpans(syntaxTree); - - // Assert - Assert.Equal(expectedSpans, spans); - } - - [Fact] - public void GetTagHelperSpans_ReturnsExpectedSpans() - { - // Arrange - var codeDocument = GetCodeDocument( -@"
- -
"); - var tagHelperContext = codeDocument.GetTagHelperContext(); - var expectedSourceSpan = new SourceSpan("test.cshtml", 11, 1, 4, 23); - var syntaxTree = codeDocument.GetSyntaxTree(); - var service = new DefaultRazorSyntaxFactsService(); - - // Act - var spans = service.GetTagHelperSpans(syntaxTree); - - // Assert - var actualSpan = Assert.Single(spans); - Assert.Equal(expectedSourceSpan, actualSpan.Span); - Assert.Equal(tagHelperContext.TagHelpers, actualSpan.TagHelpers); - Assert.Equal(tagHelperContext.Prefix, actualSpan.Binding.TagHelperPrefix); - Assert.Equal("div", actualSpan.Binding.ParentTagName); - } - - private static RazorCodeDocument GetCodeDocument(string source) - { - var taghelper = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly") - .BoundAttributeDescriptor(attr => attr.Name("show").TypeName("System.Boolean")) - .BoundAttributeDescriptor(attr => attr.Name("id").TypeName("System.Int32")) - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("taghelper")) - .TypeName("TestTagHelper") - .Build(); - var engine = RazorProjectEngine.Create(builder => - { - builder.AddTagHelpers(taghelper); - builder.SetImportFeature(new TestImportProjectFeature()); - }); - - var sourceProjectItem = new TestRazorProjectItem("test.cshtml") - { - Content = source - }; - - var codeDocument = engine.ProcessDesignTime(sourceProjectItem); - - return codeDocument; - } - - private class TestImportProjectFeature : RazorProjectEngineFeatureBase, IImportProjectFeature - { - public IReadOnlyList GetImports(RazorProjectItem projectItem) - { - var importProjectItem = new TestRazorProjectItem("import.cshtml") - { - Content = "@addTagHelper *, TestAssembly" - }; - - return new[] { importProjectItem }; - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTagHelperCompletionServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTagHelperCompletionServiceTest.cs deleted file mode 100644 index 47fd565bb4..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTagHelperCompletionServiceTest.cs +++ /dev/null @@ -1,1141 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultTagHelperCompletionServiceTest - { - [Fact] - public void GetAttributeCompletions_DoesNotReturnCompletionsForAlreadySuppliedAttributes() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("div") - .RequireAttributeDescriptor(attribute => attribute.Name("repeat"))) - .BoundAttributeDescriptor(attribute => attribute - .Name("visible") - .TypeName(typeof(bool).FullName) - .PropertyName("Visible")) - .Build(), - TagHelperDescriptorBuilder.Create("StyleTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .BoundAttributeDescriptor(attribute => attribute - .Name("class") - .TypeName(typeof(string).FullName) - .PropertyName("Class")) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["onclick"] = new HashSet(), - ["visible"] = new HashSet() - { - documentDescriptors[0].BoundAttributes.Last() - } - }); - - var existingCompletions = new[] { "onclick" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - attributes: new Dictionary() - { - ["class"] = "something", - ["repeat"] = "4" - }, - currentTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_ReturnsCompletionForAlreadySuppliedAttribute_IfCurrentAttributeMatches() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("div") - .RequireAttributeDescriptor(attribute => attribute.Name("repeat"))) - .BoundAttributeDescriptor(attribute => attribute - .Name("visible") - .TypeName(typeof(bool).FullName) - .PropertyName("Visible")) - .Build(), - TagHelperDescriptorBuilder.Create("StyleTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .BoundAttributeDescriptor(attribute => attribute - .Name("class") - .TypeName(typeof(string).FullName) - .PropertyName("Class")) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["onclick"] = new HashSet(), - ["visible"] = new HashSet() - { - documentDescriptors[0].BoundAttributes.Last() - } - }); - - var existingCompletions = new[] { "onclick" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - attributes: new Dictionary() - { - ["class"] = "something", - ["repeat"] = "4", - ["visible"] = "false", - }, - currentTagName: "div", - currentAttributeName: "visible"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_DoesNotReturnAlreadySuppliedAttribute_IfCurrentAttributeDoesNotMatch() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("div") - .RequireAttributeDescriptor(attribute => attribute.Name("repeat"))) - .BoundAttributeDescriptor(attribute => attribute - .Name("visible") - .TypeName(typeof(bool).FullName) - .PropertyName("Visible")) - .Build(), - TagHelperDescriptorBuilder.Create("StyleTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .BoundAttributeDescriptor(attribute => attribute - .Name("class") - .TypeName(typeof(string).FullName) - .PropertyName("Class")) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["onclick"] = new HashSet() - }); - - var existingCompletions = new[] { "onclick" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - attributes: new Dictionary() - { - ["class"] = "something", - ["repeat"] = "4", - ["visible"] = "false", - }, - currentTagName: "div", - currentAttributeName: "repeat"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_PossibleDescriptorsReturnUnboundRequiredAttributesWithExistingCompletions() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("div") - .RequireAttributeDescriptor(attribute => attribute.Name("repeat"))) - .Build(), - TagHelperDescriptorBuilder.Create("StyleTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("*") - .RequireAttributeDescriptor(attribute => attribute.Name("class"))) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["class"] = new HashSet(), - ["onclick"] = new HashSet(), - ["repeat"] = new HashSet() - }); - - var existingCompletions = new[] { "onclick", "class" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - currentTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_PossibleDescriptorsReturnBoundRequiredAttributesWithExistingCompletions() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("div") - .RequireAttributeDescriptor(attribute => attribute.Name("repeat"))) - .BoundAttributeDescriptor(attribute => attribute - .Name("repeat") - .TypeName(typeof(bool).FullName) - .PropertyName("Repeat")) - .BoundAttributeDescriptor(attribute => attribute - .Name("visible") - .TypeName(typeof(bool).FullName) - .PropertyName("Visible")) - .Build(), - TagHelperDescriptorBuilder.Create("StyleTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("*") - .RequireAttributeDescriptor(attribute => attribute.Name("class"))) - .BoundAttributeDescriptor(attribute => attribute - .Name("class") - .TypeName(typeof(string).FullName) - .PropertyName("Class")) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["class"] = new HashSet(documentDescriptors[1].BoundAttributes), - ["onclick"] = new HashSet(), - ["repeat"] = new HashSet() - { - documentDescriptors[0].BoundAttributes.First() - } - }); - - var existingCompletions = new[] { "onclick" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - currentTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_AppliedDescriptorsReturnAllBoundAttributesWithExistingCompletionsForSchemaTags() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .BoundAttributeDescriptor(attribute => attribute - .Name("repeat") - .TypeName(typeof(bool).FullName) - .PropertyName("Repeat")) - .BoundAttributeDescriptor(attribute => attribute - .Name("visible") - .TypeName(typeof(bool).FullName) - .PropertyName("Visible")) - .Build(), - TagHelperDescriptorBuilder.Create("StyleTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("*") - .RequireAttributeDescriptor(attribute => attribute.Name("class"))) - .BoundAttributeDescriptor(attribute => attribute - .Name("class") - .TypeName(typeof(string).FullName) - .PropertyName("Class")) - .Build(), - TagHelperDescriptorBuilder.Create("StyleTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .BoundAttributeDescriptor(attribute => attribute - .Name("visible") - .TypeName(typeof(bool).FullName) - .PropertyName("Visible")) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["onclick"] = new HashSet(), - ["class"] = new HashSet(documentDescriptors[1].BoundAttributes), - ["repeat"] = new HashSet() - { - documentDescriptors[0].BoundAttributes.First() - }, - ["visible"] = new HashSet() - { - documentDescriptors[0].BoundAttributes.Last(), - documentDescriptors[2].BoundAttributes.First(), - } - }); - - var existingCompletions = new[] { "class", "onclick" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - currentTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_AppliedTagOutputHintDescriptorsReturnBoundAttributesWithExistingCompletionsForNonSchemaTags() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("CustomTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("custom")) - .BoundAttributeDescriptor(attribute => attribute - .Name("repeat") - .TypeName(typeof(bool).FullName) - .PropertyName("Repeat")) - .TagOutputHint("div") - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["class"] = new HashSet(), - ["repeat"] = new HashSet(documentDescriptors[0].BoundAttributes) - }); - - var existingCompletions = new[] { "class" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - currentTagName: "custom"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_AppliedDescriptorsReturnBoundAttributesCompletionsForNonSchemaTags() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("CustomTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("custom")) - .BoundAttributeDescriptor(attribute => attribute - .Name("repeat") - .TypeName(typeof(bool).FullName) - .PropertyName("Repeat")) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["repeat"] = new HashSet(documentDescriptors[0].BoundAttributes) - }); - - var existingCompletions = new[] { "class" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - currentTagName: "custom"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_AppliedDescriptorsReturnBoundAttributesWithExistingCompletionsForSchemaTags() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .BoundAttributeDescriptor(attribute => attribute - .Name("repeat") - .TypeName(typeof(bool).FullName) - .PropertyName("Repeat")) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["class"] = new HashSet(), - ["repeat"] = new HashSet(documentDescriptors[0].BoundAttributes) - }); - - var existingCompletions = new[] { "class" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - currentTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_NoDescriptorsReturnsExistingCompletions() - { - // Arrange - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["class"] = new HashSet(), - }); - - var existingCompletions = new[] { "class" }; - var completionContext = BuildAttributeCompletionContext( - Enumerable.Empty(), - existingCompletions, - currentTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_NoDescriptorsForUnprefixedTagReturnsExistingCompletions() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("div") - .RequireAttributeDescriptor(attribute => attribute.Name("special"))) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["class"] = new HashSet(), - }); - - var existingCompletions = new[] { "class" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - currentTagName: "div", - tagHelperPrefix: "th:"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetAttributeCompletions_NoDescriptorsForTagReturnsExistingCompletions() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("MyTableTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("table") - .RequireAttributeDescriptor(attribute => attribute.Name("special"))) - .Build(), - }; - var expectedCompletions = AttributeCompletionResult.Create(new Dictionary>() - { - ["class"] = new HashSet(), - }); - - var existingCompletions = new[] { "class" }; - var completionContext = BuildAttributeCompletionContext( - documentDescriptors, - existingCompletions, - currentTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetAttributeCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_TagOutputHintDoesNotFallThroughToSchemaCheck() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("MyTableTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("my-table")) - .TagOutputHint("table") - .Build(), - TagHelperDescriptorBuilder.Create("MyTrTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("my-tr")) - .TagOutputHint("tr") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["my-table"] = new HashSet { documentDescriptors[0] }, - ["table"] = new HashSet(), - }); - - var existingCompletions = new[] { "table" }; - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions, - containingTagName: "body", - containingParentTagName: null); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_CatchAllsOnlyApplyToCompletionsStartingWithPrefix() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("CatchAllTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .Build(), - TagHelperDescriptorBuilder.Create("LiTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("li")) - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["th:li"] = new HashSet { documentDescriptors[1], documentDescriptors[0] }, - ["li"] = new HashSet(), - }); - - var existingCompletions = new[] { "li" }; - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions, - containingTagName: "ul", - tagHelperPrefix: "th:"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_TagHelperPrefixIsPrependedToTagHelperCompletions() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("SuperLiTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("superli")) - .Build(), - TagHelperDescriptorBuilder.Create("LiTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("li")) - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["th:superli"] = new HashSet { documentDescriptors[0] }, - ["th:li"] = new HashSet { documentDescriptors[1] }, - ["li"] = new HashSet(), - }); - - var existingCompletions = new[] { "li" }; - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions, - containingTagName: "ul", - tagHelperPrefix: "th:"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_CatchAllsApplyToOnlyTagHelperCompletions() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("SuperLiTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("superli")) - .Build(), - TagHelperDescriptorBuilder.Create("CatchAll", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["superli"] = new HashSet() { documentDescriptors[0], documentDescriptors[1] }, - ["li"] = new HashSet(), - }); - - var existingCompletions = new[] { "li" }; - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions, - containingTagName: "ul"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_CatchAllsApplyToNonTagHelperCompletionsIfStartsWithTagHelperPrefix() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("SuperLiTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("superli")) - .Build(), - TagHelperDescriptorBuilder.Create("CatchAll", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["th:superli"] = new HashSet() { documentDescriptors[0], documentDescriptors[1] }, - ["th:li"] = new HashSet() { documentDescriptors[1] }, - }); - - var existingCompletions = new[] { "th:li" }; - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions, - containingTagName: "ul", - tagHelperPrefix: "th:"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_AllowsMultiTargetingTagHelpers() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("BoldTagHelper1", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("strong")) - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("b")) - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("bold")) - .Build(), - TagHelperDescriptorBuilder.Create("BoldTagHelper2", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("strong")) - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["strong"] = new HashSet { documentDescriptors[0], documentDescriptors[1] }, - ["b"] = new HashSet { documentDescriptors[0] }, - ["bold"] = new HashSet { documentDescriptors[0] }, - }); - - var existingCompletions = new[] { "strong", "b", "bold" }; - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions, - containingTagName: "ul"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_CombinesDescriptorsOnExistingCompletions() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("LiTagHelper1", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("li")) - .Build(), - TagHelperDescriptorBuilder.Create("LiTagHelper2", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("li")) - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["li"] = new HashSet { documentDescriptors[0], documentDescriptors[1] }, - }); - - var existingCompletions = new[] { "li" }; - var completionContext = BuildElementCompletionContext(documentDescriptors, existingCompletions, containingTagName: "ul"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_NewCompletionsForSchemaTagsNotInExistingCompletionsAreIgnored() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("SuperLiTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("superli")) - .Build(), - TagHelperDescriptorBuilder.Create("LiTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("li")) - .TagOutputHint("strong") - .Build(), - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["li"] = new HashSet { documentDescriptors[1] }, - ["superli"] = new HashSet { documentDescriptors[0] }, - }); - - var existingCompletions = new[] { "li" }; - var completionContext = BuildElementCompletionContext(documentDescriptors, existingCompletions, containingTagName: "ul"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_OutputHintIsCrossReferencedWithExistingCompletions() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .TagOutputHint("li") - .Build(), - TagHelperDescriptorBuilder.Create("LiTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("li")) - .TagOutputHint("strong") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["div"] = new HashSet { documentDescriptors[0] }, - ["li"] = new HashSet { documentDescriptors[1] }, - }); - - var existingCompletions = new[] { "li" }; - var completionContext = BuildElementCompletionContext(documentDescriptors, existingCompletions, containingTagName: "ul"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_EnsuresDescriptorsHaveSatisfiedParent() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("LiTagHelper1", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("li")) - .Build(), - TagHelperDescriptorBuilder.Create("LiTagHelper2", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("li").RequireParentTag("ol")) - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["li"] = new HashSet { documentDescriptors[0] }, - }); - - var existingCompletions = new[] { "li" }; - var completionContext = BuildElementCompletionContext(documentDescriptors, existingCompletions, containingTagName: "ul"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_NoContainingParentTag_DoesNotGetCompletionForRuleWithParentTag() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("Tag1", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("outer-child-tag")) - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("child-tag").RequireParentTag("parent-tag")) - .Build(), - TagHelperDescriptorBuilder.Create("Tag2", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("parent-tag")) - .AllowChildTag("child-tag") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["outer-child-tag"] = new HashSet { documentDescriptors[0] }, - ["parent-tag"] = new HashSet { documentDescriptors[1] }, - }); - - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions: Enumerable.Empty(), - containingTagName: null, - containingParentTagName: null); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_WithContainingParentTag_GetsCompletionForRuleWithParentTag() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("Tag1", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("outer-child-tag")) - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("child-tag").RequireParentTag("parent-tag")) - .Build(), - TagHelperDescriptorBuilder.Create("Tag2", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("parent-tag")) - .AllowChildTag("child-tag") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["child-tag"] = new HashSet { documentDescriptors[0] }, - }); - - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions: Enumerable.Empty(), - containingTagName: "parent-tag", - containingParentTagName: null); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_AllowedChildrenAreIgnoredWhenAtRoot() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("CatchAll", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .AllowChildTag("b") - .AllowChildTag("bold") - .AllowChildTag("div") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>()); - - var existingCompletions = Enumerable.Empty(); - var completionContext = BuildElementCompletionContext( - documentDescriptors, - existingCompletions, - containingTagName: null, - containingParentTagName: null); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_DoesNotReturnExistingCompletionsWhenAllowedChildren() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("BoldParent", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .AllowChildTag("b") - .AllowChildTag("bold") - .AllowChildTag("div") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["b"] = new HashSet(), - ["bold"] = new HashSet(), - ["div"] = new HashSet { documentDescriptors[0] } - }); - - var existingCompletions = new[] { "p", "em" }; - var completionContext = BuildElementCompletionContext(documentDescriptors, existingCompletions, containingTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_CapturesAllAllowedChildTagsFromParentTagHelpers_NoneTagHelpers() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("BoldParent", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .AllowChildTag("b") - .AllowChildTag("bold") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["b"] = new HashSet(), - ["bold"] = new HashSet(), - }); - - var completionContext = BuildElementCompletionContext(documentDescriptors, Enumerable.Empty(), containingTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_CapturesAllAllowedChildTagsFromParentTagHelpers_SomeTagHelpers() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("BoldParent", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .AllowChildTag("b") - .AllowChildTag("bold") - .AllowChildTag("div") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["b"] = new HashSet(), - ["bold"] = new HashSet(), - ["div"] = new HashSet { documentDescriptors[0] } - }); - - var completionContext = BuildElementCompletionContext(documentDescriptors, Enumerable.Empty(), containingTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - [Fact] - public void GetElementCompletions_CapturesAllAllowedChildTagsFromParentTagHelpers_AllTagHelpers() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("BoldParentCatchAll", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .AllowChildTag("strong") - .AllowChildTag("div") - .AllowChildTag("b") - .Build(), - TagHelperDescriptorBuilder.Create("BoldParent", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .AllowChildTag("b") - .AllowChildTag("bold") - .Build(), - }; - var expectedCompletions = ElementCompletionResult.Create(new Dictionary>() - { - ["strong"] = new HashSet { documentDescriptors[0] }, - ["b"] = new HashSet { documentDescriptors[0] }, - ["bold"] = new HashSet { documentDescriptors[0] }, - ["div"] = new HashSet { documentDescriptors[0], documentDescriptors[1] }, - }); - - var completionContext = BuildElementCompletionContext(documentDescriptors, Enumerable.Empty(), containingTagName: "div"); - var service = CreateTagHelperCompletionFactsService(); - - // Act - var completions = service.GetElementCompletions(completionContext); - - // Assert - AssertCompletionsAreEquivalent(expectedCompletions, completions); - } - - private static DefaultTagHelperCompletionService CreateTagHelperCompletionFactsService() - { - var tagHelperFactsService = new DefaultTagHelperFactsService(); - var completionFactService = new DefaultTagHelperCompletionService(tagHelperFactsService); - - return completionFactService; - } - - private static void AssertCompletionsAreEquivalent(ElementCompletionResult expected, ElementCompletionResult actual) - { - Assert.Equal(expected.Completions.Count, actual.Completions.Count); - - foreach (var expectedCompletion in expected.Completions) - { - var actualValue = actual.Completions[expectedCompletion.Key]; - Assert.NotNull(actualValue); - Assert.Equal(expectedCompletion.Value, actualValue, TagHelperDescriptorComparer.CaseSensitive); - } - } - - private static void AssertCompletionsAreEquivalent(AttributeCompletionResult expected, AttributeCompletionResult actual) - { - Assert.Equal(expected.Completions.Count, actual.Completions.Count); - - foreach (var expectedCompletion in expected.Completions) - { - var actualValue = actual.Completions[expectedCompletion.Key]; - Assert.NotNull(actualValue); - Assert.Equal(expectedCompletion.Value, actualValue, BoundAttributeDescriptorComparer.CaseSensitive); - } - } - - private static ElementCompletionContext BuildElementCompletionContext( - IEnumerable descriptors, - IEnumerable existingCompletions, - string containingTagName, - string containingParentTagName = "body", - bool containingParentIsTagHelper = false, - string tagHelperPrefix = "") - { - var documentContext = TagHelperDocumentContext.Create(tagHelperPrefix, descriptors); - var completionContext = new ElementCompletionContext( - documentContext, - existingCompletions, - containingTagName, - attributes: Enumerable.Empty>(), - containingParentTagName: containingParentTagName, - containingParentIsTagHelper: containingParentIsTagHelper, - inHTMLSchema: (tag) => tag == "strong" || tag == "b" || tag == "bold" || tag == "li" || tag == "div"); - - return completionContext; - } - - private static AttributeCompletionContext BuildAttributeCompletionContext( - IEnumerable descriptors, - IEnumerable existingCompletions, - string currentTagName, - string currentAttributeName = null, - IEnumerable> attributes = null, - string tagHelperPrefix = "") - { - attributes = attributes ?? Enumerable.Empty>(); - var documentContext = TagHelperDocumentContext.Create(tagHelperPrefix, descriptors); - var completionContext = new AttributeCompletionContext( - documentContext, - existingCompletions, - currentTagName, - currentAttributeName, - attributes, - currentParentTagName: "body", - currentParentIsTagHelper: false, - inHTMLSchema: (tag) => tag == "strong" || tag == "b" || tag == "bold" || tag == "li" || tag == "div"); - - return completionContext; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTagHelperFactsServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTagHelperFactsServiceTest.cs deleted file mode 100644 index 5d2d12452d..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTagHelperFactsServiceTest.cs +++ /dev/null @@ -1,388 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultTagHelperFactsServiceTest - { - // Purposefully not thoroughly testing DefaultTagHelperFactsService.GetTagHelperBinding because it's a pass through - // into TagHelperDescriptorProvider.GetTagHelperBinding. - - [Fact] - public void GetTagHelperBinding_DoesNotAllowOptOutCharacterPrefix() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var binding = service.GetTagHelperBinding(documentContext, "!a", Enumerable.Empty>(), parentTag: null, parentIsTagHelper: false); - - // Assert - Assert.Null(binding); - } - - [Fact] - public void GetTagHelperBinding_WorksAsExpected() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => - rule - .RequireTagName("a") - .RequireAttributeDescriptor(attribute => attribute.Name("asp-for"))) - .BoundAttributeDescriptor(attribute => - attribute - .Name("asp-for") - .TypeName(typeof(string).FullName) - .PropertyName("AspFor")) - .BoundAttributeDescriptor(attribute => - attribute - .Name("asp-route") - .TypeName(typeof(IDictionary).Namespace + "IDictionary") - .PropertyName("AspRoute") - .AsDictionaryAttribute("asp-route-", typeof(string).FullName)) - .Build(), - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("input")) - .BoundAttributeDescriptor(attribute => - attribute - .Name("asp-for") - .TypeName(typeof(string).FullName) - .PropertyName("AspFor")) - .Build(), - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - var attributes = new[] - { - new KeyValuePair("asp-for", "Name") - }; - - // Act - var binding = service.GetTagHelperBinding(documentContext, "a", attributes, parentTag: "p", parentIsTagHelper: false); - - // Assert - var descriptor = Assert.Single(binding.Descriptors); - Assert.Equal(documentDescriptors[0], descriptor, TagHelperDescriptorComparer.CaseSensitive); - var boundRule = Assert.Single(binding.GetBoundRules(descriptor)); - Assert.Equal(documentDescriptors[0].TagMatchingRules.First(), boundRule, TagMatchingRuleDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetBoundTagHelperAttributes_MatchesPrefixedAttributeName() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("a")) - .BoundAttributeDescriptor(attribute => - attribute - .Name("asp-for") - .TypeName(typeof(string).FullName) - .PropertyName("AspFor")) - .BoundAttributeDescriptor(attribute => - attribute - .Name("asp-route") - .TypeName(typeof(IDictionary).Namespace + "IDictionary") - .PropertyName("AspRoute") - .AsDictionaryAttribute("asp-route-", typeof(string).FullName)) - .Build() - }; - var expectedAttributeDescriptors = new[] - { - documentDescriptors[0].BoundAttributes.Last() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - var binding = service.GetTagHelperBinding(documentContext, "a", Enumerable.Empty>(), parentTag: null, parentIsTagHelper: false); - - // Act - var descriptors = service.GetBoundTagHelperAttributes(documentContext, "asp-route-something", binding); - - // Assert - Assert.Equal(expectedAttributeDescriptors, descriptors, BoundAttributeDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetBoundTagHelperAttributes_MatchesAttributeName() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("input")) - .BoundAttributeDescriptor(attribute => - attribute - .Name("asp-for") - .TypeName(typeof(string).FullName) - .PropertyName("AspFor")) - .BoundAttributeDescriptor(attribute => - attribute - .Name("asp-extra") - .TypeName(typeof(string).FullName) - .PropertyName("AspExtra")) - .Build() - }; - var expectedAttributeDescriptors = new[] - { - documentDescriptors[0].BoundAttributes.First() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - var binding = service.GetTagHelperBinding(documentContext, "input", Enumerable.Empty>(), parentTag: null, parentIsTagHelper: false); - - // Act - var descriptors = service.GetBoundTagHelperAttributes(documentContext, "asp-for", binding); - - // Assert - Assert.Equal(expectedAttributeDescriptors, descriptors, BoundAttributeDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetTagHelpersGivenTag_DoesNotAllowOptOutCharacterPrefix() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("*")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenTag(documentContext, "!strong", parentTag: null); - - // Assert - Assert.Empty(descriptors); - } - - [Fact] - public void GetTagHelpersGivenTag_RequiresTagName() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("strong")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenTag(documentContext, "strong", "p"); - - // Assert - Assert.Equal(documentDescriptors, descriptors, TagHelperDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetTagHelpersGivenTag_RestrictsTagHelpersBasedOnTagName() - { - // Arrange - var expectedDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor( - rule => rule - .RequireTagName("a") - .RequireParentTag("div")) - .Build() - }; - var documentDescriptors = new[] - { - expectedDescriptors[0], - TagHelperDescriptorBuilder.Create("TestType2", "TestAssembly") - .TagMatchingRuleDescriptor( - rule => rule - .RequireTagName("strong") - .RequireParentTag("div")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenTag(documentContext, "a", "div"); - - // Assert - Assert.Equal(expectedDescriptors, descriptors, TagHelperDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetTagHelpersGivenTag_RestrictsTagHelpersBasedOnTagHelperPrefix() - { - // Arrange - var expectedDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("strong")) - .Build() - }; - var documentDescriptors = new[] - { - expectedDescriptors[0], - TagHelperDescriptorBuilder.Create("TestType2", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("thstrong")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create("th", documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenTag(documentContext, "thstrong", "div"); - - // Assert - Assert.Equal(expectedDescriptors, descriptors, TagHelperDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetTagHelpersGivenTag_RestrictsTagHelpersBasedOnParent() - { - // Arrange - var expectedDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor( - rule => rule - .RequireTagName("strong") - .RequireParentTag("div")) - .Build() - }; - var documentDescriptors = new[] - { - expectedDescriptors[0], - TagHelperDescriptorBuilder.Create("TestType2", "TestAssembly") - .TagMatchingRuleDescriptor( - rule => rule - .RequireTagName("strong") - .RequireParentTag("p")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenTag(documentContext, "strong", "div"); - - // Assert - Assert.Equal(expectedDescriptors, descriptors, TagHelperDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetTagHelpersGivenParent_AllowsRootParentTag() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenParent(documentContext, parentTag: null /* root */); - - // Assert - Assert.Equal(documentDescriptors, descriptors, TagHelperDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetTagHelpersGivenParent_AllowsRootParentTagForParentRestrictedTagHelperDescriptors() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("DivTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .Build(), - TagHelperDescriptorBuilder.Create("PTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule - .RequireTagName("p") - .RequireParentTag("body")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenParent(documentContext, parentTag: null /* root */); - - // Assert - var descriptor = Assert.Single(descriptors); - Assert.Equal(documentDescriptors[0], descriptor, TagHelperDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetTagHelpersGivenParent_AllowsUnspecifiedParentTagHelpers() - { - // Arrange - var documentDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("div")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenParent(documentContext, "p"); - - // Assert - Assert.Equal(documentDescriptors, descriptors, TagHelperDescriptorComparer.CaseSensitive); - } - - [Fact] - public void GetTagHelpersGivenParent_RestrictsTagHelpersBasedOnParent() - { - // Arrange - var expectedDescriptors = new[] - { - TagHelperDescriptorBuilder.Create("TestType", "TestAssembly") - .TagMatchingRuleDescriptor( - rule => rule - .RequireTagName("p") - .RequireParentTag("div")) - .Build() - }; - var documentDescriptors = new[] - { - expectedDescriptors[0], - TagHelperDescriptorBuilder.Create("TestType2", "TestAssembly") - .TagMatchingRuleDescriptor( - rule => rule - .RequireTagName("strong") - .RequireParentTag("p")) - .Build() - }; - var documentContext = TagHelperDocumentContext.Create(string.Empty, documentDescriptors); - var service = new DefaultTagHelperFactsService(); - - // Act - var descriptors = service.GetTagHelpersGivenParent(documentContext, "div"); - - // Assert - Assert.Equal(expectedDescriptors, descriptors, TagHelperDescriptorComparer.CaseSensitive); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTextBufferCodeDocumentProviderTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTextBufferCodeDocumentProviderTest.cs deleted file mode 100644 index 8daedb4d73..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTextBufferCodeDocumentProviderTest.cs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Utilities; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultTextBufferCodeDocumentProviderTest - { - [Fact] - public void TryGetFromBuffer_SucceedsIfParserHasCodeDocument() - { - // Arrange - var expectedCodeDocument = TestRazorCodeDocument.Create("Hello World"); - VisualStudioRazorParser parser = new DefaultVisualStudioRazorParser(expectedCodeDocument); - var properties = new PropertyCollection() - { - [typeof(VisualStudioRazorParser)] = parser - }; - var textBuffer = Mock.Of(buffer => buffer.Properties == properties); - var provider = new DefaultTextBufferCodeDocumentProvider(); - - // Act - var result = provider.TryGetFromBuffer(textBuffer, out var codeDocument); - - // Assert - Assert.True(result); - Assert.Same(expectedCodeDocument, codeDocument); - } - - [Fact] - public void TryGetFromBuffer_FailsIfParserMissingCodeDocument() - { - // Arrange - VisualStudioRazorParser parser = new DefaultVisualStudioRazorParser(codeDocument: null); - var properties = new PropertyCollection() - { - [typeof(VisualStudioRazorParser)] = parser - }; - var textBuffer = Mock.Of(buffer => buffer.Properties == properties); - var provider = new DefaultTextBufferCodeDocumentProvider(); - - // Act - var result = provider.TryGetFromBuffer(textBuffer, out var codeDocument); - - // Assert - Assert.False(result); - Assert.Null(codeDocument); - } - - [Fact] - public void TryGetFromBuffer_FailsIfNoParserIsAvailable() - { - // Arrange - var textBuffer = Mock.Of(buffer => buffer.Properties == new PropertyCollection()); - var provider = new DefaultTextBufferCodeDocumentProvider(); - - // Act - var result = provider.TryGetFromBuffer(textBuffer, out var codeDocument); - - // Assert - Assert.False(result); - Assert.Null(codeDocument); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTextBufferProviderTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTextBufferProviderTest.cs deleted file mode 100644 index fef720a47e..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultTextBufferProviderTest.cs +++ /dev/null @@ -1,159 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.ObjectModel; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Projection; -using Microsoft.VisualStudio.Utilities; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultTextBufferProviderTest - { - [Fact] - public void TryGetFromDocument_ReturnsFalseIfCannotExtractSourceText() - { - // Arrange - var textBuffer = CreateTextBuffer(); - var bufferGraphService = CreateBufferGraphService(textBuffer); - var document = CreateDocumentWithoutText(); - var bufferProvider = new DefaultTextBufferProvider(bufferGraphService); - - // Act - var result = bufferProvider.TryGetFromDocument(document, out var buffer); - - // Assert - Assert.False(result); - Assert.Null(buffer); - } - - [Fact] - public void TryGetFromDocument_ReturnsFalseIfSourceContainerNotConstructedFromTextBuffer() - { - // Arrange - var bufferGraphService = CreateBufferGraphService(null); - var text = SourceText.From("Hello World"); - var document = CreateDocumentWithoutText(); - document = document.WithText(text); - var bufferProvider = new DefaultTextBufferProvider(bufferGraphService); - - // Act - var result = bufferProvider.TryGetFromDocument(document, out var buffer); - - // Assert - Assert.False(result); - Assert.Null(buffer); - } - - [Fact] - public void TryGetFromDocument_ReturnsFalseIfBufferGraphCanNotFindRazorBuffer() - { - // Arrange - var textBuffer = CreateTextBuffer(); - var bufferGraph = new Mock(); - bufferGraph.Setup(graph => graph.GetTextBuffers(It.IsAny>())) - .Returns(new Collection()); - var bufferGraphService = new Mock(); - bufferGraphService.Setup(service => service.CreateBufferGraph(textBuffer)) - .Returns(bufferGraph.Object); - var document = CreateDocument(textBuffer); - var bufferProvider = new DefaultTextBufferProvider(bufferGraphService.Object); - - // Act - var result = bufferProvider.TryGetFromDocument(document, out var buffer); - - // Assert - Assert.False(result); - Assert.Null(buffer); - } - - [Fact] - public void TryGetFromDocument_ReturnsTrueForValidDocuments() - { - // Arrange - var textBuffer = CreateTextBuffer(); - var bufferGraphService = CreateBufferGraphService(textBuffer); - var document = CreateDocument(textBuffer); - var bufferProvider = new DefaultTextBufferProvider(bufferGraphService); - - // Act - var result = bufferProvider.TryGetFromDocument(document, out var buffer); - - // Assert - Assert.True(result); - Assert.Same(textBuffer, buffer); - } - - private static Document CreateDocumentWithoutText() - { - Document document = null; - TestWorkspace.Create(workspace => - { - var project = ProjectInfo - .Create(ProjectId.CreateNewId(), VersionStamp.Default, "TestProject", "TestAssembly", LanguageNames.CSharp) - .WithFilePath("/TestProject.csproj"); - workspace.AddProject(project); - var documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "Test.cshtml"); - document = workspace.AddDocument(documentInfo); - }); - - return document; - } - - private static Document CreateDocument(ITextBuffer buffer) - { - var document = CreateDocumentWithoutText(); - var container = buffer.AsTextContainer(); - document = document.WithText(container.CurrentText); - return document; - } - - private static ITextBuffer CreateTextBuffer() - { - var textBuffer = new Mock(); - textBuffer.Setup(buffer => buffer.Properties) - .Returns(new PropertyCollection()); - - var textImage = new Mock(); - var textVersion = new Mock(); - var textBufferSnapshot = new Mock(); - textBufferSnapshot.Setup(snapshot => snapshot.TextImage) - .Returns(textImage.Object); - textBufferSnapshot.Setup(snapshot => snapshot.Length) - .Returns(0); - textBufferSnapshot.Setup(snapshot => snapshot.Version) - .Returns(textVersion.Object); - textBufferSnapshot.Setup(snapshot => snapshot.TextBuffer) - .Returns(() => textBuffer.Object); - - textBuffer.Setup(buffer => buffer.CurrentSnapshot) - .Returns(() => textBufferSnapshot.Object); - - var contentType = new Mock(); - contentType.Setup(type => type.IsOfType(It.IsAny())) - .Returns(val => val == RazorLanguage.CoreContentType); - textBuffer.Setup(buffer => buffer.ContentType) - .Returns(contentType.Object); - - return textBuffer.Object; - } - - private static IBufferGraphFactoryService CreateBufferGraphService(ITextBuffer buffer) - { - var bufferGraph = new Mock(); - bufferGraph.Setup(graph => graph.GetTextBuffers(It.IsAny>())) - .Returns>(predicate => predicate(buffer) ? new Collection() { buffer } : new Collection()); - var bufferGraphService = new Mock(); - bufferGraphService.Setup(service => service.CreateBufferGraph(buffer)) - .Returns(bufferGraph.Object); - - return bufferGraphService.Object; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioDocumentTrackerTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioDocumentTrackerTest.cs deleted file mode 100644 index e0c178f772..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioDocumentTrackerTest.cs +++ /dev/null @@ -1,324 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.Utilities; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultVisualStudioDocumentTrackerTest : ForegroundDispatcherTestBase - { - private IContentType RazorCoreContentType { get; } = Mock.Of(c => c.IsOfType(RazorLanguage.CoreContentType) == true); - - private ITextBuffer TextBuffer => Mock.Of(b => b.ContentType == RazorCoreContentType); - - private string FilePath => "C:/Some/Path/TestDocumentTracker.cshtml"; - - private string ProjectPath => "C:/Some/Path/TestProject.csproj"; - - private ProjectSnapshotManager ProjectManager => Mock.Of(p => p.Projects == new List()); - - private WorkspaceEditorSettings WorkspaceEditorSettings => new DefaultWorkspaceEditorSettings(Dispatcher, Mock.Of()); - - private Workspace Workspace => TestWorkspace.Create(); - - private ImportDocumentManager ImportDocumentManager => Mock.Of(); - - [Fact] - public void EditorSettingsManager_Changed_TriggersContextChanged() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - var called = false; - documentTracker.ContextChanged += (sender, args) => - { - Assert.Equal(ContextChangeKind.EditorSettingsChanged, args.Kind); - called = true; - Assert.Equal(ContextChangeKind.EditorSettingsChanged, args.Kind); - }; - - // Act - documentTracker.EditorSettingsManager_Changed(null, null); - - // Assert - Assert.True(called); - } - - [Fact] - public void ProjectManager_Changed_ProjectChanged_TriggersContextChanged() - { - // Arrange - Project project = null; - var workspace = TestWorkspace.Create(ws => - { - project = ws.AddProject(ProjectInfo.Create(ProjectId.CreateNewId(), new VersionStamp(), "Test1", "TestAssembly", LanguageNames.CSharp, filePath: "C:/Some/Path/TestProject.csproj")); - }); - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, workspace, TextBuffer, ImportDocumentManager); - - var projectSnapshot = new DefaultProjectSnapshot(new HostProject(project.FilePath, RazorConfiguration.Default), project); - var projectChangedArgs = new ProjectChangeEventArgs(projectSnapshot, ProjectChangeKind.Changed); - - var called = false; - documentTracker.ContextChanged += (sender, args) => - { - Assert.Equal(ContextChangeKind.ProjectChanged, args.Kind); - called = true; - }; - - // Act - documentTracker.ProjectManager_Changed(null, projectChangedArgs); - - // Assert - Assert.True(called); - } - - [Fact] - public void ProjectManager_Changed_TagHelpersChanged_TriggersContextChanged() - { - // Arrange - Project project = null; - var workspace = TestWorkspace.Create(ws => - { - project = ws.AddProject(ProjectInfo.Create(ProjectId.CreateNewId(), new VersionStamp(), "Test1", "TestAssembly", LanguageNames.CSharp, filePath: "C:/Some/Path/TestProject.csproj")); - }); - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, workspace, TextBuffer, ImportDocumentManager); - - var projectSnapshot = new DefaultProjectSnapshot(new HostProject(project.FilePath, RazorConfiguration.Default), project); - var projectChangedArgs = new ProjectChangeEventArgs(projectSnapshot, ProjectChangeKind.TagHelpersChanged); - - var called = false; - documentTracker.ContextChanged += (sender, args) => - { - Assert.Equal(ContextChangeKind.TagHelpersChanged, args.Kind); - called = true; - }; - - // Act - documentTracker.ProjectManager_Changed(null, projectChangedArgs); - - // Assert - Assert.True(called); - } - - [Fact] - public void ProjectManager_Changed_IgnoresUnknownProject() - { - // Arrange - Project project = null; - var workspace = TestWorkspace.Create(ws => - { - project = ws.AddProject(ProjectInfo.Create(ProjectId.CreateNewId(), new VersionStamp(), "Test1", "TestAssembly", LanguageNames.CSharp, filePath: "C:/Some/Other/Path/TestProject.csproj")); - }); - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, workspace, TextBuffer, ImportDocumentManager); - - var projectSnapshot = new DefaultProjectSnapshot(new HostProject(project.FilePath, RazorConfiguration.Default), project); - var projectChangedArgs = new ProjectChangeEventArgs(projectSnapshot, ProjectChangeKind.Changed); - - var called = false; - documentTracker.ContextChanged += (sender, args) => - { - called = true; - }; - - // Act - documentTracker.ProjectManager_Changed(null, projectChangedArgs); - - // Assert - Assert.False(called); - } - - [Fact] - public void Import_Changed_ImportAssociatedWithDocument_TriggersContextChanged() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - - var called = false; - documentTracker.ContextChanged += (sender, args) => - { - Assert.Equal(ContextChangeKind.ImportsChanged, args.Kind); - called = true; - }; - - var importChangedArgs = new ImportChangedEventArgs("path/to/import", FileChangeKind.Changed, new[] { FilePath }); - - // Act - documentTracker.Import_Changed(null, importChangedArgs); - - // Assert - Assert.True(called); - } - - [Fact] - public void Import_Changed_UnrelatedImport_DoesNothing() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - - documentTracker.ContextChanged += (sender, args) => - { - throw new InvalidOperationException(); - }; - - var importChangedArgs = new ImportChangedEventArgs("path/to/import", FileChangeKind.Changed, new[] { "path/to/differentfile" }); - - // Act & Assert (Does not throw) - documentTracker.Import_Changed(null, importChangedArgs); - } - - [Fact] - public void Subscribe_SetsSupportedProjectAndTriggersContextChanged() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - var called = false; - documentTracker.ContextChanged += (sender, args) => - { - called = true; - Assert.Equal(ContextChangeKind.ProjectChanged, args.Kind); - }; - - // Act - documentTracker.Subscribe(); - - // Assert - Assert.True(called); - Assert.True(documentTracker.IsSupportedProject); - } - - [Fact] - public void Unsubscribe_ResetsSupportedProjectAndTriggersContextChanged() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - - // Subscribe once to set supported project - documentTracker.Subscribe(); - - var called = false; - documentTracker.ContextChanged += (sender, args) => - { - called = true; - Assert.Equal(ContextChangeKind.ProjectChanged, args.Kind); - }; - - // Act - documentTracker.Unsubscribe(); - - // Assert - Assert.False(documentTracker.IsSupportedProject); - Assert.True(called); - } - - [Fact] - public void AddTextView_AddsToTextViewCollection() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - var textView = Mock.Of(); - - // Act - documentTracker.AddTextView(textView); - - // Assert - Assert.Collection(documentTracker.TextViews, v => Assert.Same(v, textView)); - } - - [Fact] - public void AddTextView_DoesNotAddDuplicateTextViews() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - var textView = Mock.Of(); - - // Act - documentTracker.AddTextView(textView); - documentTracker.AddTextView(textView); - - // Assert - Assert.Collection(documentTracker.TextViews, v => Assert.Same(v, textView)); - } - - [Fact] - public void AddTextView_AddsMultipleTextViewsToCollection() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - var textView1 = Mock.Of(); - var textView2 = Mock.Of(); - - // Act - documentTracker.AddTextView(textView1); - documentTracker.AddTextView(textView2); - - // Assert - Assert.Collection( - documentTracker.TextViews, - v => Assert.Same(v, textView1), - v => Assert.Same(v, textView2)); - } - - [Fact] - public void RemoveTextView_RemovesTextViewFromCollection_SingleItem() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - var textView = Mock.Of(); - documentTracker.AddTextView(textView); - - // Act - documentTracker.RemoveTextView(textView); - - // Assert - Assert.Empty(documentTracker.TextViews); - } - - [Fact] - public void RemoveTextView_RemovesTextViewFromCollection_MultipleItems() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - var textView1 = Mock.Of(); - var textView2 = Mock.Of(); - var textView3 = Mock.Of(); - documentTracker.AddTextView(textView1); - documentTracker.AddTextView(textView2); - documentTracker.AddTextView(textView3); - - // Act - documentTracker.RemoveTextView(textView2); - - // Assert - Assert.Collection( - documentTracker.TextViews, - v => Assert.Same(v, textView1), - v => Assert.Same(v, textView3)); - } - - [Fact] - public void RemoveTextView_NoopsWhenRemovingTextViewNotInCollection() - { - // Arrange - var documentTracker = new DefaultVisualStudioDocumentTracker(Dispatcher, FilePath, ProjectPath, ProjectManager, WorkspaceEditorSettings, Workspace, TextBuffer, ImportDocumentManager); - var textView1 = Mock.Of(); - documentTracker.AddTextView(textView1); - var textView2 = Mock.Of(); - - // Act - documentTracker.RemoveTextView(textView2); - - // Assert - Assert.Collection(documentTracker.TextViews, v => Assert.Same(v, textView1)); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserIntegrationTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserIntegrationTest.cs deleted file mode 100644 index 2102506035..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserIntegrationTest.cs +++ /dev/null @@ -1,712 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc.Razor.Extensions; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Test; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultVisualStudioRazorParserIntegrationTest : ForegroundDispatcherTestBase - { - private const string TestLinePragmaFileName = "C:\\This\\Path\\Is\\Just\\For\\Line\\Pragmas.cshtml"; - private const string TestProjectPath = "C:\\This\\Path\\Is\\Just\\For\\Project.csproj"; - - [ForegroundFact] - public async Task BufferChangeStartsFullReparseIfChangeOverlapsMultipleSpans() - { - // Arrange - var original = new StringTextSnapshot("Foo @bar Baz"); - var testBuffer = new TestTextBuffer(original); - var documentTracker = CreateDocumentTracker(testBuffer); - using (var manager = CreateParserManager(original)) - { - var changed = new StringTextSnapshot("Foo @bap Daz"); - var edit = new TestEdit(7, 3, original, 3, changed, "p D"); - - await manager.InitializeWithDocumentAsync(edit.OldSnapshot); - - // Act - 1 - await manager.ApplyEditAndWaitForParseAsync(edit); - - // Assert - 1 - Assert.Equal(2, manager.ParseCount); - - // Act - 2 - await manager.ApplyEditAndWaitForParseAsync(edit); - - // Assert - 2 - Assert.Equal(3, manager.ParseCount); - } - } - - [ForegroundFact] - public async Task AwaitPeriodInsertionAcceptedProvisionally() - { - // Arrange - var original = new StringTextSnapshot("foo @await Html baz"); - using (var manager = CreateParserManager(original)) - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @await Html. baz"); - var edit = new TestEdit(15, 0, original, 1, changed, "."); - await manager.InitializeWithDocumentAsync(edit.OldSnapshot); - - // Act - await manager.ApplyEditAndWaitForReparseAsync(edit); - - // Assert - Assert.Equal(2, manager.ParseCount); - ParserTestBase.EvaluateParseTree(manager.CurrentSyntaxTree.Root, new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("await Html").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.WhiteSpace | AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(". baz"))); - } - } - - [ForegroundFact] - public async Task ImplicitExpressionAcceptsDotlessCommitInsertionsInStatementBlockAfterIdentifiers() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateTime." + Environment.NewLine - + "}"); - var original = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateTime" + Environment.NewLine - + "}"); - - var edit = new TestEdit(15 + Environment.NewLine.Length, 0, original, 1, changed, "."); - using (var manager = CreateParserManager(original)) - { - void ApplyAndVerifyPartialChange(TestEdit testEdit, string expectedCode) - { - manager.ApplyEdit(testEdit); - Assert.Equal(1, manager.ParseCount); - ParserTestBase.EvaluateParseTree(manager.PartialParsingSyntaxTreeRoot, new MarkupBlock( - factory.EmptyHtml(), - new StatementBlock( - factory.CodeTransition(), - factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None), - factory.Code(Environment.NewLine + " ") - .AsStatement() - .AutoCompleteWith(autoCompleteString: null), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code(expectedCode) - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Code(Environment.NewLine).AsStatement(), - factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)), - factory.EmptyHtml())); - }; - - await manager.InitializeWithDocumentAsync(edit.OldSnapshot); - - // This is the process of a dotless commit when doing "." insertions to commit intellisense changes. - ApplyAndVerifyPartialChange(edit, "DateTime."); - - original = changed; - changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateTime.." + Environment.NewLine - + "}"); - edit = new TestEdit(16 + Environment.NewLine.Length, 0, original, 1, changed, "."); - - ApplyAndVerifyPartialChange(edit, "DateTime.."); - - original = changed; - changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateTime.Now." + Environment.NewLine - + "}"); - edit = new TestEdit(16 + Environment.NewLine.Length, 0, original, 3, changed, "Now"); - - ApplyAndVerifyPartialChange(edit, "DateTime.Now."); - } - } - - [ForegroundFact] - public async Task ImplicitExpressionAcceptsDotlessCommitInsertionsInStatementBlock() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateT." + Environment.NewLine - + "}"); - var original = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateT" + Environment.NewLine - + "}"); - - var edit = new TestEdit(12 + Environment.NewLine.Length, 0, original, 1, changed, "."); - using (var manager = CreateParserManager(original)) - { - void ApplyAndVerifyPartialChange(TestEdit testEdit, string expectedCode) - { - manager.ApplyEdit(testEdit); - Assert.Equal(1, manager.ParseCount); - ParserTestBase.EvaluateParseTree(manager.PartialParsingSyntaxTreeRoot, new MarkupBlock( - factory.EmptyHtml(), - new StatementBlock( - factory.CodeTransition(), - factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None), - factory.Code(Environment.NewLine + " ") - .AsStatement() - .AutoCompleteWith(autoCompleteString: null), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code(expectedCode) - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Code(Environment.NewLine).AsStatement(), - factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)), - factory.EmptyHtml())); - }; - - await manager.InitializeWithDocumentAsync(edit.OldSnapshot); - - // This is the process of a dotless commit when doing "." insertions to commit intellisense changes. - ApplyAndVerifyPartialChange(edit, "DateT."); - - original = changed; - changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateTime." + Environment.NewLine - + "}"); - edit = new TestEdit(12 + Environment.NewLine.Length, 0, original, 3, changed, "ime"); - - ApplyAndVerifyPartialChange(edit, "DateTime."); - } - } - - [ForegroundFact] - public async Task ImplicitExpressionProvisionallyAcceptsDotlessCommitInsertions() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @DateT. baz"); - var original = new StringTextSnapshot("foo @DateT baz"); - var edit = new TestEdit(10, 0, original, 1, changed, "."); - using (var manager = CreateParserManager(original)) - { - void ApplyAndVerifyPartialChange(TestEdit testEdit, string expectedCode) - { - manager.ApplyEdit(testEdit); - Assert.Equal(1, manager.ParseCount); - - ParserTestBase.EvaluateParseTree(manager.PartialParsingSyntaxTreeRoot, new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code(expectedCode).AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - }; - - await manager.InitializeWithDocumentAsync(edit.OldSnapshot); - - // This is the process of a dotless commit when doing "." insertions to commit intellisense changes. - ApplyAndVerifyPartialChange(edit, "DateT."); - - original = changed; - changed = new StringTextSnapshot("foo @DateTime. baz"); - edit = new TestEdit(10, 0, original, 3, changed, "ime"); - - ApplyAndVerifyPartialChange(edit, "DateTime."); - - // Verify the reparse finally comes - await manager.WaitForReparseAsync(); - - Assert.Equal(2, manager.ParseCount); - ParserTestBase.EvaluateParseTree(manager.CurrentSyntaxTree.Root, new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(". baz"))); - } - } - - [ForegroundFact] - public async Task ImplicitExpressionProvisionallyAcceptsDotlessCommitInsertionsAfterIdentifiers() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @DateTime. baz"); - var original = new StringTextSnapshot("foo @DateTime baz"); - var edit = new TestEdit(13, 0, original, 1, changed, "."); - using (var manager = CreateParserManager(original)) - { - void ApplyAndVerifyPartialChange(TestEdit testEdit, string expectedCode) - { - manager.ApplyEdit(testEdit); - Assert.Equal(1, manager.ParseCount); - - ParserTestBase.EvaluateParseTree(manager.PartialParsingSyntaxTreeRoot, new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code(expectedCode).AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - }; - - await manager.InitializeWithDocumentAsync(edit.OldSnapshot); - - // This is the process of a dotless commit when doing "." insertions to commit intellisense changes. - ApplyAndVerifyPartialChange(edit, "DateTime."); - - original = changed; - changed = new StringTextSnapshot("foo @DateTime.. baz"); - edit = new TestEdit(14, 0, original, 1, changed, "."); - - ApplyAndVerifyPartialChange(edit, "DateTime.."); - - original = changed; - changed = new StringTextSnapshot("foo @DateTime.Now. baz"); - edit = new TestEdit(14, 0, original, 3, changed, "Now"); - - ApplyAndVerifyPartialChange(edit, "DateTime.Now."); - - // Verify the reparse eventually happens - await manager.WaitForReparseAsync(); - - Assert.Equal(2, manager.ParseCount); - ParserTestBase.EvaluateParseTree(manager.CurrentSyntaxTree.Root, new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime.Now").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(". baz"))); - } - } - - [ForegroundFact] - public async Task ImplicitExpressionProvisionallyAcceptsCaseInsensitiveDotlessCommitInsertions_NewRoslynIntegration() - { - var factory = new SpanFactory(); - var original = new StringTextSnapshot("foo @date baz"); - var changed = new StringTextSnapshot("foo @date. baz"); - var edit = new TestEdit(9, 0, original, 1, changed, "."); - using (var manager = CreateParserManager(original)) - { - void ApplyAndVerifyPartialChange(Action applyEdit, string expectedCode) - { - applyEdit(); - Assert.Equal(1, manager.ParseCount); - - ParserTestBase.EvaluateParseTree(manager.PartialParsingSyntaxTreeRoot, new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code(expectedCode).AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - }; - - await manager.InitializeWithDocumentAsync(edit.OldSnapshot); - - // This is the process of a dotless commit when doing "." insertions to commit intellisense changes. - - // @date => @date. - ApplyAndVerifyPartialChange(() => manager.ApplyEdit(edit), "date."); - - original = changed; - changed = new StringTextSnapshot("foo @date baz"); - edit = new TestEdit(9, 1, original, 0, changed, ""); - - // @date. => @date - ApplyAndVerifyPartialChange(() => manager.ApplyEdit(edit), "date"); - - original = changed; - changed = new StringTextSnapshot("foo @DateTime baz"); - edit = new TestEdit(5, 4, original, 8, changed, "DateTime"); - - // @date => @DateTime - ApplyAndVerifyPartialChange(() => manager.ApplyEdit(edit), "DateTime"); - - original = changed; - changed = new StringTextSnapshot("foo @DateTime. baz"); - edit = new TestEdit(13, 0, original, 1, changed, "."); - - // @DateTime => @DateTime. - ApplyAndVerifyPartialChange(() => manager.ApplyEdit(edit), "DateTime."); - - // Verify the reparse eventually happens - await manager.WaitForReparseAsync(); - - Assert.Equal(2, manager.ParseCount); - ParserTestBase.EvaluateParseTree(manager.CurrentSyntaxTree.Root, new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(". baz"))); - } - } - - [ForegroundFact] - public async Task ImplicitExpressionRejectsChangeWhichWouldHaveBeenAcceptedIfLastChangeWasProvisionallyAcceptedOnDifferentSpan() - { - // Arrange - var factory = new SpanFactory(); - var dotTyped = new TestEdit(8, 0, new StringTextSnapshot("foo @foo @bar"), 1, new StringTextSnapshot("foo @foo. @bar"), "."); - var charTyped = new TestEdit(14, 0, new StringTextSnapshot("foo @foo. @bar"), 1, new StringTextSnapshot("foo @foo. @barb"), "b"); - using (var manager = CreateParserManager(dotTyped.OldSnapshot)) - { - await manager.InitializeWithDocumentAsync(dotTyped.OldSnapshot); - - // Apply the dot change - await manager.ApplyEditAndWaitForReparseAsync(dotTyped); - - // Act (apply the identifier start char change) - await manager.ApplyEditAndWaitForParseAsync(charTyped); - - // Assert - Assert.Equal(2, manager.ParseCount); - ParserTestBase.EvaluateParseTree(manager.PartialParsingSyntaxTreeRoot, - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("foo") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(". "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("barb") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.EmptyHtml())); - } - } - - [ForegroundFact] - public async Task ImplicitExpressionAcceptsIdentifierTypedAfterDotIfLastChangeWasProvisionalAcceptanceOfDot() - { - // Arrange - var factory = new SpanFactory(); - var dotTyped = new TestEdit(8, 0, new StringTextSnapshot("foo @foo bar"), 1, new StringTextSnapshot("foo @foo. bar"), "."); - var charTyped = new TestEdit(9, 0, new StringTextSnapshot("foo @foo. bar"), 1, new StringTextSnapshot("foo @foo.b bar"), "b"); - using (var manager = CreateParserManager(dotTyped.OldSnapshot)) - { - await manager.InitializeWithDocumentAsync(dotTyped.OldSnapshot); - - // Apply the dot change - manager.ApplyEdit(dotTyped); - - // Act (apply the identifier start char change) - manager.ApplyEdit(charTyped); - - // Assert - Assert.Equal(1, manager.ParseCount); - ParserTestBase.EvaluateParseTree(manager.PartialParsingSyntaxTreeRoot, - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("foo.b") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" bar"))); - } - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfIfKeywordTyped() - { - await RunTypeKeywordTestAsync("if"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfDoKeywordTyped() - { - await RunTypeKeywordTestAsync("do"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfTryKeywordTyped() - { - await RunTypeKeywordTestAsync("try"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfForKeywordTyped() - { - await RunTypeKeywordTestAsync("for"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfForEachKeywordTyped() - { - await RunTypeKeywordTestAsync("foreach"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfWhileKeywordTyped() - { - await RunTypeKeywordTestAsync("while"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfSwitchKeywordTyped() - { - await RunTypeKeywordTestAsync("switch"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfLockKeywordTyped() - { - await RunTypeKeywordTestAsync("lock"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfUsingKeywordTyped() - { - await RunTypeKeywordTestAsync("using"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfSectionKeywordTyped() - { - await RunTypeKeywordTestAsync("section"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfInheritsKeywordTyped() - { - await RunTypeKeywordTestAsync("inherits"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfFunctionsKeywordTyped() - { - await RunTypeKeywordTestAsync("functions"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfNamespaceKeywordTyped() - { - await RunTypeKeywordTestAsync("namespace"); - } - - [ForegroundFact] - public async Task ImplicitExpressionCorrectlyTriggersReparseIfClassKeywordTyped() - { - await RunTypeKeywordTestAsync("class"); - } - - private TestParserManager CreateParserManager(ITextSnapshot originalSnapshot) - { - var textBuffer = new TestTextBuffer(originalSnapshot); - var documentTracker = CreateDocumentTracker(textBuffer); - var templateEngineFactory = CreateTemplateEngineFactory(); - var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - documentTracker, - templateEngineFactory, - new DefaultErrorReporter(), - new TestCompletionBroker()) - { - // We block idle work with the below reset events. Therefore, make tests fast and have the idle timer fire as soon as possible. - IdleDelay = TimeSpan.FromMilliseconds(1), - NotifyForegroundIdleStart = new ManualResetEventSlim(), - BlockBackgroundIdleWork = new ManualResetEventSlim(), - }; - - parser.StartParser(); - - return new TestParserManager(parser); - } - - private static RazorProjectEngineFactoryService CreateTemplateEngineFactory( - string path = TestLinePragmaFileName, - IEnumerable tagHelpers = null) - { - var fileSystem = new TestRazorProjectFileSystem(); - var projectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, builder => - { - RazorExtensions.Register(builder); - - builder.AddDefaultImports("@addTagHelper *, Test"); - - if (tagHelpers != null) - { - builder.AddTagHelpers(tagHelpers); - } - }); - - var projectEngineFactoryService = Mock.Of( - service => service.Create(It.IsAny(), It.IsAny>()) == projectEngine); - - return projectEngineFactoryService; - } - - private async Task RunTypeKeywordTestAsync(string keyword) - { - // Arrange - var before = "@" + keyword.Substring(0, keyword.Length - 1); - var after = "@" + keyword; - var changed = new StringTextSnapshot(after); - var old = new StringTextSnapshot(before); - var change = new SourceChange(keyword.Length, 0, keyword[keyword.Length - 1].ToString()); - var edit = new TestEdit(change, old, changed); - using (var manager = CreateParserManager(old)) - { - await manager.InitializeWithDocumentAsync(edit.OldSnapshot); - - // Act - await manager.ApplyEditAndWaitForParseAsync(edit); - - // Assert - Assert.Equal(2, manager.ParseCount); - } - } - - private static void DoWithTimeoutIfNotDebugging(Func withTimeout) - { -#if DEBUG - if (Debugger.IsAttached) - { - withTimeout(Timeout.Infinite); - } - else - { -#endif - Assert.True(withTimeout((int)TimeSpan.FromSeconds(5).TotalMilliseconds), "Timeout expired!"); -#if DEBUG - } -#endif - } - - private static VisualStudioDocumentTracker CreateDocumentTracker(Text.ITextBuffer textBuffer) - { - var focusedTextView = Mock.Of(textView => textView.HasAggregateFocus == true); - var documentTracker = Mock.Of(tracker => - tracker.TextBuffer == textBuffer && - tracker.TextViews == new[] { focusedTextView } && - tracker.FilePath == TestLinePragmaFileName && - tracker.ProjectPath == TestProjectPath && - tracker.IsSupportedProject == true); - textBuffer.Properties.AddProperty(typeof(VisualStudioDocumentTracker), documentTracker); - - return documentTracker; - } - - private class TestParserManager : IDisposable - { - public int ParseCount; - - private readonly ManualResetEventSlim _parserComplete; - private readonly ManualResetEventSlim _reparseComplete; - private readonly TestTextBuffer _testBuffer; - private readonly DefaultVisualStudioRazorParser _parser; - - public TestParserManager(DefaultVisualStudioRazorParser parser) - { - _parserComplete = new ManualResetEventSlim(); - _reparseComplete = new ManualResetEventSlim(); - - _testBuffer = (TestTextBuffer)parser.TextBuffer; - ParseCount = 0; - - _parser = parser; - parser.DocumentStructureChanged += (sender, args) => - { - CurrentSyntaxTree = args.CodeDocument.GetSyntaxTree(); - - Interlocked.Increment(ref ParseCount); - - if (args.SourceChange == null) - { - // Reparse occurred - _reparseComplete.Set(); - } - - _parserComplete.Set(); - }; - } - - public RazorSyntaxTree CurrentSyntaxTree { get; private set; } - - public Block PartialParsingSyntaxTreeRoot => _parser._partialParser.SyntaxTreeRoot; - - public async Task InitializeWithDocumentAsync(ITextSnapshot snapshot) - { - var old = new StringTextSnapshot(string.Empty); - var initialChange = new SourceChange(0, 0, snapshot.GetText()); - var edit = new TestEdit(initialChange, old, snapshot); - await ApplyEditAndWaitForParseAsync(edit); - } - - public void ApplyEdit(TestEdit edit) - { - _testBuffer.ApplyEdit(edit); - } - - public async Task ApplyEditAndWaitForParseAsync(TestEdit edit) - { - ApplyEdit(edit); - await WaitForParseAsync(); - } - - public async Task ApplyEditAndWaitForReparseAsync(TestEdit edit) - { - ApplyEdit(edit); - await WaitForReparseAsync(); - } - - public async Task WaitForParseAsync() - { - // Get off of the foreground thread so we can wait for the document structure changed event to fire - await Task.Run(() => - { - DoWithTimeoutIfNotDebugging(_parserComplete.Wait); - }); - - _parserComplete.Reset(); - } - - public async Task WaitForReparseAsync() - { - Assert.True(_parser._idleTimer != null); - - // Allow background idle work to continue - _parser.BlockBackgroundIdleWork.Set(); - - // Get off of the foreground thread so we can wait for the idle timer to fire - await Task.Run(() => - { - DoWithTimeoutIfNotDebugging(_parser.NotifyForegroundIdleStart.Wait); - }); - - Assert.Null(_parser._idleTimer); - - // Get off of the foreground thread so we can wait for the document structure changed event to fire for reparse - await Task.Run(() => - { - DoWithTimeoutIfNotDebugging(_reparseComplete.Wait); - }); - - _reparseComplete.Reset(); - _parser.BlockBackgroundIdleWork.Reset(); - _parser.NotifyForegroundIdleStart.Reset(); - } - - public void Dispose() - { - _parser.Dispose(); - } - } - - private class TestCompletionBroker : VisualStudioCompletionBroker - { - public override bool IsCompletionActive(ITextView textView) => false; - } - } -} \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserTest.cs deleted file mode 100644 index 8747324211..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultVisualStudioRazorParserTest.cs +++ /dev/null @@ -1,276 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Threading; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Test; -using Microsoft.VisualStudio.Text; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultVisualStudioRazorParserTest : ForegroundDispatcherTestBase - { - private static VisualStudioDocumentTracker CreateDocumentTracker(bool isSupportedProject = true) - { - var documentTracker = Mock.Of(tracker => - tracker.TextBuffer == new TestTextBuffer(new StringTextSnapshot(string.Empty)) && - tracker.ProjectPath == "SomeProject.csproj" && - tracker.FilePath == "SomeFilePath.cshtml" && - tracker.IsSupportedProject == isSupportedProject); - - return documentTracker; - } - - [ForegroundFact] - public void ReparseOnForeground_NoopsIfDisposed() - { - // Arrange - var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of()); - parser.Dispose(); - - // Act & Assert - parser.ReparseOnForeground(null); - } - - [ForegroundFact] - public void OnIdle_NoopsIfDisposed() - { - // Arrange - var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of()); - parser.Dispose(); - - // Act & Assert - parser.OnIdle(null); - } - - [ForegroundFact] - public void OnDocumentStructureChanged_NoopsIfDisposed() - { - // Arrange - var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of()); - parser.Dispose(); - - // Act & Assert - parser.OnDocumentStructureChanged(new object()); - } - - [ForegroundFact] - public void OnDocumentStructureChanged_IgnoresEditsThatAreOld() - { - // Arrange - using (var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of())) - { - var called = false; - parser.DocumentStructureChanged += (sender, e) => called = true; - parser._latestChangeReference = new DefaultVisualStudioRazorParser.ChangeReference(null, new StringTextSnapshot(string.Empty)); - var args = new DocumentStructureChangedEventArgs( - new SourceChange(0, 0, string.Empty), - new StringTextSnapshot(string.Empty), - TestRazorCodeDocument.CreateEmpty()); - - // Act - parser.OnDocumentStructureChanged(args); - - // Assert - Assert.False(called); - } - } - - [ForegroundFact] - public void OnDocumentStructureChanged_FiresForLatestTextBufferEdit() - { - // Arrange - var documentTracker = CreateDocumentTracker(); - using (var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - documentTracker, - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of())) - { - var called = false; - parser.DocumentStructureChanged += (sender, e) => called = true; - var latestChange = new SourceChange(0, 0, string.Empty); - var latestSnapshot = documentTracker.TextBuffer.CurrentSnapshot; - parser._latestChangeReference = new DefaultVisualStudioRazorParser.ChangeReference(latestChange, latestSnapshot); - var codeDocument = TestRazorCodeDocument.CreateEmpty(); - codeDocument.SetSyntaxTree(RazorSyntaxTree.Parse(TestRazorSourceDocument.Create())); - var args = new DocumentStructureChangedEventArgs( - latestChange, - latestSnapshot, - codeDocument); - - // Act - parser.OnDocumentStructureChanged(args); - - // Assert - Assert.True(called); - } - } - - [ForegroundFact] - public void StartIdleTimer_DoesNotRestartTimerWhenAlreadyRunning() - { - // Arrange - using (var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of()) - { - BlockBackgroundIdleWork = new ManualResetEventSlim(), - IdleDelay = TimeSpan.FromSeconds(5) - }) - { - parser.StartIdleTimer(); - using (var currentTimer = parser._idleTimer) - { - - // Act - parser.StartIdleTimer(); - var afterTimer = parser._idleTimer; - - // Assert - Assert.NotNull(currentTimer); - Assert.Same(currentTimer, afterTimer); - } - } - } - - [ForegroundFact] - public void StopIdleTimer_StopsTimer() - { - // Arrange - using (var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of()) - { - BlockBackgroundIdleWork = new ManualResetEventSlim(), - IdleDelay = TimeSpan.FromSeconds(5) - }) - { - parser.StartIdleTimer(); - var currentTimer = parser._idleTimer; - - // Act - parser.StopIdleTimer(); - - // Assert - Assert.NotNull(currentTimer); - Assert.Null(parser._idleTimer); - } - } - - [ForegroundFact] - public void StopParser_DetachesFromTextBufferChangeLoop() - { - // Arrange - var documentTracker = CreateDocumentTracker(); - var textBuffer = (TestTextBuffer)documentTracker.TextBuffer; - using (var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of())) - { - parser.StartParser(); - - // Act - parser.StopParser(); - - // Assert - Assert.Empty(textBuffer.AttachedChangedEvents); - Assert.Null(parser._parser); - } - } - - [ForegroundFact] - public void StartParser_AttachesToTextBufferChangeLoop() - { - // Arrange - var documentTracker = CreateDocumentTracker(); - var textBuffer = (TestTextBuffer)documentTracker.TextBuffer; - using (var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - documentTracker, - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of())) - { - // Act - parser.StartParser(); - - // Assert - Assert.Equal(1, textBuffer.AttachedChangedEvents.Count); - Assert.NotNull(parser._parser); - } - } - - [ForegroundFact] - public void TryReinitializeParser_ReturnsTrue_IfProjectIsSupported() - { - // Arrange - using (var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(isSupportedProject: true), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of())) - { - // Act - var result = parser.TryReinitializeParser(); - - // Assert - Assert.True(result); - } - } - - [ForegroundFact] - public void TryReinitializeParser_ReturnsFalse_IfProjectIsNotSupported() - { - // Arrange - using (var parser = new DefaultVisualStudioRazorParser( - Dispatcher, - CreateDocumentTracker(isSupportedProject: false), - Mock.Of(), - new DefaultErrorReporter(), - Mock.Of())) - { - // Act - var result = parser.TryReinitializeParser(); - - // Assert - Assert.False(result); - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultWorkspaceEditorSettingsTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultWorkspaceEditorSettingsTest.cs deleted file mode 100644 index 64365755bb..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/DefaultWorkspaceEditorSettingsTest.cs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.Editor; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class DefaultWorkspaceEditorSettingsTest : ForegroundDispatcherTestBase - { - [Fact] - public void InitialSettingsAreEditorSettingsManagerDefault() - { - // Arrange - var editorSettings = new EditorSettings(true, 123); - var editorSettingsManager = Mock.Of(m => m.Current == editorSettings); - - // Act - var manager = new DefaultWorkspaceEditorSettings(Dispatcher, editorSettingsManager); - - // Assert - Assert.Equal(editorSettings, manager.Current); - } - - [Fact] - public void OnChanged_TriggersChanged() - { - // Arrange - var manager = new DefaultWorkspaceEditorSettings(Dispatcher, Mock.Of()); - var called = false; - manager.Changed += (caller, args) => - { - called = true; - }; - - // Act - manager.OnChanged(null, null); - - // Assert - Assert.True(called); - } - - [Fact] - public void Attach_CalledOnceForMultipleListeners() - { - // Arrange - var manager = new TestEditorSettingsManagerInternal(Dispatcher); - - // Act - manager.Changed += (caller, args) => { }; - manager.Changed += (caller, args) => { }; - - // Assert - Assert.Equal(1, manager.AttachCount); - } - - [Fact] - public void Detach_CalledOnceWhenNoMoreListeners() - { - // Arrange - var manager = new TestEditorSettingsManagerInternal(Dispatcher); - EventHandler listener1 = (caller, args) => { }; - EventHandler listener2 = (caller, args) => { }; - manager.Changed += listener1; - manager.Changed += listener2; - - // Act - manager.Changed -= listener1; - manager.Changed -= listener2; - - // Assert - Assert.Equal(1, manager.DetachCount); - } - - private class TestEditorSettingsManagerInternal : DefaultWorkspaceEditorSettings - { - public TestEditorSettingsManagerInternal(ForegroundDispatcher foregroundDispatcher) : base(foregroundDispatcher, Mock.Of()) - { - } - - public int AttachCount { get; private set; } - - public int DetachCount { get; private set; } - - internal override void AttachToEditorSettingsManager() - { - AttachCount++; - } - - internal override void DetachFromEditorSettingsManager() - { - DetachCount++; - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestEdit.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestEdit.cs deleted file mode 100644 index 33dd99b7eb..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestEdit.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Test -{ - public class TestEdit - { - public TestEdit(SourceChange change, ITextSnapshot oldSnapshot, ITextSnapshot newSnapshot) - { - Change = change; - OldSnapshot = oldSnapshot; - NewSnapshot = newSnapshot; - } - - public TestEdit(int position, int oldLength, ITextSnapshot oldSnapshot, int newLength, ITextSnapshot newSnapshot, string newText) - { - Change = new SourceChange(position, oldLength, newText); - OldSnapshot = oldSnapshot; - NewSnapshot = newSnapshot; - } - - public SourceChange Change { get; } - - public ITextSnapshot OldSnapshot { get; } - - public ITextSnapshot NewSnapshot { get; } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestTextBuffer.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestTextBuffer.cs deleted file mode 100644 index cde8d8dc36..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestTextBuffer.cs +++ /dev/null @@ -1,171 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Utilities; - -namespace Microsoft.VisualStudio.Test -{ - public class TestTextBuffer : ITextBuffer - { - private ITextSnapshot _currentSnapshot; - private List> _attachedChangedEvents; - - public TestTextBuffer(ITextSnapshot initialSnapshot) - { - _currentSnapshot = initialSnapshot; - _attachedChangedEvents = new List>(); - - ReadOnlyRegionsChanged += (sender, args) => { }; - ChangedLowPriority += (sender, args) => { }; - ChangedHighPriority += (sender, args) => { }; - Changing += (sender, args) => { }; - PostChanged += (sender, args) => { }; - ContentTypeChanged += (sender, args) => { }; - Properties = new PropertyCollection(); - } - - public void ApplyEdit(TestEdit edit) - { - ApplyEdits(edit); - } - - public void ApplyEdits(params TestEdit[] edits) - { - var args = new TextContentChangedEventArgs(edits[0].OldSnapshot, edits[edits.Length - 1].NewSnapshot, new EditOptions(), null); - foreach (var edit in edits) - { - args.Changes.Add(new TestTextChange(edit.Change)); - } - - _currentSnapshot = edits[edits.Length - 1].NewSnapshot; - - foreach (var changedEvent in AttachedChangedEvents) - { - changedEvent.Invoke(this, args); - } - - PostChanged?.Invoke(null, null); - - ReadOnlyRegionsChanged?.Invoke(null, null); - ChangedLowPriority?.Invoke(null, null); - ChangedHighPriority?.Invoke(null, null); - Changing?.Invoke(null, null); - ContentTypeChanged?.Invoke(null, null); - } - - public IReadOnlyList> AttachedChangedEvents => _attachedChangedEvents; - - public ITextSnapshot CurrentSnapshot => _currentSnapshot; - - public PropertyCollection Properties { get; } - - public event EventHandler ReadOnlyRegionsChanged; - - public event EventHandler Changed - { - add - { - _attachedChangedEvents.Add(value); - } - remove - { - _attachedChangedEvents.Remove(value); - } - } - - - public event EventHandler ChangedLowPriority; - public event EventHandler ChangedHighPriority; - public event EventHandler Changing; - public event EventHandler PostChanged; - public event EventHandler ContentTypeChanged; - - public bool EditInProgress => throw new NotImplementedException(); - - public IContentType ContentType => throw new NotImplementedException(); - - public ITextEdit CreateEdit() => new BufferEdit(this); - - public void ChangeContentType(IContentType newContentType, object editTag) => throw new NotImplementedException(); - - public bool CheckEditAccess() => throw new NotImplementedException(); - - public ITextEdit CreateEdit(EditOptions options, int? reiteratedVersionNumber, object editTag) => throw new NotImplementedException(); - - public IReadOnlyRegionEdit CreateReadOnlyRegionEdit() => throw new NotImplementedException(); - - public ITextSnapshot Delete(Span deleteSpan) => throw new NotImplementedException(); - - public NormalizedSpanCollection GetReadOnlyExtents(Span span) => throw new NotImplementedException(); - - public ITextSnapshot Insert(int position, string text) => throw new NotImplementedException(); - - public bool IsReadOnly(int position) => throw new NotImplementedException(); - - public bool IsReadOnly(int position, bool isEdit) => throw new NotImplementedException(); - - public bool IsReadOnly(Span span) => throw new NotImplementedException(); - - public bool IsReadOnly(Span span, bool isEdit) => throw new NotImplementedException(); - - public ITextSnapshot Replace(Text.Span replaceSpan, string replaceWith) => throw new NotImplementedException(); - - public void TakeThreadOwnership() => throw new NotImplementedException(); - - private class BufferEdit : ITextEdit - { - private readonly TestTextBuffer _textBuffer; - private readonly List _edits; - - public BufferEdit(TestTextBuffer textBuffer) - { - _textBuffer = textBuffer; - _edits = new List(); - } - - public bool HasEffectiveChanges => throw new NotImplementedException(); - - public bool HasFailedChanges => throw new NotImplementedException(); - - public ITextSnapshot Snapshot => throw new NotImplementedException(); - - public bool Canceled => throw new NotImplementedException(); - - public ITextSnapshot Apply() - { - _textBuffer.ApplyEdits(_edits.ToArray()); - _edits.Clear(); - - return _textBuffer.CurrentSnapshot; - } - - public bool Insert(int position, string text) - { - var initialSnapshot = (StringTextSnapshot)_textBuffer.CurrentSnapshot; - var newText = initialSnapshot.Content.Insert(position, text); - var changedSnapshot = new StringTextSnapshot(newText); - var edit = new TestEdit(position, 0, initialSnapshot, text.Length, changedSnapshot, text); - _edits.Add(edit); - - return true; - } - - public void Cancel() => throw new NotImplementedException(); - - public bool Delete(Span deleteSpan) => throw new NotImplementedException(); - - public bool Delete(int startPosition, int charsToDelete) => throw new NotImplementedException(); - - public void Dispose() => throw new NotImplementedException(); - - public bool Insert(int position, char[] characterBuffer, int startIndex, int length) => throw new NotImplementedException(); - - public bool Replace(Span replaceSpan, string replaceWith) => throw new NotImplementedException(); - - public bool Replace(int startPosition, int charsToReplace, string replaceWith) => throw new NotImplementedException(); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestTextChange.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestTextChange.cs deleted file mode 100644 index 7b1167c2c5..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Infrastructure/TestTextChange.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Text; - -namespace Microsoft.VisualStudio.Test -{ - public class TestTextChange : ITextChange - { - public TestTextChange(TestEdit edit) : this(edit.Change) - { - } - - public TestTextChange(SourceChange change) - { - var changeSpan = change.Span; - - OldPosition = changeSpan.AbsoluteIndex; - NewPosition = OldPosition; - OldEnd = changeSpan.AbsoluteIndex + changeSpan.Length; - NewEnd = changeSpan.AbsoluteIndex + change.NewText.Length; - } - - public int OldPosition { get; } - - public int NewPosition { get; } - - public int OldEnd { get; } - - public int NewEnd { get; } - - public Span OldSpan => throw new NotImplementedException(); - - public Span NewSpan => throw new NotImplementedException(); - - public int Delta => throw new NotImplementedException(); - - public string OldText => throw new NotImplementedException(); - - public string NewText => throw new NotImplementedException(); - - public int OldLength => throw new NotImplementedException(); - - public int NewLength => throw new NotImplementedException(); - - public int LineCountDelta => throw new NotImplementedException(); - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Microsoft.VisualStudio.Editor.Razor.Test.csproj b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Microsoft.VisualStudio.Editor.Razor.Test.csproj deleted file mode 100644 index d7a967f2b8..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/Microsoft.VisualStudio.Editor.Razor.Test.csproj +++ /dev/null @@ -1,31 +0,0 @@ - - - - net461 - true - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs deleted file mode 100644 index 0b8ccafb91..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorDirectiveCompletionProviderTest.cs +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.ComponentModel.Composition; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Extensions; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Completion; -using Microsoft.CodeAnalysis.Options; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.Text; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class RazorDirectiveCompletionProviderTest - { - private static readonly IReadOnlyList DefaultDirectives = new[] - { - CSharpCodeParser.AddTagHelperDirectiveDescriptor, - CSharpCodeParser.RemoveTagHelperDirectiveDescriptor, - CSharpCodeParser.TagHelperPrefixDirectiveDescriptor, - }; - - [Fact] - public void AtDirectiveCompletionPoint_ReturnsFalseIfChangeHasNoOwner() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider); - var document = CreateDocument(); - codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - var completionContext = CreateContext(2, completionProvider, document); - - // Act - var result = completionProvider.AtDirectiveCompletionPoint(syntaxTree, completionContext); - - // Assert - Assert.False(result); - } - - [Fact] - public async Task GetDescriptionAsync_AddsDirectiveDescriptionIfPropertyExists() - { - // Arrange - var document = CreateDocument(); - var expectedDescription = "The expected description"; - var item = CompletionItem.Create("TestDirective") - .WithProperties((new Dictionary() - { - [RazorDirectiveCompletionProvider.DescriptionKey] = expectedDescription, - }).ToImmutableDictionary()); - var codeDocumentProvider = new Mock(); - var completionProvider = new RazorDirectiveCompletionProvider(new Lazy(() => codeDocumentProvider.Object)); - - // Act - var description = await completionProvider.GetDescriptionAsync(document, item, CancellationToken.None); - - // Assert - var part = Assert.Single(description.TaggedParts); - Assert.Equal(TextTags.Text, part.Tag); - Assert.Equal(expectedDescription, part.Text); - Assert.Equal(expectedDescription, description.Text); - } - - [Fact] - public async Task GetDescriptionAsync_DoesNotAddDescriptionWhenPropertyAbsent() - { - // Arrange - var document = CreateDocument(); - var item = CompletionItem.Create("TestDirective"); - var codeDocumentProvider = new Mock(); - var completionProvider = new RazorDirectiveCompletionProvider(new Lazy(() => codeDocumentProvider.Object)); - - // Act - var description = await completionProvider.GetDescriptionAsync(document, item, CancellationToken.None); - - // Assert - Assert.Empty(description.TaggedParts); - Assert.Equal(string.Empty, description.Text); - } - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsForNonRazorFiles() - { - // Arrange - var codeDocumentProvider = new Mock(MockBehavior.Strict); - var completionProvider = new FailOnGetCompletionsProvider(new Lazy(() => codeDocumentProvider.Object)); - var document = CreateDocument(); - document = document.WithFilePath("NotRazor.cs"); - var context = CreateContext(1, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsForDocumentWithoutPath() - { - // Arrange - Document document = null; - TestWorkspace.Create(workspace => - { - var project = ProjectInfo - .Create(ProjectId.CreateNewId(), VersionStamp.Default, "TestProject", "TestAssembly", LanguageNames.CSharp) - .WithFilePath("/TestProject.csproj"); - workspace.AddProject(project); - var documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "Test.cshtml"); - document = workspace.AddDocument(documentInfo); - }); - - var codeDocumentProvider = new Mock(MockBehavior.Strict); - var completionProvider = new FailOnGetCompletionsProvider(new Lazy(() => codeDocumentProvider.Object)); - var context = CreateContext(1, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsWhenDocumentProviderCanNotGetDocument() - { - // Arrange - RazorCodeDocument codeDocument; - var codeDocumentProvider = new Mock(); - codeDocumentProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out codeDocument)) - .Returns(false); - var completionProvider = new FailOnGetCompletionsProvider(new Lazy(() => codeDocumentProvider.Object)); - var document = CreateDocument(); - var context = CreateContext(1, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsCanNotFindSnapshotPoint() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider, false); - var document = CreateDocument(); - var context = CreateContext(0, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsWhenNotAtCompletionPoint() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider); - var document = CreateDocument(); - var context = CreateContext(0, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Theory] - [InlineData("DateTime.Now")] - [InlineData("SomeMethod()")] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsWhenAtComplexExpressions(string content) - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@" + content, Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider); - var document = CreateDocument(); - var context = CreateContext(1, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsForExplicitExpressions() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@()", Enumerable.Empty()); - var completionProvider = new FailOnGetCompletionsProvider(codeDocumentProvider); - var document = CreateDocument(); - var context = CreateContext(2, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public async Task ProvideCompletionAsync_DoesNotProvideCompletionsForCodeDocumentWithoutSyntaxTree() - { - // Arrange - var codeDocumentProvider = new Mock(); - var codeDocument = TestRazorCodeDocument.CreateEmpty(); - codeDocumentProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out codeDocument)) - .Returns(true); - var completionProvider = new FailOnGetCompletionsProvider(new Lazy(() => codeDocumentProvider.Object)); - var document = CreateDocument(); - var context = CreateContext(2, completionProvider, document); - - // Act & Assert - await completionProvider.ProvideCompletionsAsync(context); - } - - [Fact] - public void GetCompletionItems_ProvidesCompletionsForDefaultDirectives() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", Enumerable.Empty()); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider); - var document = CreateDocument(); - codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - - // Act - var completionItems = completionProvider.GetCompletionItems(syntaxTree); - - // Assert - Assert.Collection( - completionItems, - item => AssertRazorCompletionItem(DefaultDirectives[0].Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[1].Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[2].Description, item)); - } - - [Fact] - public void GetCompletionItems_ProvidesCompletionsForDefaultAndExtensibleDirectives() - { - // Arrange - var codeDocumentProvider = CreateCodeDocumentProvider("@", new[] { SectionDirective.Directive }); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider); - var document = CreateDocument(); - codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - - // Act - var completionItems = completionProvider.GetCompletionItems(syntaxTree); - - // Assert - Assert.Collection( - completionItems, - item => AssertRazorCompletionItem(SectionDirective.Directive.Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[0].Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[1].Description, item), - item => AssertRazorCompletionItem(DefaultDirectives[2].Description, item)); - } - - [Fact] - public void GetCompletionItems_ProvidesCompletionsForDirectivesWithoutDescription() - { - // Arrange - var customDirective = DirectiveDescriptor.CreateSingleLineDirective("custom"); - var codeDocumentProvider = CreateCodeDocumentProvider("@", new[] { customDirective }); - var completionProvider = new RazorDirectiveCompletionProvider(codeDocumentProvider); - var document = CreateDocument(); - codeDocumentProvider.Value.TryGetFromDocument(document, out var codeDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - - // Act - var completionItems = completionProvider.GetCompletionItems(syntaxTree); - - // Assert - var customDirectiveCompletion = Assert.Single(completionItems, item => item.DisplayText == customDirective.Directive); - AssertRazorCompletionItemDefaults(customDirectiveCompletion); - Assert.DoesNotContain(customDirectiveCompletion.Properties, property => property.Key == RazorDirectiveCompletionProvider.DescriptionKey); - } - - private static void AssertRazorCompletionItem(string expectedDescription, CompletionItem item) - { - Assert.True(item.Properties.TryGetValue(RazorDirectiveCompletionProvider.DescriptionKey, out var actualDescription)); - Assert.Equal(expectedDescription, actualDescription); - - AssertRazorCompletionItemDefaults(item); - } - - private static void AssertRazorCompletionItemDefaults(CompletionItem item) - { - Assert.Equal("_RazorDirective_", item.SortText); - Assert.False(item.Rules.FormatOnCommit); - var tag = Assert.Single(item.Tags); - Assert.Equal(CompletionTags.Intrinsic, tag); - } - - private static Lazy CreateCodeDocumentProvider(string text, IEnumerable directives) - { - var codeDocumentProvider = new Mock(); - var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var sourceDocument = TestRazorSourceDocument.Create(text); - var options = RazorParserOptions.Create(builder => - { - foreach (var directive in directives) - { - builder.Directives.Add(directive); - } - }); - var syntaxTree = RazorSyntaxTree.Parse(sourceDocument, options); - codeDocument.SetSyntaxTree(syntaxTree); - codeDocumentProvider.Setup(provider => provider.TryGetFromDocument(It.IsAny(), out codeDocument)) - .Returns(true); - - return new Lazy(() => codeDocumentProvider.Object); - } - - private static CompletionContext CreateContext(int position, RazorDirectiveCompletionProvider completionProvider, Document document) - { - var context = new CompletionContext( - completionProvider, - document, - position, - TextSpan.FromBounds(position, position), - CompletionTrigger.Invoke, - new Mock().Object, - CancellationToken.None); - - return context; - } - - private static Document CreateDocument() - { - Document document = null; - TestWorkspace.Create(workspace => - { - var project = ProjectInfo - .Create(ProjectId.CreateNewId(), VersionStamp.Default, "TestProject", "TestAssembly", LanguageNames.CSharp) - .WithFilePath("/TestProject.csproj"); - workspace.AddProject(project); - var documentInfo = DocumentInfo.Create(DocumentId.CreateNewId(project.Id), "Test.cshtml"); - document = workspace.AddDocument(documentInfo); - document = document.WithFilePath("Test.cshtml"); - }); - - return document; - } - - private class FailOnGetCompletionsProvider : RazorDirectiveCompletionProvider - { - private readonly bool _canGetSnapshotPoint; - - public FailOnGetCompletionsProvider(Lazy codeDocumentProvider, bool canGetSnapshotPoint = true) - : base(codeDocumentProvider) - { - _canGetSnapshotPoint = canGetSnapshotPoint; - } - - internal override IEnumerable GetCompletionItems(RazorSyntaxTree syntaxTree) - { - Assert.False(true, "Completions should not have been attempted."); - return null; - } - - protected override bool TryGetRazorSnapshotPoint(CompletionContext context, out SnapshotPoint snapshotPoint) - { - if (!_canGetSnapshotPoint) - { - snapshotPoint = default(SnapshotPoint); - return false; - } - - var snapshot = new Mock(MockBehavior.Strict); - snapshot.Setup(s => s.Length) - .Returns(context.CompletionListSpan.End); - snapshotPoint = new SnapshotPoint(snapshot.Object, context.CompletionListSpan.Start); - return true; - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorSyntaxFactsServiceExtensionsTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorSyntaxFactsServiceExtensionsTest.cs deleted file mode 100644 index 9d8e28b49f..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorSyntaxFactsServiceExtensionsTest.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class RazorSyntaxFactsServiceExtensionsTest - { - [Fact] - public void IsTagHelperSpan_ReturnsTrue() - { - // Arrange - var syntaxTree = GetSyntaxTree( -@"
- -
"); - var location = new SourceSpan(9 + Environment.NewLine.Length, 13); - var service = new DefaultRazorSyntaxFactsService(); - - // Act - var result = service.IsTagHelperSpan(syntaxTree, location); - - // Assert - Assert.True(result); - } - - [Fact] - public void IsTagHelperSpan_ReturnsFalse() - { - // Arrange - var syntaxTree = GetSyntaxTree( -@"
- -
"); - var location = new SourceSpan(0, 4); - var service = new DefaultRazorSyntaxFactsService(); - - // Act - var result = service.IsTagHelperSpan(syntaxTree, location); - - // Assert - Assert.False(result); - } - - [Fact] - public void IsTagHelperSpan_NullSyntaxTree_ReturnsFalse() - { - // Arrange - var location = new SourceSpan(0, 4); - var service = new DefaultRazorSyntaxFactsService(); - - // Act - var result = service.IsTagHelperSpan(null, location); - - // Assert - Assert.False(result); - } - - private static RazorSyntaxTree GetSyntaxTree(string source) - { - var taghelper = TagHelperDescriptorBuilder.Create("TestTagHelper", "TestAssembly") - .TagMatchingRuleDescriptor(rule => rule.RequireTagName("taghelper")) - .TypeName("TestTagHelper") - .Build(); - var projectEngine = RazorProjectEngine.Create(builder => - { - builder.AddTagHelpers(taghelper); - builder.Features.Add(new DesignTimeOptionsFeature(designTime: true)); - }); - - var sourceDocument = RazorSourceDocument.Create(source, "test.cshtml"); - var addTagHelperImport = RazorSourceDocument.Create("@addTagHelper *, TestAssembly", "import.cshtml"); - var codeDocument = RazorCodeDocument.Create(sourceDocument, new[] { addTagHelperImport }); - - projectEngine.Engine.Process(codeDocument); - - return codeDocument.GetSyntaxTree(); - } - - private class DesignTimeOptionsFeature : IConfigureRazorParserOptionsFeature, IConfigureRazorCodeGenerationOptionsFeature - { - private bool _designTime; - - public DesignTimeOptionsFeature(bool designTime) - { - _designTime = designTime; - } - - public int Order { get; } - - public RazorEngine Engine { get; set; } - - public void Configure(RazorParserOptionsBuilder options) - { - options.SetDesignTime(_designTime); - } - - public void Configure(RazorCodeGenerationOptionsBuilder options) - { - options.SetDesignTime(_designTime); - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorSyntaxTreePartialParserTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorSyntaxTreePartialParserTest.cs deleted file mode 100644 index 8b5ee4ef5a..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorSyntaxTreePartialParserTest.cs +++ /dev/null @@ -1,603 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Mvc.Razor.Extensions; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.VisualStudio.Test; -using Microsoft.VisualStudio.Text; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class RazorSyntaxTreePartialParserTest - { - public static TheoryData TagHelperPartialParseRejectData - { - get - { - return new TheoryData - { - CreateInsertionChange("

", 2, " "), - CreateInsertionChange("

", 6, " "), - CreateInsertionChange("

", 12, " "), - CreateInsertionChange("

", 12, "ibute"), - CreateInsertionChange("

", 2, " before"), - }; - } - } - - [Theory] - [MemberData(nameof(TagHelperPartialParseRejectData))] - public void TagHelperTagBodiesRejectPartialChanges(object objectEdit) - { - // Arrange - var edit = (TestEdit)objectEdit; - var builder = TagHelperDescriptorBuilder.Create("PTagHelper", "TestAssembly"); - builder.SetTypeName("PTagHelper"); - builder.TagMatchingRule(rule => rule.TagName = "p"); - var descriptors = new[] - { - builder.Build() - }; - var projectEngine = CreateProjectEngine(tagHelpers: descriptors); - var projectItem = new TestRazorProjectItem("Index.cshtml") - { - Content = edit.OldSnapshot.GetText() - }; - var codeDocument = projectEngine.Process(projectItem); - var syntaxTree = codeDocument.GetSyntaxTree(); - var parser = new RazorSyntaxTreePartialParser(syntaxTree); - - // Act - var result = parser.Parse(edit.Change); - - // Assert - Assert.Equal(PartialParseResultInternal.Rejected, result); - } - - public static TheoryData TagHelperAttributeAcceptData - { - get - { - var factory = new SpanFactory(); - - // change, (Block)expectedDocument, partialParseResult - return new TheoryData - { - { - CreateInsertionChange("

", 22, "."), - PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional - }, - { - CreateInsertionChange("

", 21, "."), - PartialParseResultInternal.Accepted - }, - { - CreateInsertionChange("

", 25, "."), - PartialParseResultInternal.Accepted - }, - { - CreateInsertionChange("

", 34, "."), - PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional - }, - { - CreateInsertionChange("

", 29, "."), - PartialParseResultInternal.Accepted | PartialParseResultInternal.Provisional - }, - }; - } - } - - [Theory] - [MemberData(nameof(TagHelperAttributeAcceptData))] - public void TagHelperAttributesAreLocatedAndAcceptChangesCorrectly(object editObject, object partialParseResultObject) - { - // Arrange - var edit = (TestEdit)editObject; - var partialParseResult = (PartialParseResultInternal)partialParseResultObject; - var builder = TagHelperDescriptorBuilder.Create("PTagHelper", "Test"); - builder.SetTypeName("PTagHelper"); - builder.TagMatchingRule(rule => rule.TagName = "p"); - builder.BindAttribute(attribute => - { - attribute.Name = "obj-attr"; - attribute.TypeName = typeof(object).FullName; - attribute.SetPropertyName("ObjectAttribute"); - }); - builder.BindAttribute(attribute => - { - attribute.Name = "str-attr"; - attribute.TypeName = typeof(string).FullName; - attribute.SetPropertyName("StringAttribute"); - }); - var descriptors = new[] { builder.Build() }; - var projectEngine = CreateProjectEngine(tagHelpers: descriptors); - var sourceDocument = new TestRazorProjectItem("Index.cshtml") - { - Content = edit.OldSnapshot.GetText() - }; - var codeDocument = projectEngine.Process(sourceDocument); - var syntaxTree = codeDocument.GetSyntaxTree(); - var parser = new RazorSyntaxTreePartialParser(syntaxTree); - - // Act - var result = parser.Parse(edit.Change); - - // Assert - Assert.Equal(partialParseResult, result); - } - - [Fact] - public void ImplicitExpressionAcceptsInnerInsertionsInStatementBlock() - { - // Arrange - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateTime..Now" + Environment.NewLine - + "}"); - var old = new StringTextSnapshot("@{" + Environment.NewLine - + " @DateTime.Now" + Environment.NewLine - + "}"); - - // Act and Assert - RunPartialParseTest(new TestEdit(17, 0, old, 1, changed, "."), - new MarkupBlock( - factory.EmptyHtml(), - new StatementBlock( - factory.CodeTransition(), - factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None), - factory.Code(Environment.NewLine + " ") - .AsStatement() - .AutoCompleteWith(autoCompleteString: null), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime..Now") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Code(Environment.NewLine).AsStatement(), - factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)), - factory.EmptyHtml())); - } - - [Fact] - public void ImplicitExpressionAcceptsInnerInsertions() - { - // Arrange - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @DateTime..Now baz"); - var old = new StringTextSnapshot("foo @DateTime.Now baz"); - - // Act and Assert - RunPartialParseTest(new TestEdit(13, 0, old, 1, changed, "."), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime..Now").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz")), additionalFlags: PartialParseResultInternal.Provisional); - } - - [Fact] - public void ImplicitExpressionAcceptsWholeIdentifierReplacement() - { - // Arrange - var factory = new SpanFactory(); - var old = new StringTextSnapshot("foo @date baz"); - var changed = new StringTextSnapshot("foo @DateTime baz"); - - // Act and Assert - RunPartialParseTest(new TestEdit(5, 4, old, 8, changed, "DateTime"), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ImplicitExpressionRejectsWholeIdentifierReplacementToKeyword() - { - // Arrange - var old = new StringTextSnapshot("foo @date baz"); - var changed = new StringTextSnapshot("foo @if baz"); - var edit = new TestEdit(5, 4, old, 2, changed, "if"); - - // Act & Assert - RunPartialParseRejectionTest(edit); - } - - [Fact] - public void ImplicitExpressionRejectsWholeIdentifierReplacementToDirective() - { - // Arrange - var old = new StringTextSnapshot("foo @date baz"); - var changed = new StringTextSnapshot("foo @inherits baz"); - var edit = new TestEdit(5, 4, old, 8, changed, "inherits"); - - // Act & Assert - RunPartialParseRejectionTest(edit, PartialParseResultInternal.SpanContextChanged); - } - - [Fact] - public void ImplicitExpressionAcceptsPrefixIdentifierReplacements_SingleSymbol() - { - // Arrange - var factory = new SpanFactory(); - var old = new StringTextSnapshot("foo @dTime baz"); - var changed = new StringTextSnapshot("foo @DateTime baz"); - - // Act and Assert - RunPartialParseTest(new TestEdit(5, 1, old, 4, changed, "Date"), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ImplicitExpressionAcceptsPrefixIdentifierReplacements_MultipleSymbols() - { - // Arrange - var factory = new SpanFactory(); - var old = new StringTextSnapshot("foo @dTime.Now baz"); - var changed = new StringTextSnapshot("foo @DateTime.Now baz"); - - // Act and Assert - RunPartialParseTest(new TestEdit(5, 1, old, 4, changed, "Date"), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime.Now").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ImplicitExpressionAcceptsSuffixIdentifierReplacements_SingleSymbol() - { - // Arrange - var factory = new SpanFactory(); - var old = new StringTextSnapshot("foo @Datet baz"); - var changed = new StringTextSnapshot("foo @DateTime baz"); - - // Act and Assert - RunPartialParseTest(new TestEdit(9, 1, old, 4, changed, "Time"), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ImplicitExpressionAcceptsSuffixIdentifierReplacements_MultipleSymbols() - { - // Arrange - var factory = new SpanFactory(); - var old = new StringTextSnapshot("foo @DateTime.n baz"); - var changed = new StringTextSnapshot("foo @DateTime.Now baz"); - - // Act and Assert - RunPartialParseTest(new TestEdit(14, 1, old, 3, changed, "Now"), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime.Now").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ImplicitExpressionAcceptsSurroundedIdentifierReplacements() - { - // Arrange - var factory = new SpanFactory(); - var old = new StringTextSnapshot("foo @DateTime.n.ToString() baz"); - var changed = new StringTextSnapshot("foo @DateTime.Now.ToString() baz"); - - // Act and Assert - RunPartialParseTest(new TestEdit(14, 1, old, 3, changed, "Now"), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("DateTime.Now.ToString()").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ImplicitExpressionProvisionallyAcceptsDeleteOfIdentifierPartsIfDotRemains() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @User. baz"); - var old = new StringTextSnapshot("foo @User.Name baz"); - RunPartialParseTest(new TestEdit(10, 4, old, 0, changed, string.Empty), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("User.").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz")), - additionalFlags: PartialParseResultInternal.Provisional); - } - - [Fact] - public void ImplicitExpressionAcceptsDeleteOfIdentifierPartsIfSomeOfIdentifierRemains() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @Us baz"); - var old = new StringTextSnapshot("foo @User baz"); - RunPartialParseTest(new TestEdit(7, 2, old, 0, changed, string.Empty), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("Us").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ImplicitExpressionProvisionallyAcceptsMultipleInsertionIfItCausesIdentifierExpansionAndTrailingDot() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @User. baz"); - var old = new StringTextSnapshot("foo @U baz"); - RunPartialParseTest(new TestEdit(6, 0, old, 4, changed, "ser."), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("User.").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz")), - additionalFlags: PartialParseResultInternal.Provisional); - } - - [Fact] - public void ImplicitExpressionAcceptsMultipleInsertionIfItOnlyCausesIdentifierExpansion() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @barbiz baz"); - var old = new StringTextSnapshot("foo @bar baz"); - RunPartialParseTest(new TestEdit(8, 0, old, 3, changed, "biz"), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("barbiz").AsImplicitExpression(CSharpCodeParser.DefaultKeywords).Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" baz"))); - } - - [Fact] - public void ImplicitExpressionAcceptsIdentifierExpansionAtEndOfNonWhitespaceCharacters() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @food" + Environment.NewLine - + "}"); - var old = new StringTextSnapshot("@{" + Environment.NewLine - + " @foo" + Environment.NewLine - + "}"); - RunPartialParseTest(new TestEdit(10 + Environment.NewLine.Length, 0, old, 1, changed, "d"), - new MarkupBlock( - factory.EmptyHtml(), - new StatementBlock( - factory.CodeTransition(), - factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None), - factory.Code(Environment.NewLine + " ") - .AsStatement() - .AutoCompleteWith(autoCompleteString: null), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("food") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Code(Environment.NewLine).AsStatement(), - factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)), - factory.EmptyHtml())); - } - - [Fact] - public void ImplicitExpressionAcceptsIdentifierAfterDotAtEndOfNonWhitespaceCharacters() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @foo.d" + Environment.NewLine - + "}"); - var old = new StringTextSnapshot("@{" + Environment.NewLine - + " @foo." + Environment.NewLine - + "}"); - RunPartialParseTest(new TestEdit(11 + Environment.NewLine.Length, 0, old, 1, changed, "d"), - new MarkupBlock( - factory.EmptyHtml(), - new StatementBlock( - factory.CodeTransition(), - factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None), - factory.Code(Environment.NewLine + " ") - .AsStatement() - .AutoCompleteWith(autoCompleteString: null), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("foo.d") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Code(Environment.NewLine).AsStatement(), - factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)), - factory.EmptyHtml())); - } - - [Fact] - public void ImplicitExpressionAcceptsDotAtEndOfNonWhitespaceCharacters() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("@{" + Environment.NewLine - + " @foo." + Environment.NewLine - + "}"); - var old = new StringTextSnapshot("@{" + Environment.NewLine - + " @foo" + Environment.NewLine - + "}"); - RunPartialParseTest(new TestEdit(10 + Environment.NewLine.Length, 0, old, 1, changed, "."), - new MarkupBlock( - factory.EmptyHtml(), - new StatementBlock( - factory.CodeTransition(), - factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None), - factory.Code(Environment.NewLine + " ") - .AsStatement() - .AutoCompleteWith(autoCompleteString: null), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code(@"foo.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Code(Environment.NewLine).AsStatement(), - factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)), - factory.EmptyHtml())); - } - - [Fact] - public void ImplicitExpressionProvisionallyAcceptsDotAfterIdentifierInMarkup() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @foo. bar"); - var old = new StringTextSnapshot("foo @foo bar"); - RunPartialParseTest(new TestEdit(8, 0, old, 1, changed, "."), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("foo.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" bar")), - additionalFlags: PartialParseResultInternal.Provisional); - } - - [Fact] - public void ImplicitExpressionAcceptsAdditionalIdentifierCharactersIfEndOfSpanIsIdentifier() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("foo @foob bar"); - var old = new StringTextSnapshot("foo @foo bar"); - RunPartialParseTest(new TestEdit(8, 0, old, 1, changed, "b"), - new MarkupBlock( - factory.Markup("foo "), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("foob") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.Markup(" bar"))); - } - - [Fact] - public void ImplicitExpressionAcceptsAdditionalIdentifierStartCharactersIfEndOfSpanIsDot() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("@{@foo.b}"); - var old = new StringTextSnapshot("@{@foo.}"); - RunPartialParseTest(new TestEdit(7, 0, old, 1, changed, "b"), - new MarkupBlock( - factory.EmptyHtml(), - new StatementBlock( - factory.CodeTransition(), - factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None), - factory.EmptyCSharp() - .AsStatement() - .AutoCompleteWith(autoCompleteString: null), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("foo.b") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.EmptyCSharp().AsStatement(), - factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)), - factory.EmptyHtml())); - } - - [Fact] - public void ImplicitExpressionAcceptsDotIfTrailingDotsAreAllowed() - { - var factory = new SpanFactory(); - var changed = new StringTextSnapshot("@{@foo.}"); - var old = new StringTextSnapshot("@{@foo}"); - RunPartialParseTest(new TestEdit(6, 0, old, 1, changed, "."), - new MarkupBlock( - factory.EmptyHtml(), - new StatementBlock( - factory.CodeTransition(), - factory.MetaCode("{").Accepts(AcceptedCharactersInternal.None), - factory.EmptyCSharp() - .AsStatement() - .AutoCompleteWith(autoCompleteString: null), - new ExpressionBlock( - factory.CodeTransition(), - factory.Code("foo.") - .AsImplicitExpression(CSharpCodeParser.DefaultKeywords, acceptTrailingDot: true) - .Accepts(AcceptedCharactersInternal.NonWhiteSpace)), - factory.EmptyCSharp().AsStatement(), - factory.MetaCode("}").Accepts(AcceptedCharactersInternal.None)), - factory.EmptyHtml())); - } - - private void RunPartialParseRejectionTest(TestEdit edit, PartialParseResultInternal additionalFlags = 0) - { - var templateEngine = CreateProjectEngine(); - var document = TestRazorCodeDocument.Create(edit.OldSnapshot.GetText()); - templateEngine.Engine.Process(document); - var syntaxTree = document.GetSyntaxTree(); - var parser = new RazorSyntaxTreePartialParser(syntaxTree); - - var result = parser.Parse(edit.Change); - Assert.Equal(PartialParseResultInternal.Rejected | additionalFlags, result); - } - - private static void RunPartialParseTest(TestEdit edit, Block expectedTree, PartialParseResultInternal additionalFlags = 0) - { - var templateEngine = CreateProjectEngine(); - var document = TestRazorCodeDocument.Create(edit.OldSnapshot.GetText()); - templateEngine.Engine.Process(document); - var syntaxTree = document.GetSyntaxTree(); - var parser = new RazorSyntaxTreePartialParser(syntaxTree); - - var result = parser.Parse(edit.Change); - Assert.Equal(PartialParseResultInternal.Accepted | additionalFlags, result); - ParserTestBase.EvaluateParseTree(parser.SyntaxTreeRoot, expectedTree); - } - - private static TestEdit CreateInsertionChange(string initialText, int insertionLocation, string insertionText) - { - var changedText = initialText.Insert(insertionLocation, insertionText); - var sourceChange = new SourceChange(insertionLocation, 0, insertionText); - var oldSnapshot = new StringTextSnapshot(initialText); - var changedSnapshot = new StringTextSnapshot(changedText); - return new TestEdit(sourceChange, oldSnapshot, changedSnapshot); - } - - private static RazorProjectEngine CreateProjectEngine( - string path = "C:\\This\\Path\\Is\\Just\\For\\Line\\Pragmas.cshtml", - IEnumerable tagHelpers = null) - { - var fileSystem = new TestRazorProjectFileSystem(); - var projectEngine = RazorProjectEngine.Create(RazorConfiguration.Default, fileSystem, builder => - { - RazorExtensions.Register(builder); - - builder.AddDefaultImports("@addTagHelper *, Test"); - - if (tagHelpers != null) - { - builder.AddTagHelpers(tagHelpers); - } - }); - - return projectEngine; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorTextViewConnectionListenerTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorTextViewConnectionListenerTest.cs deleted file mode 100644 index d032aad935..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/RazorTextViewConnectionListenerTest.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.ObjectModel; -using Microsoft.CodeAnalysis; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Editor.Razor -{ - public class RazorTextViewConnectionListenerTest : ForegroundDispatcherTestBase - { - [ForegroundFact] - public void SubjectBuffersConnected_CallsRazorDocumentManager_OnTextViewOpened() - { - // Arrange - var textView = Mock.Of(); - var buffers = new Collection(); - var documentManager = new Mock(MockBehavior.Strict); - documentManager.Setup(d => d.OnTextViewOpened(textView, buffers)).Verifiable(); - - var listener = new RazorTextViewConnectionListener(Dispatcher, documentManager.Object); - - // Act - listener.SubjectBuffersConnected(textView, ConnectionReason.BufferGraphChange, buffers); - - // Assert - documentManager.Verify(); - } - - [ForegroundFact] - public void SubjectBuffersDisonnected_CallsRazorDocumentManager_OnTextViewClosed() - { - // Arrange - var textView = Mock.Of(); - var buffers = new Collection(); - var documentManager = new Mock(MockBehavior.Strict); - documentManager.Setup(d => d.OnTextViewClosed(textView, buffers)).Verifiable(); - - var listener = new RazorTextViewConnectionListener(Dispatcher, documentManager.Object); - - // Act - listener.SubjectBuffersDisconnected(textView, ConnectionReason.BufferGraphChange, buffers); - - // Assert - documentManager.Verify(); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/TextContentChangedEventArgsExtensionsTest.cs b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/TextContentChangedEventArgsExtensionsTest.cs deleted file mode 100644 index 4882a49a13..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/TextContentChangedEventArgsExtensionsTest.cs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.Test; -using Xunit; - -namespace Microsoft.VisualStudio.Text -{ - public class TextContentChangedEventArgsExtensionsTest - { - [Fact] - public void TextChangeOccurred_NoChanges_ReturnsFalse() - { - // Arrange - var before = new StringTextSnapshot(string.Empty); - var after = new StringTextSnapshot(string.Empty); - var testArgs = new TestTextContentChangedEventArgs(before, after); - - // Act - var result = testArgs.TextChangeOccurred(out var changeInformation); - - // Assert - Assert.False(result); - } - - [Fact] - public void TextChangeOccurred_CancelingChanges_ReturnsFalse() - { - // Arrange - var before = new StringTextSnapshot("by"); - before.Version.Changes.Add(new TestTextChange(new SourceChange(0, 2, "hi"))); - before.Version.Changes.Add(new TestTextChange(new SourceChange(0, 2, "by"))); - var after = new StringTextSnapshot("by"); - var testArgs = new TestTextContentChangedEventArgs(before, after); - - // Act - var result = testArgs.TextChangeOccurred(out var changeInformation); - - // Assert - Assert.False(result); - } - - [Fact] - public void TextChangeOccurred_SingleChange_ReturnsTrue() - { - // Arrange - var before = new StringTextSnapshot("by"); - var firstChange = new TestTextChange(new SourceChange(0, 2, "hi")); - before.Version.Changes.Add(firstChange); - var after = new StringTextSnapshot("hi"); - var testArgs = new TestTextContentChangedEventArgs(before, after); - - // Act - var result = testArgs.TextChangeOccurred(out var changeInformation); - - // Assert - Assert.True(result); - Assert.Same(firstChange, changeInformation.firstChange); - Assert.Equal(firstChange, changeInformation.lastChange); - Assert.Equal("hi", changeInformation.newText); - Assert.Equal("by", changeInformation.oldText); - } - - [Fact] - public void TextChangeOccurred_MultipleChanges_ReturnsTrue() - { - // Arrange - var before = new StringTextSnapshot("by by"); - var firstChange = new TestTextChange(new SourceChange(0, 2, "hi")); - before.Version.Changes.Add(firstChange); - var lastChange = new TestTextChange(new SourceChange(3, 2, "hi")); - before.Version.Changes.Add(lastChange); - var after = new StringTextSnapshot("hi hi"); - var testArgs = new TestTextContentChangedEventArgs(before, after); - - // Act - var result = testArgs.TextChangeOccurred(out var changeInformation); - - // Assert - Assert.True(result); - Assert.Same(firstChange, changeInformation.firstChange); - Assert.Equal(lastChange, changeInformation.lastChange); - Assert.Equal("hi hi", changeInformation.newText); - Assert.Equal("by by", changeInformation.oldText); - } - - private class TestTextContentChangedEventArgs : TextContentChangedEventArgs - { - public TestTextContentChangedEventArgs(ITextSnapshot before, ITextSnapshot after) - : base(before, after, EditOptions.DefaultMinimalChange, null) - { - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/xunit.runner.json b/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/xunit.runner.json deleted file mode 100644 index fcf172c8fc..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Editor.Razor.Test/xunit.runner.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "methodDisplay": "method", - "shadowCopy": false -} \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/DefaultFileChangeTrackerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/DefaultFileChangeTrackerTest.cs deleted file mode 100644 index bb7d32669d..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/DefaultFileChangeTrackerTest.cs +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Shell.Interop; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - public class DefaultFileChangeTrackerTest : ForegroundDispatcherTestBase - { - private ErrorReporter ErrorReporter { get; } = new DefaultErrorReporter(); - - [ForegroundFact] - public void StartListening_AdvisesForFileChange() - { - // Arrange - uint cookie; - var fileChangeService = new Mock(); - fileChangeService - .Setup(f => f.AdviseFileChange(It.IsAny(), It.IsAny(), It.IsAny(), out cookie)) - .Returns(VSConstants.S_OK) - .Verifiable(); - var tracker = new DefaultFileChangeTracker("C:/_ViewImports.cshtml", Dispatcher, ErrorReporter, fileChangeService.Object); - - // Act - tracker.StartListening(); - - // Assert - fileChangeService.Verify(); - } - - [ForegroundFact] - public void StartListening_AlreadyListening_DoesNothing() - { - // Arrange - uint cookie = 100; - var callCount = 0; - var fileChangeService = new Mock(); - fileChangeService - .Setup(f => f.AdviseFileChange(It.IsAny(), It.IsAny(), It.IsAny(), out cookie)) - .Returns(VSConstants.S_OK) - .Callback(() => callCount++); - var tracker = new DefaultFileChangeTracker("C:/_ViewImports.cshtml", Dispatcher, ErrorReporter, fileChangeService.Object); - tracker.StartListening(); - - // Act - tracker.StartListening(); - - // Assert - Assert.Equal(1, callCount); - } - - [ForegroundFact] - public void StopListening_UnadvisesForFileChange() - { - // Arrange - uint cookie = 100; - var fileChangeService = new Mock(MockBehavior.Strict); - fileChangeService - .Setup(f => f.AdviseFileChange(It.IsAny(), It.IsAny(), It.IsAny(), out cookie)) - .Returns(VSConstants.S_OK) - .Verifiable(); - fileChangeService - .Setup(f => f.UnadviseFileChange(cookie)) - .Returns(VSConstants.S_OK) - .Verifiable(); - var tracker = new DefaultFileChangeTracker("C:/_ViewImports.cshtml", Dispatcher, ErrorReporter, fileChangeService.Object); - tracker.StartListening(); // Start listening for changes. - - // Act - tracker.StopListening(); - - // Assert - fileChangeService.Verify(); - } - - [ForegroundFact] - public void StopListening_NotListening_DoesNothing() - { - // Arrange - uint cookie = VSConstants.VSCOOKIE_NIL; - var fileChangeService = new Mock(MockBehavior.Strict); - fileChangeService - .Setup(f => f.UnadviseFileChange(cookie)) - .Throws(new InvalidOperationException()); - var tracker = new DefaultFileChangeTracker("C:/_ViewImports.cshtml", Dispatcher, ErrorReporter, fileChangeService.Object); - - // Act & Assert - tracker.StopListening(); - } - - [ForegroundTheory] - [InlineData((uint)_VSFILECHANGEFLAGS.VSFILECHG_Size, (int)FileChangeKind.Changed)] - [InlineData((uint)_VSFILECHANGEFLAGS.VSFILECHG_Time, (int)FileChangeKind.Changed)] - [InlineData((uint)_VSFILECHANGEFLAGS.VSFILECHG_Add, (int)FileChangeKind.Added)] - [InlineData((uint)_VSFILECHANGEFLAGS.VSFILECHG_Del, (int)FileChangeKind.Removed)] - public void FilesChanged_WithSpecificFlags_InvokesChangedHandler_WithExpectedArguments(uint fileChangeFlag, int expectedKind) - { - // Arrange - var filePath = "C:\\path\\to\\project\\_ViewImports.cshtml"; - uint cookie; - var fileChangeService = new Mock(); - fileChangeService - .Setup(f => f.AdviseFileChange(It.IsAny(), It.IsAny(), It.IsAny(), out cookie)) - .Returns(VSConstants.S_OK); - var tracker = new DefaultFileChangeTracker(filePath, Dispatcher, ErrorReporter, fileChangeService.Object); - - var called = false; - tracker.Changed += (sender, args) => - { - called = true; - Assert.Same(sender, tracker); - Assert.Equal(filePath, args.FilePath); - Assert.Equal((FileChangeKind)expectedKind, args.Kind); - }; - - // Act - tracker.FilesChanged(fileCount: 1, filePaths: new[] { filePath }, fileChangeFlags: new[] { fileChangeFlag }); - - // Assert - Assert.True(called); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/DefaultVisualStudioWorkspaceAccessorTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/DefaultVisualStudioWorkspaceAccessorTest.cs deleted file mode 100644 index 95a0cb7105..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/DefaultVisualStudioWorkspaceAccessorTest.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.ObjectModel; -using Microsoft.CodeAnalysis; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Projection; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - public class DefaultVisualStudioWorkspaceAccessorTest - { - [Fact] - public void TryGetWorkspace_CanGetWorkspaceFromProjectionBuffersOnly() - { - // Arrange - var textBuffer = Mock.Of(); - var workspaceAccessor = new TestWorkspaceAccessor(true, false); - - // Act - var result = workspaceAccessor.TryGetWorkspace(textBuffer, out var workspace); - - // Assert - Assert.True(result); - } - - [Fact] - public void TryGetWorkspace_CanGetWorkspaceFromBuffersInHierarchyOnly() - { - // Arrange - var textBuffer = Mock.Of(); - var workspaceAccessor = new TestWorkspaceAccessor(false, true); - - // Act - var result = workspaceAccessor.TryGetWorkspace(textBuffer, out var workspace); - - // Assert - Assert.True(result); - } - - [Fact] - public void TryGetWorkspace_CanGetWorkspaceFromBuffersInHierarchyOrProjectionBuffers() - { - // Arrange - var textBuffer = Mock.Of(); - var workspaceAccessor = new TestWorkspaceAccessor(true, true); - - // Act - var result = workspaceAccessor.TryGetWorkspace(textBuffer, out var workspace); - - // Assert - Assert.True(result); - } - - [Fact] - public void TryGetWorkspaceFromProjectionBuffer_NoProjectionBuffer_ReturnsFalse() - { - // Arrange - var bufferGraph = new Mock(); - bufferGraph.Setup(graph => graph.GetTextBuffers(It.IsAny>())) - .Returns>(predicate => new Collection()); - var bufferGraphService = new Mock(); - bufferGraphService.Setup(service => service.CreateBufferGraph(It.IsAny())) - .Returns(bufferGraph.Object); - var workspaceAccessor = new DefaultVisualStudioWorkspaceAccessor(bufferGraphService.Object, Mock.Of(), TestWorkspace.Create()); - var textBuffer = Mock.Of(); - - // Act - var result = workspaceAccessor.TryGetWorkspaceFromProjectionBuffer(textBuffer, out var workspace); - - // Assert - Assert.False(result); - } - - [Fact] - public void TryGetWorkspaceFromHostProject_NoHostProject_ReturnsFalse() - { - // Arrange - var workspaceAccessor = new DefaultVisualStudioWorkspaceAccessor(Mock.Of(), Mock.Of(), TestWorkspace.Create()); - var textBuffer = Mock.Of(); - - // Act - var result = workspaceAccessor.TryGetWorkspaceFromHostProject(textBuffer, out var workspace); - - // Assert - Assert.False(result); - } - - [Fact] - public void TryGetWorkspaceFromHostProject_HasHostProject_ReturnsTrueWithDefaultWorkspace() - { - // Arrange - var textBuffer = Mock.Of(); - var projectService = Mock.Of(service => service.GetHostProject(textBuffer) == new object()); - var defaultWorkspace = TestWorkspace.Create(); - var workspaceAccessor = new DefaultVisualStudioWorkspaceAccessor(Mock.Of(), projectService, defaultWorkspace); - - // Act - var result = workspaceAccessor.TryGetWorkspaceFromHostProject(textBuffer, out var workspace); - - // Assert - Assert.True(result); - Assert.Same(defaultWorkspace, workspace); - } - - private class TestWorkspaceAccessor : DefaultVisualStudioWorkspaceAccessor - { - private readonly bool _canGetWorkspaceFromProjectionBuffer; - private readonly bool _canGetWorkspaceFromHostProject; - - internal TestWorkspaceAccessor(bool canGetWorkspaceFromProjectionBuffer, bool canGetWorkspaceFromHostProject) : - base( - Mock.Of(), - Mock.Of(), - TestWorkspace.Create()) - { - _canGetWorkspaceFromProjectionBuffer = canGetWorkspaceFromProjectionBuffer; - _canGetWorkspaceFromHostProject = canGetWorkspaceFromHostProject; - } - - internal override bool TryGetWorkspaceFromProjectionBuffer(ITextBuffer textBuffer, out Workspace workspace) - { - if (_canGetWorkspaceFromProjectionBuffer) - { - workspace = TestWorkspace.Create(); - return true; - } - - workspace = null; - return false; - } - - internal override bool TryGetWorkspaceFromHostProject(ITextBuffer textBuffer, out Workspace workspace) - { - if (_canGetWorkspaceFromHostProject) - { - workspace = TestWorkspace.Create(); - return true; - } - - workspace = null; - return false; - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj deleted file mode 100644 index 1f76acc35b..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Microsoft.VisualStudio.LanguageServices.Razor.Test.csproj +++ /dev/null @@ -1,41 +0,0 @@ - - - - net461 - true - - - true - true - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/OOPTagHelperResolverTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/OOPTagHelperResolverTest.cs deleted file mode 100644 index cb9a4e8a6b..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/OOPTagHelperResolverTest.cs +++ /dev/null @@ -1,177 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Linq; -using System.Reflection; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Editor.Razor; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - public class OOPTagHelperResolverTest - { - public OOPTagHelperResolverTest() - { - HostProject_For_2_0 = new HostProject("Test.csproj", FallbackRazorConfiguration.MVC_2_0); - HostProject_For_NonSerializableConfiguration = new HostProject( - "Test.csproj", - new ProjectSystemRazorConfiguration(RazorLanguageVersion.Version_2_1, "Blazor-0.1", Array.Empty())); - - CustomFactories = new Lazy[] - { - new Lazy( - () => new LegacyProjectEngineFactory_2_0(), - typeof(LegacyProjectEngineFactory_2_0).GetCustomAttribute()), - - // We don't really use this factory, we just use it to ensure that the call is going to go out of process. - new Lazy( - () => new LegacyProjectEngineFactory_2_1(), - new ExportCustomProjectEngineFactoryAttribute("Blazor-0.1") { SupportsSerialization = false, }), - }; - - FallbackFactory = new FallbackProjectEngineFactory(); - - Workspace = new AdhocWorkspace(); - - var info = ProjectInfo.Create(ProjectId.CreateNewId("Test"), VersionStamp.Default, "Test", "Test", LanguageNames.CSharp, filePath: "Test.csproj"); - WorkspaceProject = Workspace.CurrentSolution.AddProject(info).GetProject(info.Id); - - ErrorReporter = new DefaultErrorReporter(); - ProjectManager = new TestProjectSnapshotManager(Workspace); - EngineFactory = new DefaultProjectEngineFactoryService(ProjectManager, FallbackFactory, CustomFactories); - } - - private ErrorReporter ErrorReporter { get; } - - private RazorProjectEngineFactoryService EngineFactory { get; } - - private Lazy[] CustomFactories { get; } - - private IFallbackProjectEngineFactory FallbackFactory { get; } - - private HostProject HostProject_For_2_0 { get; } - - private HostProject HostProject_For_NonSerializableConfiguration { get; } - - private ProjectSnapshotManagerBase ProjectManager { get; } - - private Project WorkspaceProject { get; } - - private Workspace Workspace { get; } - - [Fact] - public async Task GetTagHelpersAsync_WithNonInitializedProject_Noops() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject_For_2_0); - - var project = ProjectManager.GetProjectWithFilePath("Test.csproj"); - - var resolver = new TestTagHelperResolver(EngineFactory, ErrorReporter, Workspace); - - var result = await resolver.GetTagHelpersAsync(project); - - // Assert - Assert.Same(TagHelperResolutionResult.Empty, result); - } - - [Fact] - public async Task GetTagHelpersAsync_WithSerializableCustomFactory_GoesOutOfProcess() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject_For_2_0); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - - var project = ProjectManager.GetProjectWithFilePath("Test.csproj"); - - var resolver = new TestTagHelperResolver(EngineFactory, ErrorReporter, Workspace) - { - OnResolveOutOfProcess = (f, p) => - { - Assert.Same(CustomFactories[0].Value, f); - Assert.Same(project, p); - - return Task.FromResult(TagHelperResolutionResult.Empty); - }, - }; - - var result = await resolver.GetTagHelpersAsync(project); - - // Assert - Assert.Same(TagHelperResolutionResult.Empty, result); - } - - [Fact] - public async Task GetTagHelpersAsync_WithNonSerializableCustomFactory_StaysInProcess() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject_For_NonSerializableConfiguration); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - - var project = ProjectManager.GetProjectWithFilePath("Test.csproj"); - - var resolver = new TestTagHelperResolver(EngineFactory, ErrorReporter, Workspace) - { - OnResolveInProcess = (p) => - { - Assert.Same(project, p); - - return Task.FromResult(TagHelperResolutionResult.Empty); - }, - }; - - var result = await resolver.GetTagHelpersAsync(project); - - // Assert - Assert.Same(TagHelperResolutionResult.Empty, result); - - } - - private class TestTagHelperResolver : OOPTagHelperResolver - { - public TestTagHelperResolver(RazorProjectEngineFactoryService engineFactory, ErrorReporter errorReporter, Workspace workspace) - : base(engineFactory, errorReporter, workspace) - { - } - - public Func> OnResolveOutOfProcess { get; set; } - - public Func> OnResolveInProcess { get; set; } - - protected override Task ResolveTagHelpersOutOfProcessAsync(IProjectEngineFactory factory, ProjectSnapshot project) - { - Assert.NotNull(OnResolveOutOfProcess); - return OnResolveOutOfProcess(factory, project); - } - - protected override Task ResolveTagHelpersInProcessAsync(ProjectSnapshot project) - { - Assert.NotNull(OnResolveInProcess); - return OnResolveInProcess(project); - } - } - private class TestProjectSnapshotManager : DefaultProjectSnapshotManager - { - public TestProjectSnapshotManager(Workspace workspace) - : base( - Mock.Of(), - Mock.Of(), - Mock.Of(), - Enumerable.Empty(), - workspace) - { - } - - protected override void NotifyBackgroundWorker(ProjectSnapshotUpdateContext context) - { - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs deleted file mode 100644 index ec7890f536..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs +++ /dev/null @@ -1,837 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Moq; -using Xunit; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - public class DefaultProjectSnapshotManagerTest : ForegroundDispatcherTestBase - { - public DefaultProjectSnapshotManagerTest() - { - HostProject = new HostProject("Test.csproj", FallbackRazorConfiguration.MVC_2_0); - - Workspace = TestWorkspace.Create(); - ProjectManager = new TestProjectSnapshotManager(Dispatcher, Enumerable.Empty(), Workspace); - - var projectId = ProjectId.CreateNewId("Test"); - var solution = Workspace.CurrentSolution.AddProject(ProjectInfo.Create( - projectId, - VersionStamp.Default, - "Test", - "Test", - LanguageNames.CSharp, - "Test.csproj")); - WorkspaceProject = solution.GetProject(projectId); - - var vbProjectId = ProjectId.CreateNewId("VB"); - solution = solution.AddProject(ProjectInfo.Create( - vbProjectId, - VersionStamp.Default, - "VB", - "VB", - LanguageNames.VisualBasic, - "VB.vbproj")); - VBWorkspaceProject = solution.GetProject(vbProjectId); - - var projectWithoutFilePathId = ProjectId.CreateNewId("NoFile"); - solution = solution.AddProject(ProjectInfo.Create( - projectWithoutFilePathId, - VersionStamp.Default, - "NoFile", - "NoFile", - LanguageNames.CSharp)); - WorkspaceProjectWithoutFilePath = solution.GetProject(projectWithoutFilePathId); - - // Approximates a project with multi-targeting - var projectIdWithDifferentTfm = ProjectId.CreateNewId("TestWithDifferentTfm"); - solution = Workspace.CurrentSolution.AddProject(ProjectInfo.Create( - projectIdWithDifferentTfm, - VersionStamp.Default, - "Test (Different TFM)", - "Test", - LanguageNames.CSharp, - "Test.csproj")); - WorkspaceProjectWithDifferentTfm = solution.GetProject(projectIdWithDifferentTfm); - } - - private HostProject HostProject { get; } - - private Project WorkspaceProject { get; } - - private Project WorkspaceProjectWithDifferentTfm { get; } - - private Project WorkspaceProjectWithoutFilePath { get; } - - private Project VBWorkspaceProject { get; } - - private TestProjectSnapshotManager ProjectManager { get; } - - private Workspace Workspace { get; } - - [ForegroundFact] - public void HostProjectBuildComplete_FindsChangedWorkspaceProject_AndStartsBackgroundWorker() - { - // Arrange - Assert.True(Workspace.TryApplyChanges(WorkspaceProject.Solution)); - ProjectManager.HostProjectAdded(HostProject); - var project = WorkspaceProject.WithAssemblyName("Test1"); // Simulate a project change - ProjectManager.WorkspaceProjectAdded(project); - ProjectManager.Reset(); - - // Act - ProjectManager.HostProjectBuildComplete(HostProject); - - // Assert - var snapshot = ProjectManager.GetSnapshot(HostProject); - Assert.True(snapshot.IsDirty); - Assert.True(snapshot.IsInitialized); - - Assert.False(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void HostProjectAdded_WithoutWorkspaceProject_NotifiesListeners() - { - // Arrange - - // Act - ProjectManager.HostProjectAdded(HostProject); - - // Assert - var snapshot = ProjectManager.GetSnapshot(HostProject); - Assert.True(snapshot.IsDirty); - Assert.False(snapshot.IsInitialized); - - Assert.True(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void HostProjectAdded_FindsWorkspaceProject_NotifiesListeners_AndStartsBackgroundWorker() - { - // Arrange - Assert.True(Workspace.TryApplyChanges(WorkspaceProject.Solution)); - - // Act - ProjectManager.HostProjectAdded(HostProject); - - // Assert - var snapshot = ProjectManager.GetSnapshot(HostProject); - Assert.True(snapshot.IsDirty); - Assert.True(snapshot.IsInitialized); - - Assert.True(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void HostProjectChanged_WithoutWorkspaceProject_NotifiesListeners_AndDoesNotStartBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.Reset(); - - var project = new HostProject(HostProject.FilePath, FallbackRazorConfiguration.MVC_1_0); // Simulate a project change - - // Act - ProjectManager.HostProjectChanged(project); - - // Assert - var snapshot = ProjectManager.GetSnapshot(HostProject); - Assert.True(snapshot.IsDirty); - Assert.False(snapshot.IsInitialized); - - Assert.True(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void HostProjectChanged_WithWorkspaceProject_RetainsComputedState_NotifiesListeners_AndStartsBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Adding some computed state - var snapshot = ProjectManager.GetSnapshot(HostProject); - var updateContext = snapshot.CreateUpdateContext(); - ProjectManager.ProjectUpdated(updateContext); - ProjectManager.Reset(); - - var project = new HostProject(HostProject.FilePath, FallbackRazorConfiguration.MVC_1_0); // Simulate a project change - - // Act - ProjectManager.HostProjectChanged(project); - - // Assert - snapshot = ProjectManager.GetSnapshot(project); - Assert.True(snapshot.IsDirty); - Assert.True(snapshot.IsInitialized); - - Assert.True(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void HostProjectChanged_IgnoresUnknownProject() - { - // Arrange - - // Act - ProjectManager.HostProjectChanged(HostProject); - - // Assert - Assert.Empty(ProjectManager.Projects); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void HostProjectRemoved_RemovesProject_NotifiesListeners() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.Reset(); - - // Act - ProjectManager.HostProjectRemoved(HostProject); - - // Assert - Assert.Empty(ProjectManager.Projects); - - Assert.True(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void ProjectUpdated_WithComputedState_IgnoresUnknownProject() - { - // Arrange - - // Act - ProjectManager.ProjectUpdated(new ProjectSnapshotUpdateContext("Test", HostProject, WorkspaceProject, VersionStamp.Default)); - - // Assert - Assert.Empty(ProjectManager.Projects); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void ProjectUpdated_WhenHostProjectChanged_MadeClean_NotifiesListeners_AndDoesNotStartBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - var project = new HostProject(HostProject.FilePath, FallbackRazorConfiguration.MVC_1_0); // Simulate a project change - ProjectManager.HostProjectChanged(project); - ProjectManager.Reset(); - - // Generate the update - var snapshot = ProjectManager.GetSnapshot(HostProject); - var updateContext = snapshot.CreateUpdateContext(); - - // Act - ProjectManager.ProjectUpdated(updateContext); - - // Assert - snapshot = ProjectManager.GetSnapshot(project); - Assert.False(snapshot.IsDirty); - - Assert.True(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void ProjectUpdated_WhenWorkspaceProjectChanged_MadeClean_NotifiesListeners_AndDoesNotStartBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - var project = WorkspaceProject.WithAssemblyName("Test1"); // Simulate a project change - ProjectManager.WorkspaceProjectChanged(project); - ProjectManager.Reset(); - - // Generate the update - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - var updateContext = snapshot.CreateUpdateContext(); - - // Act - ProjectManager.ProjectUpdated(updateContext); - - // Assert - snapshot = ProjectManager.GetSnapshot(project); - Assert.False(snapshot.IsDirty); - - Assert.True(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void ProjectUpdated_WhenHostProjectChanged_StillDirty_WithSignificantChanges_NotifiesListeners_AndStartsBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Generate the update - var snapshot = ProjectManager.GetSnapshot(HostProject); - var updateContext = snapshot.CreateUpdateContext(); - - var project = new HostProject(HostProject.FilePath, FallbackRazorConfiguration.MVC_1_0); // Simulate a project change - ProjectManager.HostProjectChanged(project); - ProjectManager.Reset(); - - // Act - ProjectManager.ProjectUpdated(updateContext); - - // Assert - snapshot = ProjectManager.GetSnapshot(project); - Assert.True(snapshot.IsDirty); - - Assert.True(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectChanged_BackgroundUpdate_StillDirty_WithSignificantChanges_NotifiesListeners_AndStartsBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Generate the update - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - var updateContext = snapshot.CreateUpdateContext(); - - var project = WorkspaceProject.WithAssemblyName("Test1"); // Simulate a project change - ProjectManager.WorkspaceProjectChanged(project); - ProjectManager.Reset(); - - // Act - ProjectManager.ProjectUpdated(updateContext); - - // Assert - snapshot = ProjectManager.GetSnapshot(project); - Assert.True(snapshot.IsDirty); - - Assert.True(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [Fact(Skip = "We no longer have any background-computed state")] - public void ProjectUpdated_WhenHostProjectChanged_StillDirty_WithoutSignificantChanges_DoesNotNotifyListeners_AndStartsBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Generate an update based on the original state - var snapshot = ProjectManager.GetSnapshot(HostProject); - var updateContext = snapshot.CreateUpdateContext(); - ProjectManager.ProjectUpdated(updateContext); - ProjectManager.Reset(); - - var project = new HostProject(HostProject.FilePath, FallbackRazorConfiguration.MVC_1_0); // Simulate a project change - ProjectManager.HostProjectChanged(project); - ProjectManager.Reset(); - - // Now start computing another update - snapshot = ProjectManager.GetSnapshot(HostProject); - updateContext = snapshot.CreateUpdateContext(); - - project = new HostProject(HostProject.FilePath, FallbackRazorConfiguration.MVC_1_1); // Simulate a project change - ProjectManager.HostProjectChanged(project); - ProjectManager.Reset(); - - // Act - ProjectManager.ProjectUpdated(updateContext); // Still dirty because the project changed while computing the update - - // Assert - snapshot = ProjectManager.GetSnapshot(project); - Assert.True(snapshot.IsDirty); - - Assert.False(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [Fact(Skip = "We no longer have any background-computed state")] - public void ProjectUpdated_WhenWorkspaceProjectChanged_StillDirty_WithoutSignificantChanges_DoesNotNotifyListeners_AndStartsBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Generate an update based on the original state - var snapshot = ProjectManager.GetSnapshot(HostProject); - var updateContext = snapshot.CreateUpdateContext(); - ProjectManager.ProjectUpdated(updateContext); - ProjectManager.Reset(); - - var project = WorkspaceProject.WithAssemblyName("Test1"); // Simulate a project change - ProjectManager.WorkspaceProjectChanged(project); - ProjectManager.Reset(); - - // Now start computing another update - snapshot = ProjectManager.GetSnapshot(HostProject); - updateContext = snapshot.CreateUpdateContext(); - - project = project.WithAssemblyName("Test2"); // Simulate a project change - ProjectManager.WorkspaceProjectChanged(project); - ProjectManager.Reset(); - - // Act - ProjectManager.ProjectUpdated(updateContext); // Still dirty because the project changed while computing the update - - // Assert - snapshot = ProjectManager.GetSnapshot(project); - Assert.True(snapshot.IsDirty); - - Assert.False(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void ProjectUpdated_WhenHostProjectRemoved_DiscardsUpdate() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Generate the update - var snapshot = ProjectManager.GetSnapshot(HostProject); - var updateContext = snapshot.CreateUpdateContext(); - - ProjectManager.HostProjectRemoved(HostProject); - ProjectManager.Reset(); - - // Act - ProjectManager.ProjectUpdated(updateContext); - - // Assert - snapshot = ProjectManager.GetSnapshot(HostProject); - Assert.Null(snapshot); - } - - [ForegroundFact] - public void ProjectUpdated_WhenWorkspaceProjectRemoved_DiscardsUpdate() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Generate the update - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - var updateContext = snapshot.CreateUpdateContext(); - - ProjectManager.WorkspaceProjectRemoved(WorkspaceProject); - ProjectManager.Reset(); - - // Act - ProjectManager.ProjectUpdated(updateContext); - - // Assert - snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.True(snapshot.IsDirty); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void ProjectUpdated_BackgroundUpdate_MadeClean_WithSignificantChanges_NotifiesListeners_AndDoesNotStartBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Generate the update - var snapshot = ProjectManager.GetSnapshot(HostProject); - var updateContext = snapshot.CreateUpdateContext(); - - // Act - ProjectManager.ProjectUpdated(updateContext); - - // Assert - snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.False(snapshot.IsDirty); - - Assert.True(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectAdded_WithoutHostProject_IgnoresWorkspaceProject() - { - // Arrange - - // Act - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - - // Assert - Assert.Empty(ProjectManager.Projects); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectAdded_IgnoresNonCSharpProject() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectAdded(VBWorkspaceProject); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.False(snapshot.IsInitialized); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectAdded_IgnoresSecondProjectWithSameFilePath() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectAdded(WorkspaceProjectWithDifferentTfm); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.Same(WorkspaceProject, snapshot.WorkspaceProject); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectAdded_IgnoresProjectWithoutFilePath() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectAdded(WorkspaceProjectWithoutFilePath); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.False(snapshot.IsInitialized); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectAdded_WithHostProject_NotifiesListenters_AndStartsBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.True(snapshot.IsDirty); - Assert.True(snapshot.IsInitialized); - - Assert.True(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectChanged_WithoutHostProject_IgnoresWorkspaceProject() - { - // Arrange - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - var project = WorkspaceProject.WithAssemblyName("Test1"); // Simulate a project change - - // Act - ProjectManager.WorkspaceProjectChanged(project); - - // Assert - Assert.Empty(ProjectManager.Projects); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectChanged_IgnoresNonCSharpProject() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(VBWorkspaceProject); - ProjectManager.Reset(); - - var project = VBWorkspaceProject.WithAssemblyName("Test1"); // Simulate a project change - - // Act - ProjectManager.WorkspaceProjectChanged(project); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.False(snapshot.IsInitialized); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - - [ForegroundFact] - public void WorkspaceProjectChanged_IgnoresProjectWithoutFilePath() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProjectWithoutFilePath); - ProjectManager.Reset(); - - var project = WorkspaceProjectWithoutFilePath.WithAssemblyName("Test1"); // Simulate a project change - - // Act - ProjectManager.WorkspaceProjectChanged(project); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.False(snapshot.IsInitialized); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectChanged_IgnoresSecondProjectWithSameFilePath() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectChanged(WorkspaceProjectWithDifferentTfm); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.Same(WorkspaceProject, snapshot.WorkspaceProject); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectChanged_MadeDirty_RetainsComputedState_NotifiesListeners_AndStartsBackgroundWorker() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Generate the update - var snapshot = ProjectManager.GetSnapshot(HostProject); - var updateContext = snapshot.CreateUpdateContext(); - ProjectManager.ProjectUpdated(updateContext); - ProjectManager.Reset(); - - var project = WorkspaceProject.WithAssemblyName("Test1"); // Simulate a project change - - // Act - ProjectManager.WorkspaceProjectChanged(project); - - // Assert - snapshot = ProjectManager.GetSnapshot(project); - Assert.True(snapshot.IsDirty); - - Assert.False(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectRemoved_WithHostProject_DoesNotRemoveProject() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectRemoved(WorkspaceProject); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.True(snapshot.IsDirty); - Assert.False(snapshot.IsInitialized); - - Assert.True(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectRemoved_WithHostProject_FallsBackToSecondProject() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Sets up a solution where the which has WorkspaceProjectWithDifferentTfm but not WorkspaceProject - // This will enable us to fall back and find the WorkspaceProjectWithDifferentTfm - Assert.True(Workspace.TryApplyChanges(WorkspaceProjectWithDifferentTfm.Solution)); - - // Act - ProjectManager.WorkspaceProjectRemoved(WorkspaceProject); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.True(snapshot.IsDirty); - Assert.True(snapshot.IsInitialized); - Assert.Equal(WorkspaceProjectWithDifferentTfm.Id, snapshot.WorkspaceProject.Id); - - Assert.True(ProjectManager.ListenersNotified); - Assert.True(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectRemoved_IgnoresSecondProjectWithSameFilePath() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProject); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectRemoved(WorkspaceProjectWithDifferentTfm); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.Same(WorkspaceProject, snapshot.WorkspaceProject); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectRemoved_IgnoresNonCSharpProject() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(VBWorkspaceProject); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectRemoved(VBWorkspaceProject); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.False(snapshot.IsInitialized); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectRemoved_IgnoresProjectWithoutFilePath() - { - // Arrange - ProjectManager.HostProjectAdded(HostProject); - ProjectManager.WorkspaceProjectAdded(WorkspaceProjectWithoutFilePath); - ProjectManager.Reset(); - - // Act - ProjectManager.WorkspaceProjectRemoved(WorkspaceProjectWithoutFilePath); - - // Assert - var snapshot = ProjectManager.GetSnapshot(WorkspaceProject); - Assert.False(snapshot.IsInitialized); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - [ForegroundFact] - public void WorkspaceProjectRemoved_IgnoresUnknownProject() - { - // Arrange - - // Act - ProjectManager.WorkspaceProjectRemoved(WorkspaceProject); - - // Assert - Assert.Empty(ProjectManager.Projects); - - Assert.False(ProjectManager.ListenersNotified); - Assert.False(ProjectManager.WorkerStarted); - } - - private class TestProjectSnapshotManager : DefaultProjectSnapshotManager - { - public TestProjectSnapshotManager(ForegroundDispatcher dispatcher, IEnumerable triggers, Workspace workspace) - : base(dispatcher, Mock.Of(), Mock.Of(), triggers, workspace) - { - } - - public bool ListenersNotified { get; private set; } - - public bool WorkerStarted { get; private set; } - - public DefaultProjectSnapshot GetSnapshot(HostProject hostProject) - { - return Projects.Cast().FirstOrDefault(s => s.FilePath == hostProject.FilePath); - } - - public DefaultProjectSnapshot GetSnapshot(Project workspaceProject) - { - return Projects.Cast().FirstOrDefault(s => s.FilePath == workspaceProject.FilePath); - } - - public void Reset() - { - ListenersNotified = false; - WorkerStarted = false; - } - - protected override void NotifyListeners(ProjectChangeEventArgs e) - { - ListenersNotified = true; - } - - protected override void NotifyBackgroundWorker(ProjectSnapshotUpdateContext context) - { - Assert.NotNull(context.HostProject); - Assert.NotNull(context.WorkspaceProject); - - WorkerStarted = true; - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultRazorProjectHostTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultRazorProjectHostTest.cs deleted file mode 100644 index b0c0322f12..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultRazorProjectHostTest.cs +++ /dev/null @@ -1,1025 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.LanguageServices.Razor; -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.Properties; -using Moq; -using Xunit; -using ProjectStateItem = System.Collections.Generic.KeyValuePair>; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - public class DefaultRazorProjectHostTest : ForegroundDispatcherTestBase - { - public DefaultRazorProjectHostTest() - { - Workspace = new AdhocWorkspace(); - ProjectManager = new TestProjectSnapshotManager(Dispatcher, Workspace); - } - - private TestProjectSnapshotManager ProjectManager { get; } - - private Workspace Workspace { get; } - - [Fact] - public void TryGetDefaultConfiguration_FailsIfNoRule() - { - // Arrange - var projectState = new Dictionary().ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetDefaultConfiguration(projectState, out var defaultConfiguration); - - // Assert - Assert.False(result); - Assert.Null(defaultConfiguration); - } - - [Fact] - public void TryGetDefaultConfiguration_FailsIfNoConfiguration() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties(Rules.RazorGeneral.SchemaName, new Dictionary()) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetDefaultConfiguration(projectState, out var defaultConfiguration); - - // Assert - Assert.False(result); - Assert.Null(defaultConfiguration); - } - - [Fact] - public void TryGetDefaultConfiguration_FailsIfEmptyConfiguration() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorDefaultConfigurationProperty] = string.Empty - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetDefaultConfiguration(projectState, out var defaultConfiguration); - - // Assert - Assert.False(result); - Assert.Null(defaultConfiguration); - } - - [Fact] - public void TryGetDefaultConfiguration_SucceedsWithValidConfiguration() - { - // Arrange - var expectedConfiguration = "Razor-13.37"; - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorDefaultConfigurationProperty] = expectedConfiguration - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetDefaultConfiguration(projectState, out var defaultConfiguration); - - // Assert - Assert.True(result); - Assert.Equal(expectedConfiguration, defaultConfiguration); - } - - [Fact] - public void TryGetLanguageVersion_FailsIfNoRule() - { - // Arrange - var projectState = new Dictionary().ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectState, out var languageVersion); - - // Assert - Assert.False(result); - Assert.Null(languageVersion); - } - - [Fact] - public void TryGetLanguageVersion_FailsIfNoLanguageVersion() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties(Rules.RazorGeneral.SchemaName, new Dictionary()) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectState, out var languageVersion); - - // Assert - Assert.False(result); - Assert.Null(languageVersion); - } - - [Fact] - public void TryGetLanguageVersion_FailsIfEmptyLanguageVersion() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorLangVersionProperty] = string.Empty - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectState, out var languageVersion); - - // Assert - Assert.False(result); - Assert.Null(languageVersion); - } - - [Fact] - public void TryGetLanguageVersion_SucceedsWithValidLanguageVersion() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorLangVersionProperty] = "1.0" - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectState, out var languageVersion); - - // Assert - Assert.True(result); - Assert.Same(RazorLanguageVersion.Version_1_0, languageVersion); - } - - [Fact] - public void TryGetLanguageVersion_SucceedsWithUnknownLanguageVersion_DefaultsToLatest() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorLangVersionProperty] = "13.37" - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectState, out var languageVersion); - - // Assert - Assert.True(result); - Assert.Same(RazorLanguageVersion.Latest, languageVersion); - } - - [Fact] - public void TryGetConfigurationItem_FailsNoRazorConfigurationRule() - { - // Arrange - var projectState = new Dictionary().ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfigurationItem("Razor-13.37", projectState, out var configurationItem); - - // Assert - Assert.False(result); - } - - [Fact] - public void TryGetConfigurationItem_FailsNoRazorConfigurationItems() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorConfiguration.SchemaName] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorConfiguration.SchemaName, - new Dictionary>()) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfigurationItem("Razor-13.37", projectState, out var configurationItem); - - // Assert - Assert.False(result); - } - - [Fact] - public void TryGetConfigurationItem_FailsNoMatchingRazorConfigurationItems() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorConfiguration.SchemaName] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorConfiguration.SchemaName, - new Dictionary>() - { - ["Razor-10.0"] = new Dictionary(), - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfigurationItem("Razor-13.37", projectState, out var configurationItem); - - // Assert - Assert.False(result); - } - - [Fact] - public void TryGetConfigurationItem_SucceedsForMatchingConfigurationItem() - { - // Arrange - var expectedConfiguration = "Razor-13.37"; - var expectedConfigurationValue = new Dictionary() - { - [Rules.RazorConfiguration.ExtensionsProperty] = "SomeExtension" - }; - var projectState = new Dictionary() - { - [Rules.RazorConfiguration.SchemaName] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorConfiguration.SchemaName, - new Dictionary>() - { - [expectedConfiguration] = expectedConfigurationValue - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfigurationItem(expectedConfiguration, projectState, out var configurationItem); - - // Assert - Assert.True(result); - Assert.Equal(expectedConfiguration, configurationItem.Key); - Assert.True(Enumerable.SequenceEqual(expectedConfigurationValue, configurationItem.Value)); - } - - [Fact] - public void TryGetConfiguredExtensionNames_FailsIfNoExtensions() - { - // Arrange - var extensions = new Dictionary().ToImmutableDictionary(); - var configurationItem = new ProjectStateItem(Rules.RazorConfiguration.SchemaName, extensions); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionnames); - - // Assert - Assert.False(result); - Assert.Null(configuredExtensionnames); - } - - [Fact] - public void TryGetConfiguredExtensionNames_FailsIfEmptyExtensions() - { - // Arrange - var extensions = new Dictionary() - { - [Rules.RazorConfiguration.ExtensionsProperty] = string.Empty - }.ToImmutableDictionary(); - var configurationItem = new ProjectStateItem(Rules.RazorConfiguration.SchemaName, extensions); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionNames); - - // Assert - Assert.False(result); - Assert.Null(configuredExtensionNames); - } - - [Fact] - public void TryGetConfiguredExtensionNames_SucceedsIfSingleExtension() - { - // Arrange - var expectedExtensionName = "SomeExtensionName"; - var extensions = new Dictionary() - { - [Rules.RazorConfiguration.ExtensionsProperty] = expectedExtensionName - }.ToImmutableDictionary(); - var configurationItem = new ProjectStateItem(Rules.RazorConfiguration.SchemaName, extensions); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionNames); - - // Assert - Assert.True(result); - var extensionName = Assert.Single(configuredExtensionNames); - Assert.Equal(expectedExtensionName, extensionName); - } - - [Fact] - public void TryGetConfiguredExtensionNames_SucceedsIfMultipleExtensions() - { - // Arrange - var extensions = new Dictionary() - { - [Rules.RazorConfiguration.ExtensionsProperty] = "SomeExtensionName;SomeOtherExtensionName" - }.ToImmutableDictionary(); - var configurationItem = new ProjectStateItem(Rules.RazorConfiguration.SchemaName, extensions); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionNames); - - // Assert - Assert.True(result); - Assert.Collection( - configuredExtensionNames, - name => Assert.Equal("SomeExtensionName", name), - name => Assert.Equal("SomeOtherExtensionName", name)); - } - - [Fact] - public void TryGetExtensions_NoExtensions() - { - // Arrange - var projectState = new Dictionary().ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetExtensions(new[] { "Extension1", "Extension2" }, projectState, out var extensions); - - // Assert - Assert.False(result); - Assert.Null(extensions); - } - - [Fact] - public void TryGetExtensions_SucceedsWithUnConfiguredExtensionTypes() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorExtension.PrimaryDataSourceItemType] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorExtension.PrimaryDataSourceItemType, - new Dictionary>() - { - ["UnconfiguredExtensionName"] = new Dictionary() - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetExtensions(new[] { "Extension1", "Extension2" }, projectState, out var extensions); - - // Assert - Assert.True(result); - Assert.Empty(extensions); - } - - [Fact] - public void TryGetExtensions_SucceedsWithSomeConfiguredExtensions() - { - // Arrange - var expectedExtension1Name = "Extension1"; - var expectedExtension2Name = "Extension2"; - var projectState = new Dictionary() - { - [Rules.RazorExtension.PrimaryDataSourceItemType] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorExtension.PrimaryDataSourceItemType, - new Dictionary>() - { - ["UnconfiguredExtensionName"] = new Dictionary(), - [expectedExtension1Name] = new Dictionary(), - [expectedExtension2Name] = new Dictionary(), - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetExtensions(new[] { expectedExtension1Name, expectedExtension2Name }, projectState, out var extensions); - - // Assert - Assert.True(result); - Assert.Collection( - extensions, - extension => Assert.Equal(expectedExtension2Name, extension.ExtensionName), - extension => Assert.Equal(expectedExtension1Name, extension.ExtensionName)); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoDefaultConfiguration() - { - // Arrange - var projectState = new Dictionary().ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectState, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoLanguageVersion() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorDefaultConfigurationProperty] = "13.37" - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectState, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoConfigurationItems() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorDefaultConfigurationProperty] = "13.37", - [Rules.RazorGeneral.RazorLangVersionProperty] = "1.0", - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectState, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoConfiguredExtensionNames() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorDefaultConfigurationProperty] = "13.37", - [Rules.RazorGeneral.RazorLangVersionProperty] = "1.0", - }), - [Rules.RazorConfiguration.SchemaName] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorConfiguration.SchemaName, - new Dictionary>() - { - ["Razor-13.37"] = new Dictionary() - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectState, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoExtensions() - { - // Arrange - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorDefaultConfigurationProperty] = "13.37", - [Rules.RazorGeneral.RazorLangVersionProperty] = "1.0", - }), - [Rules.RazorConfiguration.SchemaName] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorConfiguration.SchemaName, - new Dictionary>() - { - ["SomeExtension"] = new Dictionary() - { - ["Extensions"] = "Razor-13.37" - } - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectState, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - // This is more of an integration test but is here to test the overall flow/functionality - [Fact] - public void TryGetConfiguration_SucceedsWithAllPreRequisites() - { - // Arrange - var expectedLanguageVersion = RazorLanguageVersion.Version_1_0; - var expectedConfigurationName = "Razor-Test"; - var expectedExtension1Name = "Extension1"; - var expectedExtension2Name = "Extension2"; - var projectState = new Dictionary() - { - [Rules.RazorGeneral.SchemaName] = TestProjectRuleSnapshot.CreateProperties( - Rules.RazorGeneral.SchemaName, - new Dictionary() - { - [Rules.RazorGeneral.RazorDefaultConfigurationProperty] = expectedConfigurationName, - [Rules.RazorGeneral.RazorLangVersionProperty] = "1.0", - }), - [Rules.RazorConfiguration.SchemaName] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorConfiguration.SchemaName, - new Dictionary>() - { - ["UnconfiguredRazorConfiguration"] = new Dictionary() - { - ["Extensions"] = "Razor-9.0" - }, - [expectedConfigurationName] = new Dictionary() - { - ["Extensions"] = expectedExtension1Name + ";" + expectedExtension2Name - } - }), - [Rules.RazorExtension.PrimaryDataSourceItemType] = TestProjectRuleSnapshot.CreateItems( - Rules.RazorExtension.PrimaryDataSourceItemType, - new Dictionary>() - { - [expectedExtension1Name] = new Dictionary(), - [expectedExtension2Name] = new Dictionary(), - }) - }.ToImmutableDictionary(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectState, out var configuration); - - // Assert - Assert.True(result); - Assert.Equal(expectedLanguageVersion, configuration.LanguageVersion); - Assert.Equal(expectedConfigurationName, configuration.ConfigurationName); - Assert.Collection( - configuration.Extensions, - extension => Assert.Equal(expectedExtension2Name, extension.ExtensionName), - extension => Assert.Equal(expectedExtension1Name, extension.ExtensionName)); - } - - [ForegroundFact] - public async Task DefaultRazorProjectHost_ForegroundThread_CreateAndDispose_Succeeds() - { - // Arrange - var services = new TestProjectSystemServices("Test.csproj"); - var host = new DefaultRazorProjectHost(services, Workspace, ProjectManager); - - // Act & Assert - await host.LoadAsync(); - Assert.Empty(ProjectManager.Projects); - - await host.DisposeAsync(); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task DefaultRazorProjectHost_BackgroundThread_CreateAndDispose_Succeeds() - { - // Arrange - var services = new TestProjectSystemServices("Test.csproj"); - var host = new DefaultRazorProjectHost(services, Workspace, ProjectManager); - - // Act & Assert - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_ReadsProperties_InitializesProject() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = Rules.RazorGeneral.SchemaName, - After = TestProjectRuleSnapshot.CreateProperties(Rules.RazorGeneral.SchemaName, new Dictionary() - { - { Rules.RazorGeneral.RazorLangVersionProperty, "2.1" }, - { Rules.RazorGeneral.RazorDefaultConfigurationProperty, "MVC-2.1" }, - }), - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorConfiguration.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorConfiguration.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary() { { "Extensions", "MVC-2.1;Another-Thing" }, } }, - }) - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorExtension.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorExtension.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary(){ } }, - { "Another-Thing", new Dictionary(){ } }, - }) - } - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new DefaultRazorProjectHost(services, Workspace, ProjectManager); - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - - Assert.Equal(RazorLanguageVersion.Version_2_1, snapshot.Configuration.LanguageVersion); - Assert.Equal("MVC-2.1", snapshot.Configuration.ConfigurationName); - Assert.Collection( - snapshot.Configuration.Extensions, - e => Assert.Equal("MVC-2.1", e.ExtensionName), - e => Assert.Equal("Another-Thing", e.ExtensionName)); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_NoVersionFound_DoesNotIniatializeProject() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = Rules.RazorGeneral.SchemaName, - After = TestProjectRuleSnapshot.CreateProperties(Rules.RazorGeneral.SchemaName, new Dictionary() - { - { Rules.RazorGeneral.RazorLangVersionProperty, "" }, - { Rules.RazorGeneral.RazorDefaultConfigurationProperty, "" }, - }), - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorConfiguration.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorConfiguration.SchemaName, new Dictionary>() - { - }) - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorExtension.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorExtension.SchemaName, new Dictionary>() - { - }) - } - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new DefaultRazorProjectHost(services, Workspace, ProjectManager); - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - Assert.Empty(ProjectManager.Projects); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_UpdateProject_Succeeds() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = Rules.RazorGeneral.SchemaName, - After = TestProjectRuleSnapshot.CreateProperties(Rules.RazorGeneral.SchemaName, new Dictionary() - { - { Rules.RazorGeneral.RazorLangVersionProperty, "2.1" }, - { Rules.RazorGeneral.RazorDefaultConfigurationProperty, "MVC-2.1" }, - }), - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorConfiguration.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorConfiguration.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary() { { "Extensions", "MVC-2.1;Another-Thing" }, } }, - }) - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorExtension.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorExtension.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary(){ } }, - { "Another-Thing", new Dictionary(){ } }, - }) - } - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new DefaultRazorProjectHost(services, Workspace, ProjectManager); - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - 1 - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 1 - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - - Assert.Equal(RazorLanguageVersion.Version_2_1, snapshot.Configuration.LanguageVersion); - Assert.Equal("MVC-2.1", snapshot.Configuration.ConfigurationName); - Assert.Collection( - snapshot.Configuration.Extensions, - e => Assert.Equal("MVC-2.1", e.ExtensionName), - e => Assert.Equal("Another-Thing", e.ExtensionName)); - - // Act - 2 - changes[0].After.SetProperty(Rules.RazorGeneral.RazorLangVersionProperty, "2.0"); - changes[0].After.SetProperty(Rules.RazorGeneral.RazorDefaultConfigurationProperty, "MVC-2.0"); - changes[1].After.SetItem("MVC-2.0", new Dictionary() { { "Extensions", "MVC-2.0;Another-Thing" }, }); - changes[2].After.SetItem("MVC-2.0", new Dictionary()); - - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 2 - snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - - Assert.Equal(RazorLanguageVersion.Version_2_0, snapshot.Configuration.LanguageVersion); - Assert.Equal("MVC-2.0", snapshot.Configuration.ConfigurationName); - Assert.Collection( - snapshot.Configuration.Extensions, - e => Assert.Equal("Another-Thing", e.ExtensionName), - e => Assert.Equal("MVC-2.0", e.ExtensionName)); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_VersionRemoved_DeinitializesProject() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = Rules.RazorGeneral.SchemaName, - After = TestProjectRuleSnapshot.CreateProperties(Rules.RazorGeneral.SchemaName, new Dictionary() - { - { Rules.RazorGeneral.RazorLangVersionProperty, "2.1" }, - { Rules.RazorGeneral.RazorDefaultConfigurationProperty, "MVC-2.1" }, - }), - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorConfiguration.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorConfiguration.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary() { { "Extensions", "MVC-2.1;Another-Thing" }, } }, - }) - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorExtension.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorExtension.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary(){ } }, - { "Another-Thing", new Dictionary(){ } }, - }) - } - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new DefaultRazorProjectHost(services, Workspace, ProjectManager); - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - 1 - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 1 - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - - Assert.Equal(RazorLanguageVersion.Version_2_1, snapshot.Configuration.LanguageVersion); - Assert.Equal("MVC-2.1", snapshot.Configuration.ConfigurationName); - Assert.Collection( - snapshot.Configuration.Extensions, - e => Assert.Equal("MVC-2.1", e.ExtensionName), - e => Assert.Equal("Another-Thing", e.ExtensionName)); - - // Act - 2 - changes[0].After.SetProperty(Rules.RazorGeneral.RazorLangVersionProperty, ""); - changes[0].After.SetProperty(Rules.RazorGeneral.RazorDefaultConfigurationProperty, ""); - - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 2 - Assert.Empty(ProjectManager.Projects); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_AfterDispose_IgnoresUpdate() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = Rules.RazorGeneral.SchemaName, - After = TestProjectRuleSnapshot.CreateProperties(Rules.RazorGeneral.SchemaName, new Dictionary() - { - { Rules.RazorGeneral.RazorLangVersionProperty, "2.1" }, - { Rules.RazorGeneral.RazorDefaultConfigurationProperty, "MVC-2.1" }, - }), - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorConfiguration.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorConfiguration.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary() { { "Extensions", "MVC-2.1;Another-Thing" }, } }, - }) - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorExtension.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorExtension.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary(){ } }, - { "Another-Thing", new Dictionary(){ } }, - }) - } - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new DefaultRazorProjectHost(services, Workspace, ProjectManager); - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - 1 - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 1 - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - - Assert.Equal(RazorLanguageVersion.Version_2_1, snapshot.Configuration.LanguageVersion); - Assert.Equal("MVC-2.1", snapshot.Configuration.ConfigurationName); - Assert.Collection( - snapshot.Configuration.Extensions, - e => Assert.Equal("MVC-2.1", e.ExtensionName), - e => Assert.Equal("Another-Thing", e.ExtensionName)); - - // Act - 2 - await Task.Run(async () => await host.DisposeAsync()); - - // Assert - 2 - Assert.Empty(ProjectManager.Projects); - - // Act - 3 - changes[0].After.SetProperty(Rules.RazorGeneral.RazorLangVersionProperty, "2.0"); - changes[0].After.SetProperty(Rules.RazorGeneral.RazorDefaultConfigurationProperty, "MVC-2.0"); - changes[1].After.SetItem("MVC-2.0", new Dictionary() { { "Extensions", "MVC-2.0;Another-Thing" }, }); - - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 3 - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectRenamed_RemovesHostProject_CopiesConfiguration() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = Rules.RazorGeneral.SchemaName, - After = TestProjectRuleSnapshot.CreateProperties(Rules.RazorGeneral.SchemaName, new Dictionary() - { - { Rules.RazorGeneral.RazorLangVersionProperty, "2.1" }, - { Rules.RazorGeneral.RazorDefaultConfigurationProperty, "MVC-2.1" }, - }), - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorConfiguration.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorConfiguration.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary() { { "Extensions", "MVC-2.1;Another-Thing" }, } }, - }) - }, - new TestProjectChangeDescription() - { - RuleName = Rules.RazorExtension.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(Rules.RazorExtension.SchemaName, new Dictionary>() - { - { "MVC-2.1", new Dictionary(){ } }, - { "Another-Thing", new Dictionary(){ } }, - }) - } - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new DefaultRazorProjectHost(services, Workspace, ProjectManager); - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - 1 - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 1 - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - Assert.Same("MVC-2.1", snapshot.Configuration.ConfigurationName); - - // Act - 2 - services.UnconfiguredProject.FullPath = "Test2.csproj"; - await Task.Run(async () => await host.OnProjectRenamingAsync()); - - // Assert - 1 - snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test2.csproj", snapshot.FilePath); - Assert.Same("MVC-2.1", snapshot.Configuration.ConfigurationName); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - private class TestProjectSnapshotManager : DefaultProjectSnapshotManager - { - public TestProjectSnapshotManager(ForegroundDispatcher dispatcher, Workspace workspace) - : base(dispatcher, Mock.Of(), Mock.Of(), Array.Empty(), workspace) - { - } - - protected override void NotifyBackgroundWorker(ProjectSnapshotUpdateContext context) - { - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/FallbackRazorProjectHostTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/FallbackRazorProjectHostTest.cs deleted file mode 100644 index 04c910800b..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/FallbackRazorProjectHostTest.cs +++ /dev/null @@ -1,373 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Threading.Tasks; -using Microsoft.VisualStudio.LanguageServices.Razor; -using Microsoft.VisualStudio.ProjectSystem; -using Moq; -using Xunit; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - public class FallbackRazorProjectHostTest : ForegroundDispatcherTestBase - { - public FallbackRazorProjectHostTest() - { - Workspace = new AdhocWorkspace(); - ProjectManager = new TestProjectSnapshotManager(Dispatcher, Workspace); - } - - private TestProjectSnapshotManager ProjectManager { get; } - - private Workspace Workspace { get; } - - [ForegroundFact] - public async Task FallbackRazorProjectHost_ForegroundThread_CreateAndDispose_Succeeds() - { - // Arrange - var services = new TestProjectSystemServices("Test.csproj"); - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager); - - // Act & Assert - await host.LoadAsync(); - Assert.Empty(ProjectManager.Projects); - - await host.DisposeAsync(); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task FallbackRazorProjectHost_BackgroundThread_CreateAndDispose_Succeeds() - { - // Arrange - var services = new TestProjectSystemServices("Test.csproj"); - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager); - - // Act & Assert - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_ReadsProperties_InitializesProject() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, new Dictionary>() - { - { "c:\\nuget\\Microsoft.AspNetCore.Mvc.razor.dll", new Dictionary() }, - }), - }, - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager) - { - AssemblyVersion = new Version(2, 0), // Mock for reading the assembly's version - }; - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - Assert.Same(FallbackRazorConfiguration.MVC_2_0, snapshot.Configuration); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_NoAssemblyFound_DoesNotIniatializeProject() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, new Dictionary>() - { - }), - }, - - }; - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager); - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - Assert.Empty(ProjectManager.Projects); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_AssemblyFoundButCannotReadVersion_DoesNotIniatializeProject() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, new Dictionary>() - { - { "c:\\nuget\\Microsoft.AspNetCore.Mvc.razor.dll", new Dictionary() }, - }), - }, - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager); - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - Assert.Empty(ProjectManager.Projects); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_UpdateProject_Succeeds() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, new Dictionary>() - { - { "c:\\nuget\\Microsoft.AspNetCore.Mvc.razor.dll", new Dictionary() }, - }), - }, - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager) - { - AssemblyVersion = new Version(2, 0), - }; - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - 1 - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 1 - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - Assert.Same(FallbackRazorConfiguration.MVC_2_0, snapshot.Configuration); - - // Act - 2 - host.AssemblyVersion = new Version(1, 0); - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 2 - snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - Assert.Same(FallbackRazorConfiguration.MVC_1_0, snapshot.Configuration); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_VersionRemoved_DeinitializesProject() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, new Dictionary>() - { - { "c:\\nuget\\Microsoft.AspNetCore.Mvc.razor.dll", new Dictionary() }, - }), - }, - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager) - { - AssemblyVersion = new Version(2, 0), - }; - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - 1 - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 1 - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - Assert.Same(FallbackRazorConfiguration.MVC_2_0, snapshot.Configuration); - - // Act - 2 - host.AssemblyVersion= null; - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 2 - Assert.Empty(ProjectManager.Projects); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectChanged_AfterDispose_IgnoresUpdate() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, new Dictionary>() - { - { "c:\\nuget\\Microsoft.AspNetCore.Mvc.razor.dll", new Dictionary() }, - }), - }, - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager) - { - AssemblyVersion = new Version(2, 0), - }; - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - 1 - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 1 - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - Assert.Same(FallbackRazorConfiguration.MVC_2_0, snapshot.Configuration); - - // Act - 2 - await Task.Run(async () => await host.DisposeAsync()); - - // Assert - 2 - Assert.Empty(ProjectManager.Projects); - - // Act - 3 - host.AssemblyVersion = new Version(1, 1); - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 3 - Assert.Empty(ProjectManager.Projects); - } - - [ForegroundFact] - public async Task OnProjectRenamed_RemovesHostProject_CopiesConfiguration() - { - // Arrange - var changes = new TestProjectChangeDescription[] - { - new TestProjectChangeDescription() - { - RuleName = ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, - After = TestProjectRuleSnapshot.CreateItems(ManageProjectSystemSchema.ResolvedCompilationReference.SchemaName, new Dictionary>() - { - { "c:\\nuget\\Microsoft.AspNetCore.Mvc.razor.dll", new Dictionary() }, - }), - }, - }; - - var services = new TestProjectSystemServices("Test.csproj"); - - var host = new TestFallbackRazorProjectHost(services, Workspace, ProjectManager) - { - AssemblyVersion = new Version(2, 0), // Mock for reading the assembly's version - }; - - await Task.Run(async () => await host.LoadAsync()); - Assert.Empty(ProjectManager.Projects); - - // Act - 1 - await Task.Run(async () => await host.OnProjectChanged(services.CreateUpdate(changes))); - - // Assert - 1 - var snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test.csproj", snapshot.FilePath); - Assert.Same(FallbackRazorConfiguration.MVC_2_0, snapshot.Configuration); - - // Act - 2 - services.UnconfiguredProject.FullPath = "Test2.csproj"; - await Task.Run(async () => await host.OnProjectRenamingAsync()); - - // Assert - 1 - snapshot = Assert.Single(ProjectManager.Projects); - Assert.Equal("Test2.csproj", snapshot.FilePath); - Assert.Same(FallbackRazorConfiguration.MVC_2_0, snapshot.Configuration); - - await Task.Run(async () => await host.DisposeAsync()); - Assert.Empty(ProjectManager.Projects); - } - - private class TestFallbackRazorProjectHost : FallbackRazorProjectHost - { - internal TestFallbackRazorProjectHost(IUnconfiguredProjectCommonServices commonServices, Workspace workspace, ProjectSnapshotManagerBase projectManager) - : base(commonServices, workspace, projectManager) - { - } - - public Version AssemblyVersion { get; set; } - - protected override Version GetAssemblyVersion(string filePath) - { - return AssemblyVersion; - } - } - - private class TestProjectSnapshotManager : DefaultProjectSnapshotManager - { - public TestProjectSnapshotManager(ForegroundDispatcher dispatcher, Workspace workspace) - : base(dispatcher, Mock.Of(), Mock.Of(), Array.Empty(), workspace) - { - } - - protected override void NotifyBackgroundWorker(ProjectSnapshotUpdateContext context) - { - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotWorkerQueueTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotWorkerQueueTest.cs deleted file mode 100644 index 70ff58db57..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotWorkerQueueTest.cs +++ /dev/null @@ -1,191 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Moq; -using Xunit; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - // These tests are really integration tests. There isn't a good way to unit test this functionality since - // the only thing in here is threading. - public class ProjectSnapshotWorkerQueueTest : ForegroundDispatcherTestBase - { - public ProjectSnapshotWorkerQueueTest() - { - HostProject1 = new HostProject("Test1.csproj", FallbackRazorConfiguration.MVC_1_0); - HostProject2 = new HostProject("Test2.csproj", FallbackRazorConfiguration.MVC_1_0); - - Workspace = TestWorkspace.Create(); - - var projectId1 = ProjectId.CreateNewId("Test1"); - var projectId2 = ProjectId.CreateNewId("Test2"); - - var solution = Workspace.CurrentSolution - .AddProject(ProjectInfo.Create( - projectId1, - VersionStamp.Default, - "Test1", - "Test1", - LanguageNames.CSharp, - "Test1.csproj")) - .AddProject(ProjectInfo.Create( - projectId2, - VersionStamp.Default, - "Test2", - "Test2", - LanguageNames.CSharp, - "Test2.csproj")); ; - - WorkspaceProject1 = solution.GetProject(projectId1); - WorkspaceProject2 = solution.GetProject(projectId2); - } - - private HostProject HostProject1 { get; } - - private HostProject HostProject2 { get; } - - private Project WorkspaceProject1 { get; } - - private Project WorkspaceProject2 { get; } - - private Workspace Workspace { get; } - - [ForegroundFact] - public async Task Queue_ProcessesNotifications_AndGoesBackToSleep() - { - // Arrange - var projectManager = new TestProjectSnapshotManager(Dispatcher, Workspace); - projectManager.HostProjectAdded(HostProject1); - projectManager.HostProjectAdded(HostProject2); - projectManager.WorkspaceProjectAdded(WorkspaceProject1); - projectManager.WorkspaceProjectAdded(WorkspaceProject2); - - var projectWorker = new TestProjectSnapshotWorker(); - - var queue = new ProjectSnapshotWorkerQueue(Dispatcher, projectManager, projectWorker) - { - Delay = TimeSpan.FromMilliseconds(1), - BlockBackgroundWorkStart = new ManualResetEventSlim(initialState: false), - NotifyBackgroundWorkFinish = new ManualResetEventSlim(initialState: false), - NotifyForegroundWorkFinish = new ManualResetEventSlim(initialState: false), - }; - - // Act & Assert - queue.Enqueue(projectManager.GetSnapshot(HostProject1).CreateUpdateContext()); - - Assert.True(queue.IsScheduledOrRunning, "Queue should be scheduled during Enqueue"); - Assert.True(queue.HasPendingNotifications, "Queue should have a notification created during Enqueue"); - - // Allow the background work to proceed. - queue.BlockBackgroundWorkStart.Set(); - - // Get off the foreground thread and allow the updates to flow through. - await Task.Run(() => queue.NotifyForegroundWorkFinish.Wait(TimeSpan.FromSeconds(1))); - - Assert.False(queue.IsScheduledOrRunning, "Queue should not have restarted"); - Assert.False(queue.HasPendingNotifications, "Queue should have processed all notifications"); - } - - [ForegroundFact] - public async Task Queue_ProcessesNotifications_AndRestarts() - { - // Arrange - var projectManager = new TestProjectSnapshotManager(Dispatcher, Workspace); - projectManager.HostProjectAdded(HostProject1); - projectManager.HostProjectAdded(HostProject2); - projectManager.WorkspaceProjectAdded(WorkspaceProject1); - projectManager.WorkspaceProjectAdded(WorkspaceProject2); - - var projectWorker = new TestProjectSnapshotWorker(); - - var queue = new ProjectSnapshotWorkerQueue(Dispatcher, projectManager, projectWorker) - { - Delay = TimeSpan.FromMilliseconds(1), - BlockBackgroundWorkStart = new ManualResetEventSlim(initialState: false), - NotifyBackgroundWorkFinish = new ManualResetEventSlim(initialState: false), - NotifyForegroundWorkFinish = new ManualResetEventSlim(initialState: false), - }; - - // Act & Assert - queue.Enqueue(projectManager.GetSnapshot(HostProject1).CreateUpdateContext()); - - Assert.True(queue.IsScheduledOrRunning, "Queue should be scheduled during Enqueue"); - Assert.True(queue.HasPendingNotifications, "Queue should have a notification created during Enqueue"); - - // Allow the background work to proceed. - queue.BlockBackgroundWorkStart.Set(); - - queue.NotifyBackgroundWorkFinish.Wait(); // Block the foreground thread so we can queue another notification. - - Assert.True(queue.IsScheduledOrRunning, "Worker should be processing now"); - Assert.False(queue.HasPendingNotifications, "Worker should have taken all notifications"); - - queue.Enqueue(projectManager.GetSnapshot(HostProject2).CreateUpdateContext()); - - Assert.True(queue.HasPendingNotifications); // Now we should see the worker restart when it finishes. - - // Get off the foreground thread and allow the updates to flow through. - await Task.Run(() => queue.NotifyForegroundWorkFinish.Wait(TimeSpan.FromSeconds(1))); - - queue.NotifyBackgroundWorkFinish.Reset(); - queue.NotifyForegroundWorkFinish.Reset(); - - // It should start running again right away. - Assert.True(queue.IsScheduledOrRunning, "Queue should be scheduled during Enqueue"); - Assert.True(queue.HasPendingNotifications, "Queue should have a notification created during Enqueue"); - - // Allow the background work to proceed. - queue.BlockBackgroundWorkStart.Set(); - - // Get off the foreground thread and allow the updates to flow through. - await Task.Run(() => queue.NotifyForegroundWorkFinish.Wait(TimeSpan.FromSeconds(1))); - - Assert.False(queue.IsScheduledOrRunning, "Queue should not have restarted"); - Assert.False(queue.HasPendingNotifications, "Queue should have processed all notifications"); - } - - private class TestProjectSnapshotManager : DefaultProjectSnapshotManager - { - public TestProjectSnapshotManager(ForegroundDispatcher foregroundDispatcher, Workspace workspace) - : base(foregroundDispatcher, Mock.Of(), new TestProjectSnapshotWorker(), Enumerable.Empty(), workspace) - { - } - - public DefaultProjectSnapshot GetSnapshot(HostProject hostProject) - { - return Projects.Cast().FirstOrDefault(s => s.FilePath == hostProject.FilePath); - } - - public DefaultProjectSnapshot GetSnapshot(Project workspaceProject) - { - return Projects.Cast().FirstOrDefault(s => s.FilePath == workspaceProject.FilePath); - } - - protected override void NotifyListeners(ProjectChangeEventArgs e) - { - } - - protected override void NotifyBackgroundWorker(ProjectSnapshotUpdateContext context) - { - Assert.NotNull(context.HostProject); - Assert.NotNull(context.WorkspaceProject); - } - } - - private class TestProjectSnapshotWorker : ProjectSnapshotWorker - { - public TestProjectSnapshotWorker() - { - } - - public override Task ProcessUpdateAsync(ProjectSnapshotUpdateContext update, CancellationToken cancellationToken = default(CancellationToken)) - { - return Task.CompletedTask; - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestAssemblyReference.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestAssemblyReference.cs deleted file mode 100644 index b80f5e85ba..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestAssemblyReference.cs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Reflection; -using System.Threading.Tasks; -using Microsoft.VisualStudio.ProjectSystem.Properties; - -namespace Microsoft.VisualStudio.ProjectSystem.References -{ - internal class TestAssemblyReference : IAssemblyReference - { - public AssemblyName AssemblyName { get; set; } - - public string FullPath { get; set; } - - public IProjectProperties Metadata => throw new System.NotImplementedException(); - - public Task GetAssemblyNameAsync() - { - return Task.FromResult(AssemblyName); - } - - public Task GetCopyLocalAsync() - { - throw new System.NotImplementedException(); - } - - public Task GetCopyLocalSatelliteAssembliesAsync() - { - throw new System.NotImplementedException(); - } - - public Task GetDescriptionAsync() - { - throw new System.NotImplementedException(); - } - - public Task GetFullPathAsync() - { - return Task.FromResult(FullPath); - } - - public Task GetNameAsync() - { - throw new System.NotImplementedException(); - } - - public Task GetReferenceOutputAssemblyAsync() - { - throw new System.NotImplementedException(); - } - - public Task GetRequiredTargetFrameworkAsync() - { - throw new System.NotImplementedException(); - } - - public Task GetSpecificVersionAsync() - { - throw new System.NotImplementedException(); - } - - public Task IsWinMDFileAsync() - { - throw new System.NotImplementedException(); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectChangeDescription.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectChangeDescription.cs deleted file mode 100644 index a6aa3b21d5..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectChangeDescription.cs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information - -using Microsoft.VisualStudio.ProjectSystem.Properties; - -namespace Microsoft.VisualStudio.ProjectSystem -{ - internal class TestProjectChangeDescription : IProjectChangeDescription - { - public string RuleName { get; set; } - - public TestProjectRuleSnapshot Before { get; set; } - - public IProjectChangeDiff Difference { get; set; } - - public TestProjectRuleSnapshot After { get; set; } - - IProjectRuleSnapshot IProjectChangeDescription.Before => Before; - - IProjectChangeDiff IProjectChangeDescription.Difference => Difference; - - IProjectRuleSnapshot IProjectChangeDescription.After => After; - } -} \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectRuleSnapshot.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectRuleSnapshot.cs deleted file mode 100644 index 4239470863..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectRuleSnapshot.cs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.VisualStudio.ProjectSystem.Properties; - -namespace Microsoft.VisualStudio.ProjectSystem -{ - internal class TestProjectRuleSnapshot : IProjectRuleSnapshot - { - public static TestProjectRuleSnapshot CreateProperties(string ruleName, Dictionary properties) - { - return new TestProjectRuleSnapshot( - ruleName, - items: ImmutableDictionary>.Empty, - properties: properties.ToImmutableDictionary(), - dataSourceVersions: ImmutableDictionary.Empty); - } - - public static TestProjectRuleSnapshot CreateItems(string ruleName, Dictionary> items) - { - return new TestProjectRuleSnapshot( - ruleName, - items: items.ToImmutableDictionary(kvp => kvp.Key, kvp => (IImmutableDictionary)kvp.Value.ToImmutableDictionary()), - properties: ImmutableDictionary.Empty, - dataSourceVersions: ImmutableDictionary.Empty); - } - - public TestProjectRuleSnapshot( - string ruleName, - IImmutableDictionary> items, - IImmutableDictionary properties, - IImmutableDictionary dataSourceVersions) - { - RuleName = ruleName; - Items = items; - Properties = properties; - DataSourceVersions = dataSourceVersions; - } - - public void SetProperty(string key, string value) - { - Properties = Properties.SetItem(key, value); - } - - public void SetItem(string key, Dictionary values) - { - Items = Items.SetItem(key, values.ToImmutableDictionary()); - } - - public string RuleName { get; } - - public IImmutableDictionary> Items { get; set; } - - public IImmutableDictionary Properties { get; set; } - - public IImmutableDictionary DataSourceVersions { get; } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectSystemServices.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectSystemServices.cs deleted file mode 100644 index 7333883233..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestProjectSystemServices.cs +++ /dev/null @@ -1,862 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using System.Linq; -using System.Reflection; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using System.Threading.Tasks.Dataflow; -using System.Xml; -using Microsoft.Build.Execution; -using Microsoft.Build.Framework; -using Microsoft.Build.Framework.XamlTypes; -using Microsoft.VisualStudio.Composition; -using Microsoft.VisualStudio.ProjectSystem; -using Microsoft.VisualStudio.ProjectSystem.Build; -using Microsoft.VisualStudio.ProjectSystem.Properties; -using Microsoft.VisualStudio.ProjectSystem.References; -using Microsoft.VisualStudio.Threading; -using Moq; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - internal class TestProjectSystemServices : IUnconfiguredProjectCommonServices - { - public TestProjectSystemServices(string fullPath, params TestPropertyData[] data) - { - ProjectService = new TestProjectService(); - ThreadingService = ProjectService.Services.ThreadingPolicy; - - UnconfiguredProject = new TestUnconfiguredProject(ProjectService, fullPath); - ProjectService.LoadedUnconfiguredProjects.Add(UnconfiguredProject); - - ActiveConfiguredProject = new TestConfiguredProject(UnconfiguredProject, data); - UnconfiguredProject.LoadedConfiguredProjects.Add(ActiveConfiguredProject); - - ActiveConfiguredProjectAssemblyReferences = new TestAssemblyReferencesService(); - ActiveConfiguredProjectRazorProperties = new Rules.RazorProjectProperties(ActiveConfiguredProject, UnconfiguredProject); - ActiveConfiguredProjectSubscription = new TestActiveConfiguredProjectSubscriptionService(); - - TasksService = new TestProjectAsynchronousTasksService(ProjectService, UnconfiguredProject, ActiveConfiguredProject); - } - - public TestProjectServices Services { get; } - - public TestProjectService ProjectService { get; } - - public TestUnconfiguredProject UnconfiguredProject { get; } - - public TestConfiguredProject ActiveConfiguredProject { get; } - - public TestAssemblyReferencesService ActiveConfiguredProjectAssemblyReferences { get; } - - public Rules.RazorProjectProperties ActiveConfiguredProjectRazorProperties { get; } - - public TestActiveConfiguredProjectSubscriptionService ActiveConfiguredProjectSubscription { get; } - - public TestProjectAsynchronousTasksService TasksService { get; } - - public TestThreadingService ThreadingService { get; } - - ConfiguredProject IUnconfiguredProjectCommonServices.ActiveConfiguredProject => ActiveConfiguredProject; - - IAssemblyReferencesService IUnconfiguredProjectCommonServices.ActiveConfiguredProjectAssemblyReferences => ActiveConfiguredProjectAssemblyReferences; - - IPackageReferencesService IUnconfiguredProjectCommonServices.ActiveConfiguredProjectPackageReferences => throw new NotImplementedException(); - - Rules.RazorProjectProperties IUnconfiguredProjectCommonServices.ActiveConfiguredProjectRazorProperties => ActiveConfiguredProjectRazorProperties; - - IActiveConfiguredProjectSubscriptionService IUnconfiguredProjectCommonServices.ActiveConfiguredProjectSubscription => ActiveConfiguredProjectSubscription; - - IProjectAsynchronousTasksService IUnconfiguredProjectCommonServices.TasksService => TasksService; - - IProjectThreadingService IUnconfiguredProjectCommonServices.ThreadingService => ThreadingService; - - UnconfiguredProject IUnconfiguredProjectCommonServices.UnconfiguredProject => UnconfiguredProject; - - public IProjectVersionedValue CreateUpdate(params TestProjectChangeDescription[] descriptions) - { - return new ProjectVersionedValue( - value: new ProjectSubscriptionUpdate( - projectChanges: descriptions.ToImmutableDictionary(d => d.RuleName, d => (IProjectChangeDescription)d), - projectConfiguration: ActiveConfiguredProject.ProjectConfiguration), - dataSourceVersions: ImmutableDictionary.Empty); - } - - public class TestProjectServices : IProjectServices - { - public TestProjectServices(TestProjectService projectService) - { - ProjectService = projectService; - ThreadingPolicy = new TestThreadingService(); - } - - public TestProjectService ProjectService { get; } - - public TestThreadingService ThreadingPolicy { get; } - - IProjectLockService IProjectServices.ProjectLockService => throw new NotImplementedException(); - - IProjectThreadingService IProjectServices.ThreadingPolicy => ThreadingPolicy; - - IProjectFaultHandlerService IProjectServices.FaultHandler => throw new NotImplementedException(); - - IProjectReloader IProjectServices.ProjectReloader => throw new NotImplementedException(); - - ExportProvider IProjectCommonServices.ExportProvider => throw new NotImplementedException(); - - IProjectDataSourceRegistry IProjectCommonServices.DataSourceRegistry => throw new NotImplementedException(); - - IProjectService IProjectCommonServices.ProjectService => ProjectService; - - IProjectCapabilitiesScope IProjectCommonServices.Capabilities => throw new NotImplementedException(); - } - - public class TestProjectService : IProjectService - { - public TestProjectService() - { - LoadedUnconfiguredProjects = new List(); - Services = new TestProjectServices(this); - } - - public List LoadedUnconfiguredProjects { get; } - - public TestProjectServices Services { get; } - - IEnumerable IProjectService.LoadedUnconfiguredProjects => throw new NotImplementedException(); - - IProjectServices IProjectService.Services => Services; - - IProjectCapabilitiesScope IProjectService.Capabilities => throw new NotImplementedException(); - - Task IProjectService.LoadProjectAsync(string projectLocation, IImmutableSet projectCapabilities) - { - throw new NotImplementedException(); - } - - Task IProjectService.LoadProjectAsync(XmlReader reader, IImmutableSet projectCapabilities) - { - throw new NotImplementedException(); - } - - Task IProjectService.LoadProjectAsync(string projectLocation, bool delayAutoLoad, IImmutableSet projectCapabilities) - { - throw new NotImplementedException(); - } - - Task IProjectService.UnloadProjectAsync(UnconfiguredProject project) - { - throw new NotImplementedException(); - } - } - - public class TestUnconfiguredProject : UnconfiguredProject - { - public TestUnconfiguredProject(TestProjectService projectService, string fullPath) - { - ProjectService = projectService; - FullPath = fullPath; - - LoadedConfiguredProjects = new List(); - } - - public TestProjectService ProjectService { get; } - - public string FullPath { get; set; } - - public List LoadedConfiguredProjects { get; } - - string UnconfiguredProject.FullPath => FullPath; - bool UnconfiguredProject.RequiresReloadForExternalFileChange => throw new NotImplementedException(); - - IProjectCapabilitiesScope UnconfiguredProject.Capabilities => throw new NotImplementedException(); - - IProjectService UnconfiguredProject.ProjectService => ProjectService; - - IUnconfiguredProjectServices UnconfiguredProject.Services => throw new NotImplementedException(); - - IEnumerable UnconfiguredProject.LoadedConfiguredProjects => LoadedConfiguredProjects; - - bool UnconfiguredProject.IsLoading => throw new NotImplementedException(); - - event AsyncEventHandler UnconfiguredProject.ProjectUnloading - { - add - { - throw new NotImplementedException(); - } - - remove - { - throw new NotImplementedException(); - } - } - - event AsyncEventHandler UnconfiguredProject.ProjectRenaming - { - add - { - } - - remove - { - } - } - - event AsyncEventHandler UnconfiguredProject.ProjectRenamedOnWriter - { - add - { - throw new NotImplementedException(); - } - - remove - { - throw new NotImplementedException(); - } - } - - event AsyncEventHandler UnconfiguredProject.ProjectRenamed - { - add - { - throw new NotImplementedException(); - } - - remove - { - throw new NotImplementedException(); - } - } - - Task UnconfiguredProject.CanRenameAsync(string newFilePath) - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.GetFileEncodingAsync() - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.GetIsDirtyAsync() - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.GetSuggestedConfiguredProjectAsync() - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.LoadConfiguredProjectAsync(string name, IImmutableDictionary configurationProperties) - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.LoadConfiguredProjectAsync(ProjectConfiguration projectConfiguration) - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.ReloadAsync(bool immediately) - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.RenameAsync(string newFilePath) - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.SaveAsync(string filePath) - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.SaveCopyAsync(string filePath, Encoding fileEncoding) - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.SaveUserFileAsync() - { - throw new NotImplementedException(); - } - - Task UnconfiguredProject.SetFileEncodingAsync(Encoding value) - { - throw new NotImplementedException(); - } - } - - public class TestConfiguredProject : ConfiguredProject - { - public TestConfiguredProject(TestUnconfiguredProject unconfiguredProject, TestPropertyData[] data) - { - UnconfiguredProject = unconfiguredProject; - Services = new TestConfiguredProjectServices(this, data); - - ProjectConfiguration = new StandardProjectConfiguration( - "Debug|AnyCPU", - ImmutableDictionary.Empty.Add("Configuration", "Debug").Add("Platform", "AnyCPU")); - } - - public TestUnconfiguredProject UnconfiguredProject { get; } - - public ProjectConfiguration ProjectConfiguration { get; } - - public TestConfiguredProjectServices Services { get; } - - IComparable ConfiguredProject.ProjectVersion => throw new NotImplementedException(); - - IReceivableSourceBlock ConfiguredProject.ProjectVersionBlock => throw new NotImplementedException(); - - ProjectConfiguration ConfiguredProject.ProjectConfiguration => ProjectConfiguration; - - IProjectCapabilitiesScope ConfiguredProject.Capabilities => throw new NotImplementedException(); - - UnconfiguredProject ConfiguredProject.UnconfiguredProject => UnconfiguredProject; - - IConfiguredProjectServices ConfiguredProject.Services => Services; - - event AsyncEventHandler ConfiguredProject.ProjectUnloading - { - add - { - throw new NotImplementedException(); - } - - remove - { - throw new NotImplementedException(); - } - } - - event EventHandler ConfiguredProject.ProjectChanged - { - add - { - throw new NotImplementedException(); - } - - remove - { - throw new NotImplementedException(); - } - } - - event EventHandler ConfiguredProject.ProjectChangedSynchronous - { - add - { - throw new NotImplementedException(); - } - - remove - { - throw new NotImplementedException(); - } - } - - void ConfiguredProject.NotifyProjectChange() - { - throw new NotImplementedException(); - } - } - - public class TestConfiguredProjectServices : IConfiguredProjectServices - { - public TestConfiguredProjectServices(TestConfiguredProject configuredProject, TestPropertyData[] data) - { - ConfiguredProject = configuredProject; - - AdditionalRuleDefinitions = new TestAdditionalRuleDefinitionsService(); - PropertyPagesCatalog = new TestPropertyPagesCatalogProvider(new TestPropertyPagesCatalog(data)); - } - - public TestConfiguredProject ConfiguredProject { get; } - - public TestAdditionalRuleDefinitionsService AdditionalRuleDefinitions { get; } - - public TestPropertyPagesCatalogProvider PropertyPagesCatalog { get; } - - IOutputGroupsService IConfiguredProjectServices.OutputGroups => throw new NotImplementedException(); - - IBuildProject IConfiguredProjectServices.Build => throw new NotImplementedException(); - - IBuildSupport IConfiguredProjectServices.BuildSupport => throw new NotImplementedException(); - - IAssemblyReferencesService IConfiguredProjectServices.AssemblyReferences => throw new NotImplementedException(); - - IComReferencesService IConfiguredProjectServices.ComReferences => throw new NotImplementedException(); - - ISdkReferencesService IConfiguredProjectServices.SdkReferences => throw new NotImplementedException(); - - IPackageReferencesService IConfiguredProjectServices.PackageReferences => throw new NotImplementedException(); - - IWinRTReferencesService IConfiguredProjectServices.WinRTReferences => throw new NotImplementedException(); - - IBuildDependencyProjectReferencesService IConfiguredProjectServices.ProjectReferences => throw new NotImplementedException(); - - IProjectItemProvider IConfiguredProjectServices.SourceItems => throw new NotImplementedException(); - - IProjectPropertiesProvider IConfiguredProjectServices.ProjectPropertiesProvider => throw new NotImplementedException(); - - IProjectPropertiesProvider IConfiguredProjectServices.UserPropertiesProvider => throw new NotImplementedException(); - - IProjectAsynchronousTasksService IConfiguredProjectServices.ProjectAsynchronousTasks => throw new NotImplementedException(); - - IAdditionalRuleDefinitionsService IConfiguredProjectServices.AdditionalRuleDefinitions => AdditionalRuleDefinitions; - - IPropertyPagesCatalogProvider IConfiguredProjectServices.PropertyPagesCatalog => PropertyPagesCatalog; - - IProjectSubscriptionService IConfiguredProjectServices.ProjectSubscription => throw new NotImplementedException(); - - IProjectSnapshotService IConfiguredProjectServices.ProjectSnapshotService => throw new NotImplementedException(); - - object IConfiguredProjectServices.HostObject => throw new NotImplementedException(); - - ExportProvider IProjectCommonServices.ExportProvider => throw new NotImplementedException(); - - IProjectDataSourceRegistry IProjectCommonServices.DataSourceRegistry => throw new NotImplementedException(); - - IProjectService IProjectCommonServices.ProjectService => ConfiguredProject.UnconfiguredProject.ProjectService; - - IProjectCapabilitiesScope IProjectCommonServices.Capabilities => throw new NotImplementedException(); - } - - public class TestAdditionalRuleDefinitionsService : IAdditionalRuleDefinitionsService - { - IProjectVersionedValue IAdditionalRuleDefinitionsService.AdditionalRuleDefinitions => throw new NotImplementedException(); - - IReceivableSourceBlock> IProjectValueDataSource.SourceBlock => throw new NotImplementedException(); - - ISourceBlock> IProjectValueDataSource.SourceBlock => throw new NotImplementedException(); - - NamedIdentity IProjectValueDataSource.DataSourceKey => throw new NotImplementedException(); - - IComparable IProjectValueDataSource.DataSourceVersion => throw new NotImplementedException(); - - bool IAdditionalRuleDefinitionsService.AddRuleDefinition(string path, string context) - { - return false; - } - - bool IAdditionalRuleDefinitionsService.AddRuleDefinition(Rule rule, string context) - { - return false; - } - - IDisposable IJoinableProjectValueDataSource.Join() - { - throw new NotImplementedException(); - } - - bool IAdditionalRuleDefinitionsService.RemoveRuleDefinition(string path) - { - return false; - } - - bool IAdditionalRuleDefinitionsService.RemoveRuleDefinition(Rule rule) - { - return false; - } - } - - public class TestPropertyPagesCatalogProvider : IPropertyPagesCatalogProvider - { - public TestPropertyPagesCatalogProvider(TestPropertyPagesCatalog catalog) - { - Catalog = catalog; - CatalogsByContext = new Dictionary() - { - { "Project", catalog }, - }; - } - - public TestPropertyPagesCatalog Catalog { get; } - - public Dictionary CatalogsByContext { get; } - - public IReceivableSourceBlock> SourceBlock => throw new NotImplementedException(); - - public NamedIdentity DataSourceKey => throw new NotImplementedException(); - - public IComparable DataSourceVersion => throw new NotImplementedException(); - - ISourceBlock> IProjectValueDataSource.SourceBlock => throw new NotImplementedException(); - - public Task GetCatalogAsync(string name, CancellationToken cancellationToken = default) - { - return Task.FromResult(CatalogsByContext[name]); - } - - public Task> GetCatalogsAsync(CancellationToken cancellationToken = default) - { - return Task.FromResult>(CatalogsByContext.ToImmutableDictionary()); - } - - public IPropertyPagesCatalog GetMemoryOnlyCatalog(string context) - { - return Catalog; - } - - public IDisposable Join() - { - throw new NotImplementedException(); - } - } - - public class TestActiveConfiguredProjectSubscriptionService : IActiveConfiguredProjectSubscriptionService - { - public TestActiveConfiguredProjectSubscriptionService() - { - JointRuleBlock = new BufferBlock>(); - JointRuleSource = new TestProjectValueDataSource(JointRuleBlock); - } - - public BufferBlock> JointRuleBlock { get; } - - public TestProjectValueDataSource JointRuleSource { get; } - - IReceivableSourceBlock> IProjectSubscriptionService.ProjectBlock => throw new NotImplementedException(); - - IProjectValueDataSource IProjectSubscriptionService.ProjectSource => throw new NotImplementedException(); - - IProjectValueDataSource IProjectSubscriptionService.ImportTreeSource => throw new NotImplementedException(); - - IProjectValueDataSource IProjectSubscriptionService.SharedFoldersSource => throw new NotImplementedException(); - - IProjectValueDataSource> IProjectSubscriptionService.OutputGroupsSource => throw new NotImplementedException(); - - IReceivableSourceBlock> IProjectSubscriptionService.ProjectCatalogBlock => throw new NotImplementedException(); - - IProjectValueDataSource IProjectSubscriptionService.ProjectCatalogSource => throw new NotImplementedException(); - - IReceivableSourceBlock> IProjectSubscriptionService.ProjectRuleBlock => throw new NotImplementedException(); - - IProjectValueDataSource IProjectSubscriptionService.ProjectRuleSource => throw new NotImplementedException(); - - IReceivableSourceBlock> IProjectSubscriptionService.ProjectBuildRuleBlock => throw new NotImplementedException(); - - IProjectValueDataSource IProjectSubscriptionService.ProjectBuildRuleSource => throw new NotImplementedException(); - - ISourceBlock> IProjectSubscriptionService.JointRuleBlock => JointRuleBlock; - - IProjectValueDataSource IProjectSubscriptionService.JointRuleSource => JointRuleSource; - - IReceivableSourceBlock> IProjectSubscriptionService.SourceItemsRuleBlock => throw new NotImplementedException(); - - IProjectValueDataSource IProjectSubscriptionService.SourceItemsRuleSource => throw new NotImplementedException(); - - IReceivableSourceBlock>> IProjectSubscriptionService.SourceItemRuleNamesBlock => throw new NotImplementedException(); - - IProjectValueDataSource> IProjectSubscriptionService.SourceItemRuleNamesSource => throw new NotImplementedException(); - } - - public class TestProjectValueDataSource : IProjectValueDataSource - { - public TestProjectValueDataSource(BufferBlock> sourceBlock) - { - SourceBlock = sourceBlock; - } - - public BufferBlock> SourceBlock { get; } - - IReceivableSourceBlock> IProjectValueDataSource.SourceBlock => SourceBlock; - - ISourceBlock> IProjectValueDataSource.SourceBlock => throw new NotImplementedException(); - - NamedIdentity IProjectValueDataSource.DataSourceKey => throw new NotImplementedException(); - - IComparable IProjectValueDataSource.DataSourceVersion => throw new NotImplementedException(); - - IDisposable IJoinableProjectValueDataSource.Join() - { - throw new NotImplementedException(); - } - } - - public class TestPropertyPagesCatalog : IPropertyPagesCatalog - { - private readonly Dictionary _data; - - public TestPropertyPagesCatalog(TestPropertyData[] data) - { - _data = new Dictionary(); - foreach (var category in data.GroupBy(p => p.Category)) - { - _data.Add( - category.Key, - CreateRule(category.Select(property => CreateProperty(property.PropertyName, property.Value, property.SetValues)))); - } - } - - private static IRule CreateRule(IEnumerable properties) - { - var rule = new Mock(); - rule - .Setup(o => o.GetProperty(It.IsAny())) - .Returns((string propertyName) => - { - - return properties.FirstOrDefault(p => p.Name == propertyName); - }); - - return rule.Object; - } - - private static IProperty CreateProperty(string name, object value, List setValues = null) - { - var property = new Mock(); - property.SetupGet(o => o.Name) - .Returns(name); - - property.Setup(o => o.GetValueAsync()) - .ReturnsAsync(value); - - property.As().Setup(p => p.GetEvaluatedValueAtEndAsync()).ReturnsAsync(value.ToString()); - property.As().Setup(p => p.GetEvaluatedValueAsync()).ReturnsAsync(value.ToString()); - - if (setValues != null) - { - property - .Setup(p => p.SetValueAsync(It.IsAny())) - .Callback(obj => setValues.Add(obj)) - .Returns(() => Task.CompletedTask); - } - - return property.Object; - } - - IRule IPropertyPagesCatalog.BindToContext(string schemaName, string file, string itemType, string itemName) - { - _data.TryGetValue(schemaName, out var value); - return value; - } - - IRule IPropertyPagesCatalog.BindToContext(string schemaName, IProjectPropertiesContext context) - { - throw new NotImplementedException(); - } - - IRule IPropertyPagesCatalog.BindToContext(string schemaName, ProjectInstance projectInstance, string itemType, string itemName) - { - throw new NotImplementedException(); - } - - IRule IPropertyPagesCatalog.BindToContext(string schemaName, ProjectInstance projectInstance, ITaskItem taskItem) - { - throw new NotImplementedException(); - } - - IReadOnlyCollection IPropertyPagesCatalog.GetProjectLevelPropertyPagesSchemas() - { - throw new NotImplementedException(); - } - - IReadOnlyCollection IPropertyPagesCatalog.GetPropertyPagesSchemas() - { - throw new NotImplementedException(); - } - - IReadOnlyCollection IPropertyPagesCatalog.GetPropertyPagesSchemas(string itemType) - { - throw new NotImplementedException(); - } - - IReadOnlyCollection IPropertyPagesCatalog.GetPropertyPagesSchemas(IEnumerable paths) - { - throw new NotImplementedException(); - } - - Rule IPropertyPagesCatalog.GetSchema(string schemaName) - { - throw new NotImplementedException(); - } - } - - public class TestAssemblyReferencesService : IAssemblyReferencesService - { - public TestAssemblyReferencesService() - { - ResolvedReferences = new List(); - } - - public List ResolvedReferences { get; } - - Task> IAssemblyReferencesService.AddAsync(AssemblyName assemblyName, string assemblyPath) - { - throw new NotImplementedException(); - } - - Task IAssemblyReferencesService.CanResolveAsync(AssemblyName assemblyName, string assemblyPath) - { - throw new NotImplementedException(); - } - - Task IAssemblyReferencesService.ContainsAsync(AssemblyName assemblyName, string assemblyPath) - { - throw new NotImplementedException(); - } - - Task IAssemblyReferencesService.GetResolvedReferenceAsync(AssemblyName assemblyName, string assemblyPath) - { - throw new NotImplementedException(); - } - - Task IResolvableReferencesService.GetResolvedReferenceAsync(IUnresolvedAssemblyReference unresolvedReference) - { - throw new NotImplementedException(); - } - - Task> IResolvableReferencesService.GetResolvedReferencesAsync() - { - return Task.FromResult>(ResolvedReferences.ToImmutableHashSet()); - } - - Task IAssemblyReferencesService.GetUnresolvedReferenceAsync(AssemblyName assemblyName, string assemblyPath) - { - throw new NotImplementedException(); - } - - Task IResolvableReferencesService.GetUnresolvedReferenceAsync(IAssemblyReference resolvedReference) - { - throw new NotImplementedException(); - } - - Task> IResolvableReferencesService.GetUnresolvedReferencesAsync() - { - throw new NotImplementedException(); - } - - Task IAssemblyReferencesService.RemoveAsync(AssemblyName assemblyName, string assemblyPath) - { - throw new NotImplementedException(); - } - - Task IResolvableReferencesService.RemoveAsync(IUnresolvedAssemblyReference reference) - { - throw new NotImplementedException(); - } - - Task IResolvableReferencesService.RemoveAsync(IEnumerable references) - { - throw new NotImplementedException(); - } - } - - public class TestProjectAsynchronousTasksService : IProjectAsynchronousTasksService, IProjectContext - { - public CancellationToken UnloadCancellationToken => CancellationToken.None; - - public TestProjectAsynchronousTasksService( - IProjectService projectService, - UnconfiguredProject unconfiguredProject, - ConfiguredProject configuredProject) - { - ProjectService = projectService; - UnconfiguredProject = unconfiguredProject; - ConfiguredProject = configuredProject; - } - - public IProjectService ProjectService { get; } - - public UnconfiguredProject UnconfiguredProject { get; } - - public ConfiguredProject ConfiguredProject { get; } - - public Task DrainCriticalTaskQueueAsync(bool drainCurrentQueueOnly = false, bool throwExceptions = false, CancellationToken cancellationToken = default) - { - throw new NotImplementedException(); - } - - public Task DrainTaskQueueAsync(bool drainCurrentQueueOnly = false, bool throwExceptions = false, CancellationToken cancellationToken = default) - { - throw new NotImplementedException(); - } - - public Task DrainTaskQueueAsync(ProjectCriticalOperation operation, bool drainCurrentQueueOnly = false, bool throwExceptions = false, CancellationToken cancellationToken = default) - { - throw new NotImplementedException(); - } - - public bool IsTaskQueueEmpty(ProjectCriticalOperation projectCriticalOperation) - { - throw new NotImplementedException(); - } - - public void RegisterAsyncTask(JoinableTask joinableTask, bool registerFaultHandler = false) - { - } - - public void RegisterAsyncTask(Task task, bool registerFaultHandler = false) - { - } - - public void RegisterAsyncTask(JoinableTask joinableTask, ProjectCriticalOperation operationFlags, bool registerFaultHandler = false) - { - } - - public void RegisterCriticalAsyncTask(JoinableTask joinableTask, bool registerFaultHandler = false) - { - } - } - - public class TestThreadingService : IProjectThreadingService - { - public TestThreadingService() - { - JoinableTaskContext = new JoinableTaskContextNode(new JoinableTaskContext()); - JoinableTaskFactory = new JoinableTaskFactory(JoinableTaskContext.Context); - } - - public JoinableTaskContextNode JoinableTaskContext { get; } - - public JoinableTaskFactory JoinableTaskFactory { get; } - - public bool IsOnMainThread => throw new NotImplementedException(); - - public void ExecuteSynchronously(Func asyncAction) - { - asyncAction().GetAwaiter().GetResult(); - } - - public T ExecuteSynchronously(Func> asyncAction) - { - return asyncAction().GetAwaiter().GetResult(); - } - - public void Fork( - Func asyncAction, - JoinableTaskFactory factory = null, - UnconfiguredProject unconfiguredProject = null, - ConfiguredProject configuredProject = null, - ErrorReportSettings watsonReportSettings = null, - ProjectFaultSeverity faultSeverity = ProjectFaultSeverity.Recoverable, - ForkOptions options = ForkOptions.Default) - { - throw new NotImplementedException(); - } - - public IDisposable SuppressProjectExecutionContext() - { - throw new NotImplementedException(); - } - - public void VerifyOnUIThread() - { - if (!JoinableTaskContext.IsOnMainThread) - { - throw new InvalidOperationException("This isn't the main thread."); - } - } - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestPropertyData.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestPropertyData.cs deleted file mode 100644 index c2b3fb24c5..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/TestPropertyData.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem -{ - public class TestPropertyData - { - public string Category { get; set; } - - public string PropertyName { get; set; } - - public object Value { get; set; } - - public List SetValues { get; set; } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/ProjectSnapshotHandleSerializationTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/ProjectSnapshotHandleSerializationTest.cs deleted file mode 100644 index 347c533f8a..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/ProjectSnapshotHandleSerializationTest.cs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Serialization -{ - public class ProjectSnapshotHandleSerializationTest - { - public ProjectSnapshotHandleSerializationTest() - { - var converters = new JsonConverterCollection(); - converters.RegisterRazorConverters(); - Converters = converters.ToArray(); - } - - public JsonConverter[] Converters { get; } - - [Fact] - public void ProjectSnapshotHandleJsonConverter_Serialization_CanKindaRoundTrip() - { - // Arrange - var snapshot = new ProjectSnapshotHandle( - "Test.csproj", - new ProjectSystemRazorConfiguration( - RazorLanguageVersion.Version_1_1, - "Test", - new[] - { - new ProjectSystemRazorExtension("Test-Extension1"), - new ProjectSystemRazorExtension("Test-Extension2"), - }), - ProjectId.CreateFromSerialized(Guid.NewGuid(), "Test")); - - // Act - var json = JsonConvert.SerializeObject(snapshot, Converters); - var obj = JsonConvert.DeserializeObject(json, Converters); - - // Assert - Assert.Equal(snapshot.FilePath, obj.FilePath); - Assert.Equal(snapshot.Configuration.ConfigurationName, obj.Configuration.ConfigurationName); - Assert.Collection( - snapshot.Configuration.Extensions, - e => Assert.Equal("Test-Extension1", e.ExtensionName), - e => Assert.Equal("Test-Extension2", e.ExtensionName)); - Assert.Equal(snapshot.Configuration.LanguageVersion, obj.Configuration.LanguageVersion); - Assert.Equal(snapshot.WorkspaceProjectId.Id, obj.WorkspaceProjectId.Id); - } - - [Fact] - public void ProjectSnapshotHandleJsonConverter_SerializationWithNulls_CanKindaRoundTrip() - { - // Arrange - var snapshot = new ProjectSnapshotHandle("Test.csproj", null, null); - - // Act - var json = JsonConvert.SerializeObject(snapshot, Converters); - var obj = JsonConvert.DeserializeObject(json, Converters); - - // Assert - Assert.Equal(snapshot.FilePath, obj.FilePath); - Assert.Null(obj.Configuration); - Assert.Null(obj.WorkspaceProjectId); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/RazorConfigurationSerializationTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/RazorConfigurationSerializationTest.cs deleted file mode 100644 index 2b084a8531..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/RazorConfigurationSerializationTest.cs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Serialization -{ - public class RazorConfigurationSerializationTest - { - public RazorConfigurationSerializationTest() - { - var converters = new JsonConverterCollection(); - converters.RegisterRazorConverters(); - Converters = converters.ToArray(); - } - - public JsonConverter[] Converters { get; } - - [Fact] - public void RazorConfigurationJsonConverter_Serialization_CanRoundTrip() - { - // Arrange - var configuration = new ProjectSystemRazorConfiguration( - RazorLanguageVersion.Version_1_1, - "Test", - new[] - { - new ProjectSystemRazorExtension("Test-Extension1"), - new ProjectSystemRazorExtension("Test-Extension2"), - }); - - // Act - var json = JsonConvert.SerializeObject(configuration, Converters); - var obj = JsonConvert.DeserializeObject(json, Converters); - - // Assert - Assert.Equal(configuration.ConfigurationName, obj.ConfigurationName); - Assert.Collection( - configuration.Extensions, - e => Assert.Equal("Test-Extension1", e.ExtensionName), - e => Assert.Equal("Test-Extension2", e.ExtensionName)); - Assert.Equal(configuration.LanguageVersion, obj.LanguageVersion); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/RazorExtensionSerializationTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/RazorExtensionSerializationTest.cs deleted file mode 100644 index 0f93fb5bd7..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/RazorExtensionSerializationTest.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.VisualStudio.LanguageServices.Razor.Serialization -{ - public class RazorExtensionSerializationTest - { - public RazorExtensionSerializationTest() - { - var converters = new JsonConverterCollection(); - converters.RegisterRazorConverters(); - Converters = converters.ToArray(); - } - - public JsonConverter[] Converters { get; } - - [Fact] - public void RazorExensionJsonConverter_Serialization_CanRoundTrip() - { - // Arrange - var extension = new ProjectSystemRazorExtension("Test"); - - // Act - var json = JsonConvert.SerializeObject(extension, Converters); - var obj = JsonConvert.DeserializeObject(json, Converters); - - // Assert - Assert.Equal(extension.ExtensionName, obj.ExtensionName); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/TagHelperDescriptorSerializationTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/TagHelperDescriptorSerializationTest.cs deleted file mode 100644 index 9427f77e32..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Serialization/TagHelperDescriptorSerializationTest.cs +++ /dev/null @@ -1,237 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using Microsoft.AspNetCore.Mvc.Razor.Extensions; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.VisualStudio.LanguageServices.Razor.Serialization; -using Newtonsoft.Json; -using Xunit; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - public class TagHelperDescriptorSerializationTest - { - [Fact] - public void TagHelperDescriptor_RoundTripsProperly() - { - // Arrange - var expectedDescriptor = CreateTagHelperDescriptor( - kind: TagHelperConventions.DefaultKind, - tagName: "tag-name", - typeName: "type name", - assemblyName: "assembly name", - attributes: new Action[] - { - builder => builder - .Name("test-attribute") - .PropertyName("TestAttribute") - .TypeName("string"), - }, - ruleBuilders: new Action[] - { - builder => builder - .RequireAttributeDescriptor(attribute => attribute - .Name("required-attribute-one") - .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch)) - .RequireAttributeDescriptor(attribute => attribute - .Name("required-attribute-two") - .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.FullMatch) - .Value("something") - .ValueComparisonMode(RequiredAttributeDescriptor.ValueComparisonMode.PrefixMatch)) - .RequireParentTag("parent-name") - .RequireTagStructure(TagStructure.WithoutEndTag), - }, - configureAction: builder => - { - builder.AllowChildTag("allowed-child-one"); - builder.AddMetadata("foo", "bar"); - }); - - // Act - var serializedDescriptor = JsonConvert.SerializeObject(expectedDescriptor, TagHelperDescriptorJsonConverter.Instance, RazorDiagnosticJsonConverter.Instance); - var descriptor = JsonConvert.DeserializeObject(serializedDescriptor, TagHelperDescriptorJsonConverter.Instance, RazorDiagnosticJsonConverter.Instance); - - // Assert - Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default); - } - - [Fact] - public void ViewComponentTagHelperDescriptor_RoundTripsProperly() - { - // Arrange - var expectedDescriptor = CreateTagHelperDescriptor( - kind: ViewComponentTagHelperConventions.Kind, - tagName: "tag-name", - typeName: "type name", - assemblyName: "assembly name", - attributes: new Action[] - { - builder => builder - .Name("test-attribute") - .PropertyName("TestAttribute") - .TypeName("string"), - }, - ruleBuilders: new Action[] - { - builder => builder - .RequireAttributeDescriptor(attribute => attribute - .Name("required-attribute-one") - .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch)) - .RequireAttributeDescriptor(attribute => attribute - .Name("required-attribute-two") - .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.FullMatch) - .Value("something") - .ValueComparisonMode(RequiredAttributeDescriptor.ValueComparisonMode.PrefixMatch)) - .RequireParentTag("parent-name") - .RequireTagStructure(TagStructure.WithoutEndTag), - }, - configureAction: builder => - { - builder.AllowChildTag("allowed-child-one"); - builder.AddMetadata("foo", "bar"); - }); - - // Act - var serializedDescriptor = JsonConvert.SerializeObject(expectedDescriptor, TagHelperDescriptorJsonConverter.Instance, RazorDiagnosticJsonConverter.Instance); - var descriptor = JsonConvert.DeserializeObject(serializedDescriptor, TagHelperDescriptorJsonConverter.Instance, RazorDiagnosticJsonConverter.Instance); - - // Assert - Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default); - } - - [Fact] - public void TagHelperDescriptor_WithDiagnostic_RoundTripsProperly() - { - // Arrange - var expectedDescriptor = CreateTagHelperDescriptor( - kind: TagHelperConventions.DefaultKind, - tagName: "tag-name", - typeName: "type name", - assemblyName: "assembly name", - attributes: new Action[] - { - builder => builder - .Name("test-attribute") - .PropertyName("TestAttribute") - .TypeName("string"), - }, - ruleBuilders: new Action[] - { - builder => builder - .RequireAttributeDescriptor(attribute => attribute - .Name("required-attribute-one") - .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch)) - .RequireAttributeDescriptor(attribute => attribute - .Name("required-attribute-two") - .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.FullMatch) - .Value("something") - .ValueComparisonMode(RequiredAttributeDescriptor.ValueComparisonMode.PrefixMatch)) - .RequireParentTag("parent-name"), - }, - configureAction: builder => - { - builder.AllowChildTag("allowed-child-one") - .AddMetadata("foo", "bar") - .AddDiagnostic(RazorDiagnostic.Create( - new RazorDiagnosticDescriptor("id", () => "Test Message", RazorDiagnosticSeverity.Error), new SourceSpan(null, 10, 20, 30, 40))); - }); - - // Act - var serializedDescriptor = JsonConvert.SerializeObject(expectedDescriptor, TagHelperDescriptorJsonConverter.Instance, RazorDiagnosticJsonConverter.Instance); - var descriptor = JsonConvert.DeserializeObject(serializedDescriptor, TagHelperDescriptorJsonConverter.Instance, RazorDiagnosticJsonConverter.Instance); - - // Assert - Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default); - } - - [Fact] - public void TagHelperDescriptor_WithIndexerAttributes_RoundTripsProperly() - { - // Arrange - var expectedDescriptor = CreateTagHelperDescriptor( - kind: TagHelperConventions.DefaultKind, - tagName: "tag-name", - typeName: "type name", - assemblyName: "assembly name", - attributes: new Action[] - { - builder => builder - .Name("test-attribute") - .PropertyName("TestAttribute") - .TypeName("SomeEnum") - .AsEnum() - .Documentation("Summary"), - builder => builder - .Name("test-attribute2") - .PropertyName("TestAttribute2") - .TypeName("SomeDictionary") - .AsDictionaryAttribute("dict-prefix-", "string"), - }, - ruleBuilders: new Action[] - { - builder => builder - .RequireAttributeDescriptor(attribute => attribute - .Name("required-attribute-one") - .NameComparisonMode(RequiredAttributeDescriptor.NameComparisonMode.PrefixMatch)) - }, - configureAction: builder => - { - builder - .AllowChildTag("allowed-child-one") - .AddMetadata("foo", "bar") - .TagOutputHint("Hint"); - }); - - // Act - var serializedDescriptor = JsonConvert.SerializeObject(expectedDescriptor, TagHelperDescriptorJsonConverter.Instance, RazorDiagnosticJsonConverter.Instance); - var descriptor = JsonConvert.DeserializeObject(serializedDescriptor, TagHelperDescriptorJsonConverter.Instance, RazorDiagnosticJsonConverter.Instance); - - // Assert - Assert.Equal(expectedDescriptor, descriptor, TagHelperDescriptorComparer.Default); - } - - private static TagHelperDescriptor CreateTagHelperDescriptor( - string kind, - string tagName, - string typeName, - string assemblyName, - IEnumerable> attributes = null, - IEnumerable> ruleBuilders = null, - Action configureAction = null) - { - var builder = TagHelperDescriptorBuilder.Create(kind, typeName, assemblyName); - builder.SetTypeName(typeName); - - if (attributes != null) - { - foreach (var attributeBuilder in attributes) - { - builder.BoundAttributeDescriptor(attributeBuilder); - } - } - - if (ruleBuilders != null) - { - foreach (var ruleBuilder in ruleBuilders) - { - builder.TagMatchingRuleDescriptor(innerRuleBuilder => { - innerRuleBuilder.RequireTagName(tagName); - ruleBuilder(innerRuleBuilder); - }); - } - } - else - { - builder.TagMatchingRuleDescriptor(ruleBuilder => ruleBuilder.RequireTagName(tagName)); - } - - configureAction?.Invoke(builder); - - var descriptor = builder.Build(); - - return descriptor; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/VsSolutionUpdatesProjectSnapshotChangeTriggerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/VsSolutionUpdatesProjectSnapshotChangeTriggerTest.cs deleted file mode 100644 index 726891e0a9..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/VsSolutionUpdatesProjectSnapshotChangeTriggerTest.cs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Shell.Interop; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.LanguageServices.Razor -{ - public class VsSolutionUpdatesProjectSnapshotChangeTriggerTest - { - [Fact] - public void Initialize_AttachesEventSink() - { - // Arrange - uint cookie; - var buildManager = new Mock(MockBehavior.Strict); - buildManager - .Setup(b => b.AdviseUpdateSolutionEvents(It.IsAny(), out cookie)) - .Returns(VSConstants.S_OK) - .Verifiable(); - - var services = new Mock(); - services.Setup(s => s.GetService(It.Is(f => f == typeof(SVsSolutionBuildManager)))).Returns(buildManager.Object); - - var trigger = new VsSolutionUpdatesProjectSnapshotChangeTrigger(services.Object, Mock.Of()); - - // Act - trigger.Initialize(Mock.Of()); - - // Assert - buildManager.Verify(); - } - - [Fact] - public void UpdateProjectCfg_Done_KnownProject_Invokes_ProjectBuildComplete() - { - // Arrange - var expectedProjectPath = "Path/To/Project"; - - uint cookie; - var buildManager = new Mock(MockBehavior.Strict); - buildManager - .Setup(b => b.AdviseUpdateSolutionEvents(It.IsAny(), out cookie)) - .Returns(VSConstants.S_OK); - - var services = new Mock(); - services.Setup(s => s.GetService(It.Is(f => f == typeof(SVsSolutionBuildManager)))).Returns(buildManager.Object); - - var projectService = new Mock(); - projectService.Setup(p => p.GetProjectPath(It.IsAny())).Returns(expectedProjectPath); - - var projectSnapshots = new[] - { - Mock.Of(p => p.FilePath == expectedProjectPath && p.HostProject == new HostProject(expectedProjectPath, RazorConfiguration.Default)), - Mock.Of(p => p.FilePath == "Test2.csproj" && p.HostProject == new HostProject("Test2.csproj", RazorConfiguration.Default)), - }; - - var called = false; - var projectManager = new Mock(); - projectManager.SetupGet(p => p.Projects).Returns(projectSnapshots); - projectManager - .Setup(p => p.HostProjectBuildComplete(It.IsAny())) - .Callback(c => - { - called = true; - Assert.Equal(expectedProjectPath, c.FilePath); - }); - - var trigger = new VsSolutionUpdatesProjectSnapshotChangeTrigger(services.Object, projectService.Object); - trigger.Initialize(projectManager.Object); - - // Act - trigger.UpdateProjectCfg_Done(Mock.Of(), Mock.Of(), Mock.Of(), 0, 0, 0); - - // Assert - Assert.True(called); - } - - [Fact] - public void UpdateProjectCfg_Done_UnknownProject_DoesNotInvoke_ProjectBuildComplete() - { - // Arrange - var expectedProjectPath = "Path/To/Project"; - - uint cookie; - var buildManager = new Mock(MockBehavior.Strict); - buildManager - .Setup(b => b.AdviseUpdateSolutionEvents(It.IsAny(), out cookie)) - .Returns(VSConstants.S_OK); - - var services = new Mock(); - services.Setup(s => s.GetService(It.Is(f => f == typeof(SVsSolutionBuildManager)))).Returns(buildManager.Object); - - var projectService = new Mock(); - projectService.Setup(p => p.GetProjectPath(It.IsAny())).Returns(expectedProjectPath); - - var projectSnapshots = new[] - { - Mock.Of(p => p.FilePath == "Path/To/AnotherProject" && p.HostProject == new HostProject("Path/To/AnotherProject", RazorConfiguration.Default)), - Mock.Of(p => p.FilePath == "Path/To/DifferenProject" && p.HostProject == new HostProject("Path/To/DifferenProject", RazorConfiguration.Default)), - }; - - var projectManager = new Mock(); - projectManager.SetupGet(p => p.Projects).Returns(projectSnapshots); - projectManager - .Setup(p => p.HostProjectBuildComplete(It.IsAny())) - .Callback(c => - { - throw new InvalidOperationException("This should not be called."); - }); - - var trigger = new VsSolutionUpdatesProjectSnapshotChangeTrigger(services.Object, projectService.Object); - trigger.Initialize(projectManager.Object); - - // Act & Assert - Does not throw - trigger.UpdateProjectCfg_Done(Mock.Of(), Mock.Of(), Mock.Of(), 0, 0, 0); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/xunit.runner.json b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/xunit.runner.json deleted file mode 100644 index c04bb61fe6..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/xunit.runner.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "methodDisplay": "method", - "shadowCopy": false -} \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultDotNetProjectHostTest.cs b/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultDotNetProjectHostTest.cs deleted file mode 100644 index b2a55f7cf4..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultDotNetProjectHostTest.cs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.Editor.Razor; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - public class DefaultDotNetProjectHostTest : ForegroundDispatcherTestBase - { - [Fact] - public void UpdateRazorHostProject_UnsupportedProjectNoops() - { - // Arrange - var projectService = new Mock(); - projectService.Setup(p => p.IsSupportedProject(It.IsAny())) - .Returns(false); - var dotNetProjectHost = new DefaultDotNetProjectHost( - Dispatcher, - Mock.Of(), - projectService.Object); - - // Act & Assert - dotNetProjectHost.UpdateRazorHostProject(); - } - - // ------------------------------------------------------------------------------------------- - // Purposefully do not have any more tests here because that would involve mocking MonoDevelop - // types. The default constructors for the Solution / DotNetProject MonoDevelop types change - // static classes (they assume they're being created in an IDE). - // ------------------------------------------------------------------------------------------- - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultFileChangeTrackerTest.cs b/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultFileChangeTrackerTest.cs deleted file mode 100644 index a605ae7258..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultFileChangeTrackerTest.cs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Editor.Razor; -using MonoDevelop.Core; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - public class DefaultFileChangeTrackerTest : ForegroundDispatcherTestBase - { - [ForegroundFact] - public void StartListening_AdvisesForFileChange() - { - // Arrange - var tracker = new TestFileChangeTracker("C:/_ViewImports.cshtml", Dispatcher); - - // Act - tracker.StartListening(); - - // Assert - Assert.Equal(1, tracker.AttachToFileServiceEventsCount); - } - - [ForegroundFact] - public void StartListening_AlreadyListening_DoesNothing() - { - // Arrange - var tracker = new TestFileChangeTracker("C:/_ViewImports.cshtml", Dispatcher); - tracker.StartListening(); - - // Act - tracker.StartListening(); - - // Assert - Assert.Equal(1, tracker.AttachToFileServiceEventsCount); - } - - [ForegroundFact] - public void StopListening_UnadvisesForFileChange() - { - // Arrange - var tracker = new TestFileChangeTracker("C:/_ViewImports.cshtml", Dispatcher); - tracker.StartListening(); // Start listening for changes. - - // Act - tracker.StopListening(); - - // Assert - Assert.Equal(1, tracker.AttachToFileServiceEventsCount); - Assert.Equal(1, tracker.DetachFromFileServiceEventsCount); - } - - [ForegroundFact] - public void StopListening_NotListening_DoesNothing() - { - // Arrange - var tracker = new TestFileChangeTracker("C:/_ViewImports.cshtml", Dispatcher); - - // Act - tracker.StopListening(); - - // Assert - - Assert.Equal(0, tracker.AttachToFileServiceEventsCount); - Assert.Equal(0, tracker.DetachFromFileServiceEventsCount); - } - - private class TestFileChangeTracker : DefaultFileChangeTracker - { - public TestFileChangeTracker( - string filePath, - ForegroundDispatcher foregroundDispatcher) : base(filePath, foregroundDispatcher) - { - } - - public int AttachToFileServiceEventsCount { get; private set; } - - public int DetachFromFileServiceEventsCount { get; private set; } - - protected override void AttachToFileServiceEvents() => AttachToFileServiceEventsCount++; - - protected override void DetachFromFileServiceEvents() => DetachFromFileServiceEventsCount++; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultRazorProjectHostTest.cs b/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultRazorProjectHostTest.cs deleted file mode 100644 index 4a02ccad17..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultRazorProjectHostTest.cs +++ /dev/null @@ -1,470 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language; -using MonoDevelop.Projects.MSBuild; -using Xunit; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - public class DefaultRazorProjectHostTest - { - [Fact] - public void TryGetDefaultConfiguration_FailsIfNoConfiguration() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - - // Act - var result = DefaultRazorProjectHost.TryGetDefaultConfiguration(projectProperties, out var defaultConfiguration); - - // Assert - Assert.False(result); - Assert.Null(defaultConfiguration); - } - - [Fact] - public void TryGetDefaultConfiguration_FailsIfEmptyConfiguration() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorDefaultConfiguration", string.Empty); - - // Act - var result = DefaultRazorProjectHost.TryGetDefaultConfiguration(projectProperties, out var defaultConfiguration); - - // Assert - Assert.False(result); - Assert.Null(defaultConfiguration); - } - - [Fact] - public void TryGetDefaultConfiguration_SucceedsWithValidConfiguration() - { - // Arrange - var expectedConfiguration = "Razor-13.37"; - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorDefaultConfiguration", expectedConfiguration); - - // Act - var result = DefaultRazorProjectHost.TryGetDefaultConfiguration(projectProperties, out var defaultConfiguration); - - // Assert - Assert.True(result); - Assert.Equal(expectedConfiguration, defaultConfiguration); - } - - [Fact] - public void TryGetLanguageVersion_FailsIfNoLanguageVersion() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectProperties, out var languageVersion); - - // Assert - Assert.False(result); - Assert.Null(languageVersion); - } - - [Fact] - public void TryGetLanguageVersion_FailsIfEmptyLanguageVersion() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorLangVersion", string.Empty); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectProperties, out var languageVersion); - - // Assert - Assert.False(result); - Assert.Null(languageVersion); - } - - [Fact] - public void TryGetLanguageVersion_SucceedsWithValidLanguageVersion() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorLangVersion", "1.0"); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectProperties, out var languageVersion); - - // Assert - Assert.True(result); - Assert.Same(RazorLanguageVersion.Version_1_0, languageVersion); - } - - [Fact] - public void TryGetLanguageVersion_SucceedsWithUnknownLanguageVersion_DefaultsToLatest() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorLangVersion", "13.37"); - - // Act - var result = DefaultRazorProjectHost.TryGetLanguageVersion(projectProperties, out var languageVersion); - - // Assert - Assert.True(result); - Assert.Same(RazorLanguageVersion.Latest, languageVersion); - } - - [Fact] - public void TryGetConfigurationItem_FailsNoRazorConfigurationItems() - { - // Arrange - var projectItems = Enumerable.Empty(); - - // Act - var result = DefaultRazorProjectHost.TryGetConfigurationItem("Razor-13.37", projectItems, out var configurationItem); - - // Assert - Assert.False(result); - Assert.Null(configurationItem); - } - - [Fact] - public void TryGetConfigurationItem_FailsNoMatchingRazorConfigurationItems() - { - // Arrange - var projectItems = new IMSBuildItemEvaluated[] - { - new TestMSBuildItem("RazorConfiguration") - { - Include = "Razor-10.0", - } - }; - - // Act - var result = DefaultRazorProjectHost.TryGetConfigurationItem("Razor-13.37", projectItems, out var configurationItem); - - // Assert - Assert.False(result); - Assert.Null(configurationItem); - } - - [Fact] - public void TryGetConfigurationItem_SucceedsForMatchingConfigurationItem() - { - // Arrange - var expectedConfiguration = "Razor-13.37"; - var expectedConfigurationItem = new TestMSBuildItem("RazorConfiguration") - { - Include = expectedConfiguration, - }; - var projectItems = new IMSBuildItemEvaluated[] - { - new TestMSBuildItem("RazorConfiguration") - { - Include = "Razor-10.0-DoesNotMatch", - }, - expectedConfigurationItem - }; - - // Act - var result = DefaultRazorProjectHost.TryGetConfigurationItem(expectedConfiguration, projectItems, out var configurationItem); - - // Assert - Assert.True(result); - Assert.Same(expectedConfigurationItem, configurationItem); - } - - [Fact] - public void TryGetConfiguredExtensionNames_FailsIfNoExtensions() - { - // Arrange - var configurationItem = new TestMSBuildItem("RazorConfiguration"); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionnames); - - // Assert - Assert.False(result); - Assert.Null(configuredExtensionnames); - } - - [Fact] - public void TryGetConfiguredExtensionNames_FailsIfEmptyExtensions() - { - // Arrange - var configurationItem = new TestMSBuildItem("RazorConfiguration"); - configurationItem.TestMetadata.SetValue("Extensions", string.Empty); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionNames); - - // Assert - Assert.False(result); - Assert.Null(configuredExtensionNames); - } - - [Fact] - public void TryGetConfiguredExtensionNames_SucceedsIfSingleExtension() - { - // Arrange - var expectedExtensionName = "SomeExtensionName"; - var configurationItem = new TestMSBuildItem("RazorConfiguration"); - configurationItem.TestMetadata.SetValue("Extensions", expectedExtensionName); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionNames); - - // Assert - Assert.True(result); - var extensionName = Assert.Single(configuredExtensionNames); - Assert.Equal(expectedExtensionName, extensionName); - } - - [Fact] - public void TryGetConfiguredExtensionNames_SucceedsIfMultipleExtensions() - { - // Arrange - var configurationItem = new TestMSBuildItem("RazorConfiguration"); - configurationItem.TestMetadata.SetValue("Extensions", "SomeExtensionName;SomeOtherExtensionName"); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguredExtensionNames(configurationItem, out var configuredExtensionNames); - - // Assert - Assert.True(result); - Assert.Collection( - configuredExtensionNames, - name => Assert.Equal("SomeExtensionName", name), - name => Assert.Equal("SomeOtherExtensionName", name)); - } - - [Fact] - public void GetExtensions_NoExtensionTypes_ReturnsEmptyArray() - { - // Arrange - var projectItems = new IMSBuildItemEvaluated[] - { - new TestMSBuildItem("NotAnExtension") - { - Include = "Extension1", - }, - }; - - // Act - var extensions = DefaultRazorProjectHost.GetExtensions(new[] { "Extension1", "Extension2" }, projectItems); - - // Assert - Assert.Empty(extensions); - } - - [Fact] - public void GetExtensions_UnConfiguredExtensionTypes_ReturnsEmptyArray() - { - // Arrange - var projectItems = new IMSBuildItemEvaluated[] - { - new TestMSBuildItem("RazorExtension") - { - Include = "UnconfiguredExtensionName", - }, - }; - - // Act - var extensions = DefaultRazorProjectHost.GetExtensions(new[] { "Extension1", "Extension2" }, projectItems); - - // Assert - Assert.Empty(extensions); - } - - [Fact] - public void GetExtensions_SomeConfiguredExtensions_ReturnsConfiguredExtensions() - { - // Arrange - var expectedExtension1Name = "Extension1"; - var expectedExtension2Name = "Extension2"; - var projectItems = new IMSBuildItemEvaluated[] - { - new TestMSBuildItem("RazorExtension") - { - Include = "UnconfiguredExtensionName", - }, - new TestMSBuildItem("RazorExtension") - { - Include = expectedExtension1Name, - }, - new TestMSBuildItem("RazorExtension") - { - Include = expectedExtension2Name, - }, - }; - - // Act - var extensions = DefaultRazorProjectHost.GetExtensions(new[] { expectedExtension1Name, expectedExtension2Name }, projectItems); - - // Assert - Assert.Collection( - extensions, - extension => Assert.Equal(expectedExtension1Name, extension.ExtensionName), - extension => Assert.Equal(expectedExtension2Name, extension.ExtensionName)); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoDefaultConfiguration() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - var projectItems = new IMSBuildItemEvaluated[0]; - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectProperties, projectItems, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoLanguageVersion() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorDefaultConfiguration", "Razor-13.37"); - var projectItems = new IMSBuildItemEvaluated[0]; - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectProperties, projectItems, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoConfigurationItems() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorDefaultConfiguration", "Razor-13.37"); - projectProperties.SetValue("RazorLangVersion", "1.0"); - var projectItems = new IMSBuildItemEvaluated[0]; - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectProperties, projectItems, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - [Fact] - public void TryGetConfiguration_FailsIfNoConfiguredExtensionNames() - { - // Arrange - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorDefaultConfiguration", "Razor-13.37"); - projectProperties.SetValue("RazorLangVersion", "1.0"); - var projectItems = new IMSBuildItemEvaluated[] - { - new TestMSBuildItem("RazorConfiguration") - { - Include = "Razor-13.37", - }, - }; - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectProperties, projectItems, out var configuration); - - // Assert - Assert.False(result); - Assert.Null(configuration); - } - - // This is more of an integration test but is here to test the overall flow/functionality - [Fact] - public void TryGetConfiguration_SucceedsWithAllPreRequisites() - { - // Arrange - var expectedLanguageVersion = RazorLanguageVersion.Version_1_0; - var expectedConfigurationName = "Razor-Test"; - var expectedExtension1Name = "Extension1"; - var expectedExtension2Name = "Extension2"; - var expectedRazorConfigurationItem = new TestMSBuildItem("RazorConfiguration") - { - Include = expectedConfigurationName, - }; - expectedRazorConfigurationItem.TestMetadata.SetValue("Extensions", "Extension1;Extension2"); - var projectItems = new IMSBuildItemEvaluated[] - { - new TestMSBuildItem("RazorConfiguration") - { - Include = "UnconfiguredRazorConfiguration", - }, - new TestMSBuildItem("RazorExtension") - { - Include = "UnconfiguredExtensionName", - }, - new TestMSBuildItem("RazorExtension") - { - Include = expectedExtension1Name, - }, - new TestMSBuildItem("RazorExtension") - { - Include = expectedExtension2Name, - }, - expectedRazorConfigurationItem, - }; - var projectProperties = new MSBuildPropertyGroup(); - projectProperties.SetValue("RazorDefaultConfiguration", expectedConfigurationName); - projectProperties.SetValue("RazorLangVersion", "1.0"); - - // Act - var result = DefaultRazorProjectHost.TryGetConfiguration(projectProperties, projectItems, out var configuration); - - // Assert - Assert.True(result); - Assert.Equal(expectedLanguageVersion, configuration.LanguageVersion); - Assert.Equal(expectedConfigurationName, configuration.ConfigurationName); - Assert.Collection( - configuration.Extensions, - extension => Assert.Equal(expectedExtension1Name, extension.ExtensionName), - extension => Assert.Equal(expectedExtension2Name, extension.ExtensionName)); - } - - private class TestMSBuildItem : IMSBuildItemEvaluated - { - private readonly MSBuildPropertyGroup _metadata; - private readonly string _name; - private string _include; - - public TestMSBuildItem(string name) - { - _name = name; - _metadata = new MSBuildPropertyGroup(); - } - - public string Name => _name; - - public string Include - { - get => _include; - set => _include = value; - } - - public MSBuildPropertyGroup TestMetadata => _metadata; - - public IMSBuildPropertyGroupEvaluated Metadata => _metadata; - - public string Condition => throw new System.NotImplementedException(); - - public bool IsImported => throw new System.NotImplementedException(); - - - public string UnevaluatedInclude => throw new System.NotImplementedException(); - - public MSBuildItem SourceItem => throw new System.NotImplementedException(); - - public IEnumerable SourceItems => throw new System.NotImplementedException(); - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultVisualStudioMacWorkspaceAccessorTest.cs b/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultVisualStudioMacWorkspaceAccessorTest.cs deleted file mode 100644 index bafd757836..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/DefaultVisualStudioMacWorkspaceAccessorTest.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Text; -using Moq; -using Xunit; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - public class DefaultVisualStudioMacWorkspaceAccessorTest - { - [Fact] - public void TryGetWorkspace_NoHostProject_ReturnsFalse() - { - // Arrange - var workspaceAccessor = new DefaultVisualStudioMacWorkspaceAccessor(Mock.Of()); - var textBuffer = Mock.Of(); - - // Act - var result = workspaceAccessor.TryGetWorkspace(textBuffer, out var workspace); - - // Assert - Assert.False(result); - } - - // ------------------------------------------------------------------------------------------- - // Purposefully do not have any more tests here because that would involve mocking MonoDevelop - // types. The default constructors for the Solution / DotNetProject MonoDevelop types change - // static classes (they assume they're being created in an IDE). - // ------------------------------------------------------------------------------------------- - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/FallbackRazorProjectHostTest.cs b/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/FallbackRazorProjectHostTest.cs deleted file mode 100644 index e5add6b043..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/FallbackRazorProjectHostTest.cs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using MonoDevelop.Core; -using MonoDevelop.Projects; -using Xunit; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem -{ - public class FallbackRazorProjectHostTest - { - [Theory(Skip = "MonoDevelop.Core.FilePath cannot be loaded due to strong name issues.")] - [InlineData(null)] - [InlineData("")] - public void IsMvcAssembly_FailsIfNullOrEmptyFilePath(string filePath) - { - // Arrange - var assemblyFilePath = new FilePath(filePath); - var assemblyReference = new AssemblyReference(assemblyFilePath); - - // Act - var result = FallbackRazorProjectHost.IsMvcAssembly(assemblyReference); - - // Assert - Assert.False(result); - } - - [Fact(Skip = "MonoDevelop.Core.FilePath cannot be loaded due to strong name issues.")] - public void IsMvcAssembly_FailsIfNotMvc() - { - // Arrange - var assemblyFilePath = new FilePath("C:/Path/To/Assembly.dll"); - var assemblyReference = new AssemblyReference(assemblyFilePath); - - // Act - var result = FallbackRazorProjectHost.IsMvcAssembly(assemblyReference); - - // Assert - Assert.False(result); - } - - [Fact(Skip = "MonoDevelop.Core.FilePath cannot be loaded due to strong name issues.")] - public void IsMvcAssembly_SucceedsIfMvc() - { - // Arrange - var assemblyFilePath = new FilePath("C:/Path/To/Microsoft.AspNetCore.Mvc.Razor.dll"); - var assemblyReference = new AssemblyReference(assemblyFilePath); - - // Act - var result = FallbackRazorProjectHost.IsMvcAssembly(assemblyReference); - - // Assert - Assert.True(result); - } - - // ------------------------------------------------------------------------------------------- - // Purposefully do not have any more tests here because that would involve mocking MonoDevelop - // types. The default constructors for the Solution / DotNetProject MonoDevelop types change - // static classes (they assume they're being created in an IDE). - // ------------------------------------------------------------------------------------------- - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test.csproj b/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test.csproj deleted file mode 100644 index 3ab920e61c..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test.csproj +++ /dev/null @@ -1,24 +0,0 @@ - - - - net461 - - - - - - - - - - - - - - - - - - - - diff --git a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/ProjectBuildChangeTriggerTest.cs b/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/ProjectBuildChangeTriggerTest.cs deleted file mode 100644 index 6fa1e5ae06..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/ProjectBuildChangeTriggerTest.cs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.Editor.Razor; -using MonoDevelop.Projects; -using Moq; -using Xunit; -using Project = Microsoft.CodeAnalysis.Project; - -namespace Microsoft.VisualStudio.Mac.LanguageServices.Razor -{ - public class ProjectBuildChangeTriggerTest : ForegroundDispatcherTestBase - { - [ForegroundFact] - public void ProjectOperations_EndBuild_Invokes_ProjectBuildComplete() - { - // Arrange - var args = new BuildEventArgs(monitor: null, success: true); - var expectedProjectPath = "Path/To/Project"; - var projectService = CreateProjectService(expectedProjectPath); - var projectSnapshots = new[] - { - Mock.Of(p => p.FilePath == expectedProjectPath && p.HostProject == new HostProject(expectedProjectPath, RazorConfiguration.Default)), - Mock.Of(p => p.FilePath == "Test2.csproj" && p.HostProject == new HostProject("Test2.csproj", RazorConfiguration.Default)), - }; - - var projectManager = new Mock(MockBehavior.Strict); - projectManager.SetupGet(p => p.Projects).Returns(projectSnapshots); - projectManager - .Setup(p => p.HostProjectBuildComplete(It.IsAny())) - .Callback(c => Assert.Equal(expectedProjectPath, c.FilePath)); - var trigger = new ProjectBuildChangeTrigger(Dispatcher, projectService, projectManager.Object); - - // Act - trigger.ProjectOperations_EndBuild(null, args); - - // Assert - projectManager.VerifyAll(); - } - - [ForegroundFact] - public void ProjectOperations_EndBuild_UntrackedProject_Noops() - { - // Arrange - var args = new BuildEventArgs(monitor: null, success: true); - var projectService = CreateProjectService("Path/To/Project"); - var projectSnapshots = new[] - { - Mock.Of(p => p.FilePath == "Path/To/AnotherProject" && p.HostProject == new HostProject("Path/To/AnotherProject", RazorConfiguration.Default)), - }; - var projectManager = new Mock(); - projectManager.SetupGet(p => p.Projects).Returns(projectSnapshots); - projectManager - .Setup(p => p.HostProjectBuildComplete(It.IsAny())) - .Throws(); - var trigger = new ProjectBuildChangeTrigger(Dispatcher, projectService, projectManager.Object); - - // Act & Assert - trigger.ProjectOperations_EndBuild(null, args); - } - - [ForegroundFact] - public void ProjectOperations_EndBuild_BuildFailed_Noops() - { - // Arrange - var args = new BuildEventArgs(monitor: null, success: false); - var projectService = new Mock(); - projectService.Setup(p => p.IsSupportedProject(null)).Throws(); - var projectManager = new Mock(); - projectManager.SetupGet(p => p.Workspace).Throws(); - var trigger = new ProjectBuildChangeTrigger(Dispatcher, projectService.Object, projectManager.Object); - - // Act & Assert - trigger.ProjectOperations_EndBuild(null, args); - } - - [ForegroundFact] - public void ProjectOperations_EndBuild_UnsupportedProject_Noops() - { - // Arrange - var args = new BuildEventArgs(monitor: null, success: true); - var projectService = new Mock(); - projectService.Setup(p => p.IsSupportedProject(null)).Returns(false); - var projectManager = new Mock(); - projectManager.SetupGet(p => p.Workspace).Throws(); - var trigger = new ProjectBuildChangeTrigger(Dispatcher, projectService.Object, projectManager.Object); - - // Act & Assert - trigger.ProjectOperations_EndBuild(null, args); - } - - private static TextBufferProjectService CreateProjectService(string projectPath) - { - var projectService = new Mock(); - projectService.Setup(p => p.GetProjectPath(null)).Returns(projectPath); - projectService.Setup(p => p.IsSupportedProject(null)).Returns(true); - return projectService.Object; - } - - private static AdhocWorkspace CreateProjectInWorkspace(AdhocWorkspace workspace, string name, string path) - { - workspace.AddProject(ProjectInfo.Create(ProjectId.CreateNewId(), new VersionStamp(), name, "TestAssembly", LanguageNames.CSharp, filePath: path)); - return workspace; - } - } -} diff --git a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/xunit.runner.json b/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/xunit.runner.json deleted file mode 100644 index c04bb61fe6..0000000000 --- a/src/Razor/test/Microsoft.VisualStudio.Mac.LanguageServices.Razor.Test/xunit.runner.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "methodDisplay": "method", - "shadowCopy": false -} \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/AddinMetadata.props b/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/AddinMetadata.props deleted file mode 100644 index 0797744c9a..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/AddinMetadata.props +++ /dev/null @@ -1,9 +0,0 @@ - - - RazorAddin - Microsoft.VisualStudio.Mac - Razor Language Services - Web Development - Language services for ASP.NET Core Razor - - diff --git a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/Microsoft.VisualStudio.Mac.RazorAddin.csproj b/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/Microsoft.VisualStudio.Mac.RazorAddin.csproj deleted file mode 100644 index 9f6462e3a7..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/Microsoft.VisualStudio.Mac.RazorAddin.csproj +++ /dev/null @@ -1,47 +0,0 @@ - - - - - net461 - - - - - <_Parameter1>$(AddinId) - $(AddinNamespace) - $(AddinVersion) - - - <_Parameter1>$(AddinDetailedName) - - - <_Parameter1>$(AddinCategory) - - - <_Parameter1>$(Description) - - - <_Parameter1>$(Authors) - - - <_Parameter1>::MonoDevelop.Ide - <_Parameter2>7.4 - - - <_Parameter1>::MonoDevelop.Core - <_Parameter2>7.4 - - - - - - - - - - - - - - - diff --git a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/Properties/_Manifest.addin.xml b/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/Properties/_Manifest.addin.xml deleted file mode 100644 index 0c81e6caf6..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/Properties/_Manifest.addin.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/RazorAddin.cs b/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/RazorAddin.cs deleted file mode 100644 index 276db71f2d..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/RazorAddin.cs +++ /dev/null @@ -1,10 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -namespace Microsoft.VisualStudio.Mac.RazorAddin -{ - public static class RazorAddin - { - public const string Version = "7.5"; - } -} diff --git a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/RazorProjectExtension.cs b/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/RazorProjectExtension.cs deleted file mode 100644 index 2c69a1d298..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.Mac.RazorAddin/RazorProjectExtension.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Razor; -using Microsoft.VisualStudio.Mac.LanguageServices.Razor.ProjectSystem; -using MonoDevelop.Ide.Composition; -using MonoDevelop.Ide.TypeSystem; -using MonoDevelop.Projects; - -namespace Microsoft.VisualStudio.Mac.RazorAddin -{ - internal class RazorProjectExtension : ProjectExtension - { - private readonly object _lock = new object(); - private readonly ForegroundDispatcher _foregroundDispatcher; - - public RazorProjectExtension() - { - _foregroundDispatcher = CompositionManager.GetExportedValue(); - } - - protected override void OnBoundToSolution() - { - if (!(Project is DotNetProject dotNetProject)) - { - return; - } - - DotNetProjectHost projectHost; - lock (_lock) - { - if (Project.ExtendedProperties.Contains(typeof(DotNetProjectHost))) - { - // Already have a project host. - return; - } - - var projectHostFactory = CompositionManager.GetExportedValue(); - projectHost = projectHostFactory.Create(dotNetProject); - Project.ExtendedProperties[typeof(DotNetProjectHost)] = projectHost; - } - - // Once a workspace is created for the solution we'll setup our project host for the current project. The Razor world - // shares a lifetime with the workspace (as Roslyn services) so we need to ensure it exists prior to wiring the host - // world to the Roslyn world. - TypeSystemService.GetWorkspaceAsync(Project.ParentSolution).ContinueWith(task => - { - if (task.IsFaulted || task.IsCanceled) - { - // We only want to act if we could properly retrieve the workspace. - return; - } - - projectHost.Subscribe(); - }, - _foregroundDispatcher.ForegroundScheduler); - } - } -} diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/AboutDialogInfoAttribute.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/AboutDialogInfoAttribute.cs deleted file mode 100644 index 3d97da5190..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/AboutDialogInfoAttribute.cs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System; -using System.Reflection; -using Microsoft.VisualStudio.Shell; - -namespace Microsoft.VisualStudio.RazorExtension -{ - public class AboutDialogInfoAttribute : RegistrationAttribute - { - private readonly string _detailsId; - private readonly string _name; - private readonly string _nameId; - private readonly string _packageGuid; - - // nameId and detailsId are resource IDs, they should start with # - public AboutDialogInfoAttribute(string packageGuid, string name, string nameId, string detailsId) - { - _packageGuid = packageGuid; - _name = name; - _nameId = nameId; - _detailsId = detailsId; - } - - // This is a resource ID it should start with # - public string IconResourceID { get; set; } - - private string GetKeyName() - { - return "InstalledProducts\\" + _name; - } - - public override void Register(RegistrationContext context) - { - var attribute = typeof(AboutDialogInfoAttribute).Assembly.GetCustomAttribute(); - var version = attribute?.InformationalVersion; - - using (var key = context.CreateKey(GetKeyName())) - { - key.SetValue(null, _nameId); - key.SetValue("Package", Guid.Parse(_packageGuid).ToString("B")); - key.SetValue("ProductDetails", _detailsId); - key.SetValue("UseInterface", false); - key.SetValue("UseVSProductID", false); - - if (version != null) - { - key.SetValue("PID", version); - } - - if (IconResourceID != null) - { - key.SetValue("LogoID", IconResourceID); - } - } - } - - public override void Unregister(RegistrationContext context) - { - context.RemoveKey(GetKeyName()); - } - } -} \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Behaviors/ItemSelectedBehavior.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Behaviors/ItemSelectedBehavior.cs deleted file mode 100644 index deb020ff95..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Behaviors/ItemSelectedBehavior.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System.Windows; -using System.Windows.Controls; -using System.Windows.Controls.Primitives; -using System.Windows.Input; - -namespace Microsoft.VisualStudio.RazorExtension.Behaviors -{ - public static class ItemSelectedBehavior - { - public static DependencyProperty ItemSelectedProperty = - DependencyProperty.RegisterAttached(nameof(Selector.SelectedItem), - typeof(ICommand), - typeof(ItemSelectedBehavior), - new FrameworkPropertyMetadata(null, new PropertyChangedCallback(ItemSelectedChanged))); - - public static ICommand GetItemSelected(DependencyObject target) - { - return (ICommand)target.GetValue(ItemSelectedProperty); - } - - public static void SetItemSelected(DependencyObject target, ICommand value) - { - target.SetValue(ItemSelectedProperty, value); - } - - private static void ItemSelectedChanged(DependencyObject target, DependencyPropertyChangedEventArgs e) - { - var element = target as Selector; - if (element != null) - { - if ((e.NewValue != null) && (e.OldValue == null)) - { - element.SelectionChanged += Selector_SelectionChanged; - } - - else if ((e.NewValue == null) && (e.OldValue != null)) - { - element.SelectionChanged -= Selector_SelectionChanged; - } - } - } - - private static void Selector_SelectionChanged(object sender, SelectionChangedEventArgs e) - { - var element = sender as Selector; - if (element != null) - { - ICommand command = (ICommand)GetItemSelected(element); - command.Execute(element.SelectedItem); - } - } - } -} -#endif diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoViewModel.cs deleted file mode 100644 index 36073681dc..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoViewModel.cs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE - -using System; -using Microsoft.CodeAnalysis; -using Microsoft.VisualStudio.Editor.Razor; - -namespace Microsoft.VisualStudio.RazorExtension.DocumentInfo -{ - public class RazorDocumentInfoViewModel : NotifyPropertyChanged - { - private readonly VisualStudioDocumentTracker _documentTracker; - - public RazorDocumentInfoViewModel(VisualStudioDocumentTracker documentTracker) - { - if (documentTracker == null) - { - throw new ArgumentNullException(nameof(documentTracker)); - } - - _documentTracker = documentTracker; - } - - public string Configuration => _documentTracker.Configuration?.ConfigurationName; - - public bool IsSupportedDocument => _documentTracker.IsSupportedProject; - - public Project Project - { - get - { - if (Workspace != null && ProjectId != null) - { - return Workspace.CurrentSolution.GetProject(ProjectId); - } - - return null; - } - } - - public ProjectId ProjectId => _documentTracker.Project?.Id; - - public Workspace Workspace => _documentTracker.Workspace; - } -} - -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindow.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindow.cs deleted file mode 100644 index ae2a02e6d1..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindow.cs +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE - -using System; -using System.Diagnostics; -using System.Linq; -using System.Runtime.InteropServices; -using System.Windows; -using Microsoft.VisualStudio.ComponentModelHost; -using Microsoft.VisualStudio.Editor; -using Microsoft.VisualStudio.Editor.Razor; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Text.Editor; -using Microsoft.VisualStudio.TextManager.Interop; - -namespace Microsoft.VisualStudio.RazorExtension.DocumentInfo -{ - [Guid("d8d83218-309c-4c8f-9c9f-38a6fead8dca")] - internal class RazorDocumentInfoWindow : ToolWindowPane - { - private IVsEditorAdaptersFactoryService _adapterFactory; - private RazorEditorFactoryService _editorFactoryService; - private IVsTextManager _textManager; - private IVsRunningDocumentTable _rdt; - - private uint _cookie; - private ITextView _textView; - private VisualStudioDocumentTracker _documentTracker; - - public RazorDocumentInfoWindow() - : base(null) - { - Caption = "Razor Document Info"; - - Content = new RazorDocumentInfoWindowControl(); - } - - protected override void Initialize() - { - base.Initialize(); - - var component = (IComponentModel)GetService(typeof(SComponentModel)); - _adapterFactory = component.GetService(); - _editorFactoryService = component.GetService(); - - _textManager = (IVsTextManager)GetService(typeof(SVsTextManager)); - _rdt = (IVsRunningDocumentTable)GetService(typeof(SVsRunningDocumentTable)); - - var hr = _rdt.AdviseRunningDocTableEvents(new RdtEvents(this), out uint _cookie); - ErrorHandler.ThrowOnFailure(hr); - } - - protected override void OnClose() - { - _rdt.UnadviseRunningDocTableEvents(_cookie); - _cookie = 0u; - - base.OnClose(); - } - - private void OnBeforeDocumentWindowShow(IVsWindowFrame frame) - { - var vsTextView = VsShellUtilities.GetTextView(frame); - if (vsTextView == null) - { - return; - } - - var textView = _adapterFactory.GetWpfTextView(vsTextView); - if (textView != null && textView != _textView) - { - _textView = textView; - - if (_documentTracker != null) - { - _documentTracker.ContextChanged -= DocumentTracker_ContextChanged; - } - - var textBuffer = textView.BufferGraph.GetRazorBuffers().FirstOrDefault(); - - if (!_editorFactoryService.TryGetDocumentTracker(textBuffer, out _documentTracker)) - { - return; - } - - _documentTracker.ContextChanged += DocumentTracker_ContextChanged; - - ((FrameworkElement)Content).DataContext = new RazorDocumentInfoViewModel(_documentTracker); - } - } - - private void OnAfterDocumentWindowHide(IVsWindowFrame frame) - { - var vsTextView = VsShellUtilities.GetTextView(frame); - - var textView = _adapterFactory.GetWpfTextView(vsTextView); - if (textView == _textView) - { - ((FrameworkElement)Content).DataContext = null; - _documentTracker.ContextChanged -= DocumentTracker_ContextChanged; - - _textView = null; - _documentTracker = null; - } - } - - private void DocumentTracker_ContextChanged(object sender, EventArgs e) - { - ((FrameworkElement)Content).DataContext = new RazorDocumentInfoViewModel(_documentTracker); - } - - private class RdtEvents : IVsRunningDocTableEvents - { - private readonly RazorDocumentInfoWindow _window; - - public RdtEvents(RazorDocumentInfoWindow window) - { - _window = window; - } - - public int OnAfterFirstDocumentLock(uint docCookie, uint dwRDTLockType, uint dwReadLocksRemaining, uint dwEditLocksRemaining) => VSConstants.S_OK; - - public int OnBeforeLastDocumentUnlock(uint docCookie, uint dwRDTLockType, uint dwReadLocksRemaining, uint dwEditLocksRemaining) => VSConstants.S_OK; - - public int OnAfterSave(uint docCookie) => VSConstants.S_OK; - - public int OnAfterAttributeChange(uint docCookie, uint grfAttribs) => VSConstants.S_OK; - - public int OnBeforeDocumentWindowShow(uint docCookie, int fFirstShow, IVsWindowFrame pFrame) - { - _window.OnBeforeDocumentWindowShow(pFrame); - return VSConstants.S_OK; - } - - public int OnAfterDocumentWindowHide(uint docCookie, IVsWindowFrame pFrame) - { - _window.OnAfterDocumentWindowHide(pFrame); - return VSConstants.S_OK; - } - } - } -} -#endif diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowCommand.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowCommand.cs deleted file mode 100644 index 91b3bc7e29..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowCommand.cs +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE - -using System; -using System.ComponentModel.Design; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.RazorExtension.DocumentInfo -{ - /// - /// Command handler - /// - internal sealed class RazorDocumentInfoWindowCommand - { - /// - /// Command ID. - /// - public const int CommandId = 0x101; - - /// - /// Command menu group (command set GUID). - /// - public static readonly Guid CommandSet = new Guid("eaaf8ee4-d120-4a4d-8b58-b138b7f00b96"); - - /// - /// VS Package that provides this command, not null. - /// - private readonly Package package; - - /// - /// Initializes a new instance of the class. - /// Adds our command handlers for menu (commands must exist in the command table file) - /// - /// Owner package, not null. - private RazorDocumentInfoWindowCommand(Package package) - { - if (package == null) - { - throw new ArgumentNullException("package"); - } - - this.package = package; - - OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; - if (commandService != null) - { - var menuCommandID = new CommandID(CommandSet, CommandId); - var menuItem = new MenuCommand(this.ShowToolWindow, menuCommandID); - commandService.AddCommand(menuItem); - } - } - - /// - /// Gets the instance of the command. - /// - public static RazorDocumentInfoWindowCommand Instance - { - get; - private set; - } - - /// - /// Gets the service provider from the owner package. - /// - private IServiceProvider ServiceProvider - { - get - { - return this.package; - } - } - - /// - /// Initializes the singleton instance of the command. - /// - /// Owner package, not null. - public static void Initialize(Package package) - { - Instance = new RazorDocumentInfoWindowCommand(package); - } - - /// - /// Shows the tool window when the menu item is clicked. - /// - /// The event sender. - /// The event args. - private void ShowToolWindow(object sender, EventArgs e) - { - // Get the instance number 0 of this tool window. This window is single instance so this instance - // is actually the only one. - // The last flag is set to true so that if the tool window does not exists it will be created. - ToolWindowPane window = this.package.FindToolWindow(typeof(RazorDocumentInfoWindow), 0, true); - if ((null == window) || (null == window.Frame)) - { - throw new NotSupportedException("Cannot create tool window"); - } - - IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; - Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); - } - } -} - -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowControl.xaml b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowControl.xaml deleted file mode 100644 index 86a4064fa6..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowControl.xaml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowControl.xaml.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowControl.xaml.cs deleted file mode 100644 index 01662fb063..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/DocumentInfo/RazorDocumentInfoWindowControl.xaml.cs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE - -using System.Windows.Controls; - -namespace Microsoft.VisualStudio.RazorExtension.DocumentInfo -{ - public partial class RazorDocumentInfoWindowControl : UserControl - { - public RazorDocumentInfoWindowControl() - { - this.InitializeComponent(); - } - } -} - -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj deleted file mode 100644 index 4a51b8693a..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Microsoft.VisualStudio.RazorExtension.csproj +++ /dev/null @@ -1,377 +0,0 @@ - - - - 15.8 - $(VsixVersion).$(BuildNumber) - $(VsixVersion).999999 - 15.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - true - true - ..\..\build\Key.snk - - RoslynDev - - Program - $(DevEnvDir)devenv.exe - /rootsuffix RoslynDev /log - - CommonExtensions - Microsoft\RazorLanguageServices - true - false - false - - - - - Debug - AnyCPU - 2.0 - {82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - {D66B45B5-CBFD-4947-81F1-F30AB80EA992} - Library - Properties - Microsoft.VisualStudio.RazorExtension - Microsoft.VisualStudio.RazorExtension - - v4.6 - true - true - false - true - true - true - - - true - full - false - bin\Debug\ - DEBUG;TRACE;RAZOR_EXTENSION_DEVELOPER_MODE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - RazorDocumentInfoWindowControl.xaml - - - - - - - - - - - - - - - - - - - - - - Always - true - - - Always - true - - - true - - - Designer - - - - - False - - - False - - - False - - - False - - - - - - - - - - - - - Menus.ctmenu - - - - - Designer - MSBuild:Compile - - - Designer - MSBuild:Compile - - - RazorInfoToolWindowControl.xaml - - - - - true - VSPackage - - - - - Microsoft.AspNetCore.Mvc.Razor.Extensions - False - - - - - - - Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X - False - - - - - - - {932f3c9c-a6c0-40d3-ba50-9309886242fc} - Microsoft.AspNetCore.Razor.Language - False - - - - - - - Microsoft.CodeAnalysis.Razor - False - - - - - - - {0f265874-c592-448b-bc4f-3430ab03e0dc} - Microsoft.CodeAnalysis.Razor.Workspaces - False - - - - - - - {1840aad6-e26b-43ce-a2b1-7e74ad512888} - Microsoft.CodeAnalysis.Remote.Razor - False - - - - - - - {0bcde75a-a438-46c7-95e9-391f029d07c5} - Microsoft.VisualStudio.Editor.Razor - False - - - - - - - {92114fe9-cb07-4712-9aa4-afab65ca28e1} - Microsoft.VisualStudio.LanguageServices.Razor - False - - - - - - - - - - - - - - - false - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - MSBuild - Microsoft\VisualStudio\Razor\ - - - - true - MSBuild - Microsoft\VisualStudio\Razor\Rules\ - - - - - - - - false - - - - - - - - - - - - - PreserveNewest - - - - - - - - - - <_GeneratedVSIXAssemblyInfoInputsCacheFile>$(IntermediateOutputPath)$(MSBuildProjectName).VSIXAssemblyInfo.cache.txt - <_GeneratedVSIXAssemblyInfoFile>$(IntermediateOutputPath)$(MSBuildProjectName).VSIXAssemblyInfo.cs - <_GeneratedVSIXBindingRedirectFile>$(IntermediateOutputPath)$(MSBuildProjectName).BindingRedirects.cs - - - - <_VSIXAssemblyAttribute Include="System.Reflection.AssemblyInformationalVersionAttribute"> - <_Parameter1>$(VsixVersion) - - - - - <_GeneratedVSIXBindingRedirectContent> - -using Microsoft.VisualStudio.Shell; - -@(ProjectReference->'[assembly: ProvideBindingRedirection(AssemblyName = "%(Name)", GenerateCodeBase = true, PublicKeyToken = "adb9793829ddae60", OldVersionLowerBound = "0.0.0.0", OldVersionUpperBound = "$(VersionPrefix).0", NewVersion = "$(VersionPrefix).0")]', '%0A') -]]> - - - - - - false - - - - - - - - - - - - - - - - - - false - - - - - - - - diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/NotifyPropertyChanged.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/NotifyPropertyChanged.cs deleted file mode 100644 index 569469e8ff..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/NotifyPropertyChanged.cs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System.ComponentModel; -using System.Runtime.CompilerServices; - -namespace Microsoft.VisualStudio.RazorExtension -{ - public abstract class NotifyPropertyChanged : INotifyPropertyChanged - { - public event PropertyChangedEventHandler PropertyChanged; - - protected void OnPropertyChanged([CallerMemberName] string propertyName = null) - { - PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); - } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Properties/AssemblyInfo.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Properties/AssemblyInfo.cs deleted file mode 100644 index 37ae5e2dec..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,6 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -using System.Runtime.CompilerServices; -[assembly: InternalsVisibleTo("Microsoft.VisualStudio.RazorExtension.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100f33a29044fa9d740c9b3213a93e57c84b472c84e0b8a0e1ae48e67a9f8f6de9d5f7f3d52ac23e48ac51801f1dc950abe901da34d2a9e3baadb141a17c77ef3c565dd5ee5054b91cf63bb3c6ab83f72ab3aafe93d0fc3c2348b764fafb0b1c0733de51459aeab46580384bf9d74c4e28164b7cde247f891ba07891c9d872ad2bb")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/AssemblyViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/AssemblyViewModel.cs deleted file mode 100644 index 582796aaf7..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/AssemblyViewModel.cs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - public class AssemblyViewModel : NotifyPropertyChanged - { - private readonly ProjectExtensibilityAssembly _assembly; - - internal AssemblyViewModel(ProjectExtensibilityAssembly assembly) - { - _assembly = assembly; - - Name = _assembly.Identity.GetDisplayName(); - } - - public string Name { get; } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DirectiveViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DirectiveViewModel.cs deleted file mode 100644 index 552c9d5131..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DirectiveViewModel.cs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System.Text; -using Microsoft.AspNetCore.Razor.Language; - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - public class DirectiveViewModel : NotifyPropertyChanged - { - private readonly DirectiveDescriptor _directive; - - internal DirectiveViewModel(DirectiveDescriptor directive) - { - _directive = directive; - - var builder = new StringBuilder(); - builder.Append("@"); - builder.Append(_directive.Directive); - - foreach (var token in _directive.Tokens) - { - builder.Append("("); - builder.Append(token.Kind.ToString()); - builder.Append(")"); - } - - if (directive.Kind == DirectiveKind.CodeBlock || directive.Kind == DirectiveKind.RazorBlock) - { - builder.Append("{ ... }"); - } - - DisplayText = builder.ToString(); - } - - public string DisplayText { get; } - - public string Name => _directive.Directive; - } -} -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DocumentInfoViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DocumentInfoViewModel.cs deleted file mode 100644 index 222f5a62f3..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DocumentInfoViewModel.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using Microsoft.VisualStudio.LanguageServices.Razor; - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - public class DocumentInfoViewModel : NotifyPropertyChanged - { - private RazorEngineDocument _document; - - internal DocumentInfoViewModel(RazorEngineDocument document) - { - _document = document; - } - - public string Text => _document.Text; - } -} -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DocumentViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DocumentViewModel.cs deleted file mode 100644 index e61a4704cb..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/DocumentViewModel.cs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - public class DocumentViewModel : NotifyPropertyChanged - { - public DocumentViewModel(string filePath) - { - FilePath = filePath; - } - - public string FilePath { get; } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectInfoViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectInfoViewModel.cs deleted file mode 100644 index 98aa5b709b..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectInfoViewModel.cs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System.Collections.ObjectModel; - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - public class ProjectInfoViewModel : NotifyPropertyChanged - { - private ObservableCollection _directives; - private ObservableCollection _documents; - private ObservableCollection _tagHelpers; - - public ObservableCollection Directives - { - get { return _directives; } - set - { - _directives = value; - OnPropertyChanged(); - } - } - - public ObservableCollection Documents - { - get { return _documents; } - set - { - _documents = value; - OnPropertyChanged(); - } - } - - public ObservableCollection TagHelpers - { - get { return _tagHelpers; } - set - { - _tagHelpers = value; - OnPropertyChanged(); - } - } - } -} -#endif diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectSnapshotViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectSnapshotViewModel.cs deleted file mode 100644 index c95157cec1..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectSnapshotViewModel.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System.Collections.ObjectModel; -using System.IO; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - public class ProjectSnapshotViewModel : NotifyPropertyChanged - { - internal ProjectSnapshotViewModel(ProjectSnapshot project) - { - Project = project; - - Id = project.WorkspaceProject?.Id; - Properties = new ObservableCollection() - { - new PropertyViewModel("Razor Language Version", project.Configuration?.LanguageVersion.ToString()), - new PropertyViewModel("Configuration Name", $"{project.Configuration?.ConfigurationName} ({project.Configuration?.GetType().Name ?? "unknown"})"), - new PropertyViewModel("Workspace Project", project.WorkspaceProject?.Name) - }; - } - - internal ProjectSnapshot Project { get; } - - public string Name => Path.GetFileNameWithoutExtension(Project.FilePath); - - public ProjectId Id { get; } - - public ObservableCollection Properties { get; } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectViewModel.cs deleted file mode 100644 index 1d1442c05f..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/ProjectViewModel.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System.IO; - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - public class ProjectViewModel : NotifyPropertyChanged - { - private ProjectSnapshotViewModel _snapshot; - - internal ProjectViewModel(string filePath) - { - FilePath = filePath; - } - - public string FilePath { get; } - - public string Name => Path.GetFileNameWithoutExtension(FilePath); - - public bool HasSnapshot => Snapshot != null; - - public ProjectSnapshotViewModel Snapshot - { - get => _snapshot; - set - { - _snapshot = value; - OnPropertyChanged(); - OnPropertyChanged(nameof(HasSnapshot)); - } - } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/PropertyViewModel.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/PropertyViewModel.cs deleted file mode 100644 index e7586847ac..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/PropertyViewModel.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - public class PropertyViewModel : NotifyPropertyChanged - { - internal PropertyViewModel(string name, string value) - { - Name = name; - Value = value; - } - - public string Name { get; } - - public string Value { get; } - } -} -#endif \ No newline at end of file diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindow.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindow.cs deleted file mode 100644 index 8b405550fd..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindow.cs +++ /dev/null @@ -1,150 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System; -using System.Runtime.InteropServices; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.VisualStudio.ComponentModelHost; -using Microsoft.VisualStudio.LanguageServices; -using Microsoft.VisualStudio.LanguageServices.Razor; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - [Guid("079e9499-d150-40af-8876-3047f7942c2a")] - public class RazorInfoToolWindow : ToolWindowPane - { - private IRazorEngineDocumentGenerator _documentGenerator; - private IRazorEngineDirectiveResolver _directiveResolver; - private ProjectSnapshotManager _projectManager; - private TagHelperResolver _tagHelperResolver; - private VisualStudioWorkspace _workspace; - - public RazorInfoToolWindow() : base(null) - { - Caption = "Razor Info"; - Content = new RazorInfoToolWindowControl(); - } - - private RazorInfoViewModel DataContext - { - get => (RazorInfoViewModel)((RazorInfoToolWindowControl)Content).DataContext; - set => ((RazorInfoToolWindowControl)Content).DataContext = value; - } - - protected override void Initialize() - { - base.Initialize(); - - var componentModel = (IComponentModel)GetService(typeof(SComponentModel)); - _workspace = componentModel.GetService(); - - _documentGenerator = componentModel.GetService(); - _directiveResolver = componentModel.GetService(); - _tagHelperResolver = _workspace.Services.GetLanguageServices(RazorLanguage.Name).GetRequiredService(); - - _projectManager = _workspace.Services.GetLanguageServices(RazorLanguage.Name).GetRequiredService(); - _projectManager.Changed += ProjectManager_Changed; - - DataContext = new RazorInfoViewModel(this, _workspace, _projectManager, _directiveResolver, _tagHelperResolver, _documentGenerator, OnException); - foreach (var project in _projectManager.Projects) - { - DataContext.Projects.Add(new ProjectViewModel(project.FilePath) - { - Snapshot = new ProjectSnapshotViewModel(project), - }); - } - - if (DataContext.Projects.Count > 0) - { - DataContext.CurrentProject = DataContext.Projects[0]; - } - } - - protected override void Dispose(bool disposing) - { - base.Dispose(disposing); - - if (disposing) - { - _projectManager.Changed -= ProjectManager_Changed; - } - } - - private void ProjectManager_Changed(object sender, ProjectChangeEventArgs e) - { - switch (e.Kind) - { - case ProjectChangeKind.Added: - { - var added = new ProjectViewModel(e.Project.FilePath) - { - Snapshot = new ProjectSnapshotViewModel(e.Project), - }; - - DataContext.Projects.Add(added); - - if (DataContext.Projects.Count == 1) - { - DataContext.CurrentProject = added; - } - break; - } - - case ProjectChangeKind.Removed: - { - ProjectViewModel removed = null; - for (var i = DataContext.Projects.Count - 1; i >= 0; i--) - { - var project = DataContext.Projects[i]; - if (project.FilePath == e.Project.FilePath) - { - removed = project; - DataContext.Projects.RemoveAt(i); - break; - } - } - - if (DataContext.CurrentProject == removed) - { - DataContext.CurrentProject = null; - } - - break; - } - - case ProjectChangeKind.Changed: - { - ProjectViewModel changed = null; - for (var i = DataContext.Projects.Count - 1; i >= 0; i--) - { - var project = DataContext.Projects[i]; - if (project.FilePath == e.Project.FilePath) - { - changed = project; - changed.Snapshot = new ProjectSnapshotViewModel(e.Project); - break; - } - } - - break; - } - } - } - - private void OnException(Exception ex) - { - VsShellUtilities.ShowMessageBox( - this, - ex.ToString(), - "Razor Error", - OLEMSGICON.OLEMSGICON_CRITICAL, - OLEMSGBUTTON.OLEMSGBUTTON_OK, - OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); - } - } -} -#endif diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowCommand.cs b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowCommand.cs deleted file mode 100644 index 5d4c4d0700..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowCommand.cs +++ /dev/null @@ -1,105 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. - -#if RAZOR_EXTENSION_DEVELOPER_MODE -using System; -using System.ComponentModel.Design; -using Microsoft.VisualStudio.Shell; -using Microsoft.VisualStudio.Shell.Interop; - -namespace Microsoft.VisualStudio.RazorExtension.RazorInfo -{ - /// - /// Command handler - /// - internal sealed class RazorInfoToolWindowCommand - { - /// - /// Command ID. - /// - public const int CommandId = 0x0100; - - /// - /// Command menu group (command set GUID). - /// - public static readonly Guid CommandSet = new Guid("eaaf8ee4-d120-4a4d-8b58-b138b7f00b96"); - - /// - /// VS Package that provides this command, not null. - /// - private readonly Package package; - - /// - /// Initializes a new instance of the class. - /// Adds our command handlers for menu (commands must exist in the command table file) - /// - /// Owner package, not null. - private RazorInfoToolWindowCommand(Package package) - { - if (package == null) - { - throw new ArgumentNullException("package"); - } - - this.package = package; - - OleMenuCommandService commandService = this.ServiceProvider.GetService(typeof(IMenuCommandService)) as OleMenuCommandService; - if (commandService != null) - { - var menuCommandID = new CommandID(CommandSet, CommandId); - var menuItem = new MenuCommand(this.ShowToolWindow, menuCommandID); - commandService.AddCommand(menuItem); - } - } - - /// - /// Gets the instance of the command. - /// - public static RazorInfoToolWindowCommand Instance - { - get; - private set; - } - - /// - /// Gets the service provider from the owner package. - /// - private IServiceProvider ServiceProvider - { - get - { - return this.package; - } - } - - /// - /// Initializes the singleton instance of the command. - /// - /// Owner package, not null. - public static void Initialize(Package package) - { - Instance = new RazorInfoToolWindowCommand(package); - } - - /// - /// Shows the tool window when the menu item is clicked. - /// - /// The event sender. - /// The event args. - private void ShowToolWindow(object sender, EventArgs e) - { - // Get the instance number 0 of this tool window. This window is single instance so this instance - // is actually the only one. - // The last flag is set to true so that if the tool window does not exists it will be created. - ToolWindowPane window = this.package.FindToolWindow(typeof(RazorInfoToolWindow), 0, true); - if ((null == window) || (null == window.Frame)) - { - throw new NotSupportedException("Cannot create tool window"); - } - - IVsWindowFrame windowFrame = (IVsWindowFrame)window.Frame; - Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show()); - } - } -} -#endif diff --git a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowControl.xaml b/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowControl.xaml deleted file mode 100644 index 3044ba25c7..0000000000 --- a/src/Razor/tooling/Microsoft.VisualStudio.RazorExtension/RazorInfo/RazorInfoToolWindowControl.xaml +++ /dev/null @@ -1,266 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -