提交 df06a196 编写于 作者: H heejaechang

fixed temporary storage not preserving soucetext encoding.

also, made ITextFactoryService internal (changeset 1406337)
上级 94858618
......@@ -630,8 +630,8 @@
<Compile Include="Implementation\TodoComment\TodoCommentState.cs" />
<Compile Include="Implementation\TodoComment\TodoCommentTokens.cs" />
<Compile Include="Implementation\TodoComment\TodoTaskItem.cs" />
<Compile Include="Implementation\Workspaces\TextFactoryFactory.cs" />
<Compile Include="Implementation\Workspaces\ProjectCacheServiceFactory.cs" />
<Compile Include="Implementation\Workspaces\EditorTextFactoryService.cs" />
<Compile Include="Implementation\Workspaces\TextUndoHistoryWorkspaceServiceFactoryService.cs" />
<Compile Include="Implementation\Workspaces\WorkspaceTaskSchedulerFactoryFactory.cs" />
<Compile Include="InternalsVisibleTo.cs" />
......@@ -795,4 +795,4 @@
<Import Project="..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
// Copyright (c) Microsoft. 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.IO;
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Workspaces
{
[ExportWorkspaceService(typeof(ITextFactoryService), ServiceLayer.Editor), Shared]
internal class EditorTextFactoryService : ITextFactoryService
{
private readonly ITextBufferFactoryService _textBufferFactory;
private readonly IContentType _unknownContentType;
[ImportingConstructor]
public EditorTextFactoryService(
ITextBufferFactoryService textBufferFactoryService,
IContentTypeRegistryService contentTypeRegistryService)
{
_textBufferFactory = textBufferFactoryService;
_unknownContentType = contentTypeRegistryService.UnknownContentType;
}
public SourceText CreateText(Stream stream, Encoding defaultEncoding, CancellationToken cancellationToken = default(CancellationToken))
{
var encoding = EncodedStringText.TryReadByteOrderMark(stream)
?? defaultEncoding
?? new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
// Close the stream here since we might throw an exception trying to determine the encoding
using (stream)
{
return CreateTextInternal(stream, encoding, cancellationToken)
?? CreateTextInternal(stream, Encoding.Default, cancellationToken);
}
}
public SourceText CreateText(TextReader reader, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken))
{
var buffer = _textBufferFactory.CreateTextBuffer(reader, _unknownContentType);
return buffer.CurrentSnapshot.AsRoslynText(encoding ?? Encoding.UTF8);
}
private SourceText CreateTextInternal(Stream stream, Encoding encoding, CancellationToken cancellationToken)
{
try
{
cancellationToken.ThrowIfCancellationRequested();
stream.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(stream, encoding, detectEncodingFromByteOrderMarks: true, bufferSize: 1024, leaveOpen: true))
{
return CreateText(reader, reader.CurrentEncoding, cancellationToken);
}
}
catch (DecoderFallbackException) when (encoding != Encoding.Default)
{
return null;
}
}
}
}
// Copyright (c) Microsoft. 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;
using System.IO;
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Shared.Utilities;
using Microsoft.CodeAnalysis.Text;
using Microsoft.VisualStudio.Text;
using Microsoft.VisualStudio.Utilities;
namespace Microsoft.CodeAnalysis.Editor.Implementation.Workspaces
{
[ExportWorkspaceServiceFactory(typeof(ITextFactoryService), ServiceLayer.Editor)]
[Shared]
internal class TextFactoryFactory : IWorkspaceServiceFactory
{
private readonly ITextFactoryService _singleton;
[ImportingConstructor]
public TextFactoryFactory(
ITextBufferFactoryService textBufferFactoryService,
IContentTypeRegistryService contentTypeRegistryService)
{
_singleton = new TextBufferTextFactory(textBufferFactoryService, contentTypeRegistryService);
}
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
{
return _singleton;
}
internal partial class TextBufferTextFactory : ITextFactoryService
{
private readonly ITextBufferFactoryService _textBufferFactory;
private readonly IContentType _unknownContentType;
public TextBufferTextFactory(
ITextBufferFactoryService textBufferFactoryService,
IContentTypeRegistryService contentTypeRegistryService)
{
_textBufferFactory = textBufferFactoryService;
_unknownContentType = contentTypeRegistryService.UnknownContentType;
}
public SourceText CreateText(Stream stream, Encoding defaultEncoding, CancellationToken cancellationToken = default(CancellationToken))
{
var encoding = EncodedStringText.TryReadByteOrderMark(stream)
?? defaultEncoding
?? new UTF8Encoding(encoderShouldEmitUTF8Identifier: false, throwOnInvalidBytes: true);
// Close the stream here since we might throw an exception trying to determine the encoding
using (stream)
{
return CreateTextInternal(stream, encoding, cancellationToken)
?? CreateTextInternal(stream, Encoding.Default, cancellationToken);
}
}
private SourceText CreateTextInternal(Stream stream, Encoding encoding, CancellationToken cancellationToken)
{
try
{
cancellationToken.ThrowIfCancellationRequested();
stream.Seek(0, SeekOrigin.Begin);
using (var reader = new StreamReader(stream, encoding, detectEncodingFromByteOrderMarks: true, bufferSize: 1024, leaveOpen: true))
{
var buffer = _textBufferFactory.CreateTextBuffer(reader, _unknownContentType);
return buffer.CurrentSnapshot.AsRoslynText(reader.CurrentEncoding);
}
}
catch (DecoderFallbackException) when(encoding != Encoding.Default)
{
return null;
}
}
}
}
}
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. 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;
......@@ -42,7 +42,7 @@ public static Type[] GetLanguageNeutralTypes()
typeof(Microsoft.CodeAnalysis.Text.Implementation.TextBufferFactoryService.TextBufferCloneServiceFactory),
typeof(Microsoft.CodeAnalysis.Host.MetadataServiceFactory),
typeof(Microsoft.CodeAnalysis.Host.TemporaryStorageServiceFactory),
typeof(Microsoft.CodeAnalysis.Host.TextFactoryServiceFactory),
typeof(Microsoft.CodeAnalysis.Host.TextFactoryService),
typeof(Microsoft.CodeAnalysis.Editor.Implementation.Workspaces.ProjectCacheHostServiceFactory),
typeof(Solution), // ServicesCore
typeof(Microsoft.CodeAnalysis.Options.OptionService), // Service
......
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
using System.IO;
using System.Linq;
......@@ -66,7 +66,7 @@ private void TestCreateTextInferredEncoding(byte[] bytes, Encoding defaultEncodi
return mockTextBuffer.Object;
});
var factory = new TextFactoryFactory.TextBufferTextFactory(mockTextBufferFactoryService.Object, new Mock<IContentTypeRegistryService>().Object);
var factory = new EditorTextFactoryService(mockTextBufferFactoryService.Object, new Mock<IContentTypeRegistryService>().Object);
using (var stream = new MemoryStream(bytes))
{
var text = factory.CreateText(stream, defaultEncoding);
......
......@@ -61,6 +61,9 @@ protected virtual SourceText CreateText(Stream stream, Workspace workspace)
return factory.CreateText(stream, defaultEncoding);
}
/// <summary>
/// Load a text and a version of the document in the workspace.
/// </summary>
/// <exception cref="IOException"></exception>
public override async Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken)
{
......@@ -71,10 +74,16 @@ public override async Task<TextAndVersion> LoadTextAndVersionAsync(Workspace wor
{
System.Diagnostics.Debug.Assert(stream.IsAsync);
var version = VersionStamp.Create(prevLastWriteTime);
var memoryStream = await this.ReadStreamAsync(stream, cancellationToken: cancellationToken).ConfigureAwait(false);
var text = CreateText(memoryStream, workspace);
textAndVersion = TextAndVersion.Create(text, version, path);
Contract.Requires(stream.Position == 0);
// we do this so that we asynchronously read from file. and this should allocate less for IDE case.
// but probably not for command line case where it doesn't use more sophisticated services.
using (var readStream = await SerializableBytes.CreateReadableStreamAsync(stream, cancellationToken: cancellationToken).ConfigureAwait(false))
{
var text = CreateText(readStream, workspace);
textAndVersion = TextAndVersion.Create(text, version, path);
}
}
// this has a potential to return corrupted state text if someone changed text in the middle of us reading it.
......@@ -95,17 +104,5 @@ public override async Task<TextAndVersion> LoadTextAndVersionAsync(Workspace wor
return textAndVersion;
}
private async Task<MemoryStream> ReadStreamAsync(FileStream stream, CancellationToken cancellationToken)
{
Contract.ThrowIfFalse(stream.Position == 0);
byte[] buffer = new byte[(int)stream.Length];
await stream.ReadAsync(buffer, 0, buffer.Length, cancellationToken).ConfigureAwait(continueOnCapturedContext: false);
// publiclyVisible must be true to enable optimizations in Roslyn.Compilers.TextUtilities.DetectEncodingAndDecode
return new MemoryStream(buffer, index: 0, count: buffer.Length, writable: false, publiclyVisible: true);
}
}
}
......@@ -48,6 +48,7 @@ public ITemporaryStreamStorage CreateTemporaryStreamStorage(CancellationToken ca
private class TemporaryTextStorage : ITemporaryTextStorage
{
private readonly TemporaryStorageService service;
private Encoding encoding;
private MemoryMappedInfo memoryMappedInfo;
public TemporaryTextStorage(TemporaryStorageService service)
......@@ -65,6 +66,11 @@ public void Dispose()
memoryMappedInfo.Dispose();
memoryMappedInfo = null;
}
if (encoding != null)
{
encoding = null;
}
}
public SourceText ReadText(CancellationToken cancellationToken)
......@@ -76,9 +82,12 @@ public SourceText ReadText(CancellationToken cancellationToken)
using (Logger.LogBlock(FunctionId.TemporaryStorageServiceFactory_ReadText, cancellationToken))
{
// unfortunately, there is no way to re-use stream reader. it will repeatedly re-allocate its buffer(1K).
// but most of time, this shouldn't be used that much since we consume tree directly rather than text.
using (var stream = memoryMappedInfo.CreateReadableStream())
using (var reader = new StreamReader(stream, Encoding.Unicode, detectEncodingFromByteOrderMarks: false))
{
return this.service.textFactory.CreateText(stream, Encoding.Unicode, cancellationToken);
return this.service.textFactory.CreateText(reader, encoding, cancellationToken);
}
}
}
......@@ -107,13 +116,15 @@ public void WriteText(SourceText text, CancellationToken cancellationToken)
using (Logger.LogBlock(FunctionId.TemporaryStorageServiceFactory_WriteText, cancellationToken))
{
encoding = text.Encoding;
// the method we use to get text out of SourceText uses Unicode (2bytes per char).
var size = Encoding.Unicode.GetMaxByteCount(text.Length);
memoryMappedInfo = service.memoryMappedFileManager.CreateViewInfo(size);
// Write the source text out as Unicode. We expect that to be cheap.
using (var stream = memoryMappedInfo.CreateWritableStream())
{
// PERF: Don't call text.Write(writer) directly since it can cause multiple large string
// allocations from String.Substring. Instead use one of our pooled char[] buffers.
using (var writer = new StreamWriter(stream, Encoding.Unicode))
{
text.Write(writer, cancellationToken);
......
// Copyright (c) Microsoft. 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.IO;
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Host
{
internal partial class DesktopTextFactoryServiceFactory
[ExportWorkspaceService(typeof(ITextFactoryService), ServiceLayer.Desktop), Shared]
internal class DesktopTextFactoryService : ITextFactoryService
{
public class TextFactoryService : ITextFactoryService
public SourceText CreateText(Stream stream, Encoding defaultEncoding, CancellationToken cancellationToken = default(CancellationToken))
{
public SourceText CreateText(Stream stream, Encoding defaultEncoding, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
return EncodedStringText.Create(stream, defaultEncoding);
}
cancellationToken.ThrowIfCancellationRequested();
return EncodedStringText.Create(stream, defaultEncoding);
}
public SourceText CreateText(TextReader reader, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
return SourceText.From(reader.ReadToEnd(), encoding);
}
}
}
// Copyright (c) Microsoft. 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.Mef;
namespace Microsoft.CodeAnalysis.Host
{
[ExportWorkspaceServiceFactory(typeof(ITextFactoryService), ServiceLayer.Desktop), Shared]
internal partial class DesktopTextFactoryServiceFactory : IWorkspaceServiceFactory
{
private readonly TextFactoryService singleton = new TextFactoryService();
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
{
return singleton;
}
}
}
......@@ -105,8 +105,7 @@
<Compile Include="Workspace\Host\Mef\MefV1HostServices.cs" />
<Compile Include="Workspace\Host\TemporaryStorage\TemporaryStorageServiceFactory.cs" />
<Compile Include="Workspace\Host\TemporaryStorage\TemporaryStorageServiceFactory.MemoryMappedFiles.cs" />
<Compile Include="Workspace\Host\TextFactory\TextFactoryServiceFactory.cs" />
<Compile Include="Workspace\Host\TextFactory\TextFactoryServiceFactory.TextFactoryService.cs" />
<Compile Include="Workspace\Host\TextFactory\DesktopTextFactoryService.cs" />
<Compile Include="Workspace\MSBuild\MSBuildWorkspace.cs" />
<Compile Include="Workspace\MSBuild\ProjectFile\BuildTargets.cs" />
<Compile Include="Workspace\MSBuild\ProjectFile\DocumentFileInfo.cs" />
......@@ -179,4 +178,4 @@
<Import Project="..\..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
......@@ -418,8 +418,6 @@ Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.ReadText(System.Threading.Canc
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.ReadTextAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.WriteText(Microsoft.CodeAnalysis.Text.SourceText text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
Microsoft.CodeAnalysis.Host.ITemporaryTextStorage.WriteTextAsync(Microsoft.CodeAnalysis.Text.SourceText text, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
Microsoft.CodeAnalysis.Host.ITextFactoryService
Microsoft.CodeAnalysis.Host.ITextFactoryService.CreateText(System.IO.Stream stream, System.Text.Encoding defaultEncoding, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
Microsoft.CodeAnalysis.Host.IWorkspaceService
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute
Microsoft.CodeAnalysis.Host.Mef.ExportLanguageServiceAttribute.ExportLanguageServiceAttribute(System.Type type, string language, string layer = "Default")
......@@ -1221,9 +1219,9 @@ static readonly Microsoft.CodeAnalysis.Simplification.Simplifier.SpecialTypeAnno
static readonly Microsoft.CodeAnalysis.VersionStamp.Default
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputeOperationsAsync(System.Threading.CancellationToken cancellationToken)
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.ComputePreviewOperationsAsync(System.Threading.CancellationToken cancellationToken)
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.EquivalenceKey.get
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedDocumentAsync(System.Threading.CancellationToken cancellationToken)
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.GetChangedSolutionAsync(System.Threading.CancellationToken cancellationToken)
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.EquivalenceKey.get
virtual Microsoft.CodeAnalysis.CodeActions.CodeAction.PostProcessChangesAsync(Microsoft.CodeAnalysis.Document document, System.Threading.CancellationToken cancellationToken)
virtual Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.Apply(Microsoft.CodeAnalysis.Workspace workspace, System.Threading.CancellationToken cancellationToken)
virtual Microsoft.CodeAnalysis.CodeActions.CodeActionOperation.Title.get
......@@ -1240,7 +1238,6 @@ virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.IsSupported(string lan
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.PersistentStorage.get
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.SupportedLanguages.get
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.TemporaryStorage.get
virtual Microsoft.CodeAnalysis.Host.HostWorkspaceServices.TextFactory.get
virtual Microsoft.CodeAnalysis.Workspace.AdjustReloadedProject(Microsoft.CodeAnalysis.Project oldProject, Microsoft.CodeAnalysis.Project reloadedProject)
virtual Microsoft.CodeAnalysis.Workspace.AdjustReloadedSolution(Microsoft.CodeAnalysis.Solution oldSolution, Microsoft.CodeAnalysis.Solution reloadedSolution)
virtual Microsoft.CodeAnalysis.Workspace.ApplyAdditionalDocumentAdded(Microsoft.CodeAnalysis.DocumentInfo info, Microsoft.CodeAnalysis.Text.SourceText text)
......
......@@ -242,7 +242,7 @@ public override long Seek(long offset, SeekOrigin origin)
throw new ArgumentOutOfRangeException("offset");
}
if (target < 0 || target >= length)
if (target < 0)
{
throw new ArgumentOutOfRangeException("offset");
}
......
......@@ -63,7 +63,7 @@ public virtual ITemporaryStorageService TemporaryStorage
/// <summary>
/// A factory that constructs <see cref="SourceText"/>.
/// </summary>
public virtual ITextFactoryService TextFactory
internal virtual ITextFactoryService TextFactory
{
get { return this.GetRequiredService<ITextFactoryService>(); }
}
......
......@@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Host
/// <summary>
/// A factory for creating <see cref="SourceText"/> instances.
/// </summary>
public interface ITextFactoryService : IWorkspaceService
internal interface ITextFactoryService : IWorkspaceService
{
/// <summary>
/// Creates <see cref="SourceText"/> from a stream.
......@@ -28,5 +28,13 @@ public interface ITextFactoryService : IWorkspaceService
/// </exception>
/// <exception cref="IOException">An IO error occurred while reading from the stream.</exception>
SourceText CreateText(Stream stream, Encoding defaultEncoding, CancellationToken cancellationToken = default(CancellationToken));
/// <summary>
/// Creates <see cref="SourceText"/> from a reader.
/// </summary>
/// <param name="reader">The <see cref="TextReader"/> to read the text from.</param>
/// <param name="encoding">Specifies an encoding for the <see cref="SourceText"/>SourceText.</param>
/// <param name="cancellationToken">Cancellation token.</param>
SourceText CreateText(TextReader reader, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken));
}
}
// Copyright (c) Microsoft. 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.IO;
using System.Text;
using System.Threading;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Text;
namespace Microsoft.CodeAnalysis.Host
{
internal partial class TextFactoryServiceFactory
[ExportWorkspaceService(typeof(ITextFactoryService), ServiceLayer.Default), Shared]
internal class TextFactoryService : ITextFactoryService
{
public class TextFactoryService : ITextFactoryService
public SourceText CreateText(Stream stream, Encoding defaultEncoding, CancellationToken cancellationToken = default(CancellationToken))
{
public SourceText CreateText(Stream stream, Encoding defaultEncoding, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
return SourceText.From(stream, defaultEncoding);
}
cancellationToken.ThrowIfCancellationRequested();
return SourceText.From(stream, defaultEncoding);
}
public SourceText CreateText(TextReader reader, Encoding encoding, CancellationToken cancellationToken = default(CancellationToken))
{
cancellationToken.ThrowIfCancellationRequested();
return SourceText.From(reader.ReadToEnd(), encoding);
}
}
}
// Copyright (c) Microsoft. 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.Mef;
namespace Microsoft.CodeAnalysis.Host
{
[ExportWorkspaceServiceFactory(typeof(ITextFactoryService), ServiceLayer.Default), Shared]
internal partial class TextFactoryServiceFactory : IWorkspaceServiceFactory
{
private readonly TextFactoryService singleton = new TextFactoryService();
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
{
return singleton;
}
}
}
......@@ -12,6 +12,9 @@ namespace Microsoft.CodeAnalysis
/// </summary>
public abstract class TextLoader
{
/// <summary>
/// Load a text and a version of the document in the workspace.
/// </summary>
public abstract Task<TextAndVersion> LoadTextAndVersionAsync(Workspace workspace, DocumentId documentId, CancellationToken cancellationToken);
/// <summary>
......
......@@ -829,8 +829,7 @@
<Compile Include="Workspace\Host\TemporaryStorage\TrivialTemporaryStorageService.cs" />
<Compile Include="Workspace\Host\TextFactory\ITextFactoryService.cs" />
<Compile Include="Workspace\Host\HostWorkspaceServices.cs" />
<Compile Include="Workspace\Host\TextFactory\TextFactoryServiceFactory.cs" />
<Compile Include="Workspace\Host\TextFactory\TextFactoryServiceFactory.TextFactoryService.cs" />
<Compile Include="Workspace\Host\TextFactory\TextFactoryService.cs" />
<Compile Include="Workspace\PrimaryWorkspace.cs" />
<Compile Include="LinkedFileDiffMerging\AbstractLinkedFileMergeConflictCommentAdditionService.cs" />
<Compile Include="Workspace\Solution\AdditionalTextDocument.cs" />
......@@ -935,4 +934,4 @@
<Import Project="..\..\..\..\build\VSL.Imports.Closed.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
</ImportGroup>
</Project>
</Project>
\ No newline at end of file
......@@ -20,7 +20,7 @@ public class TemporaryStorageServiceTests
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestTemporaryStorageText()
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
// test normal string
......@@ -40,7 +40,7 @@ public void TestTemporaryStorageText()
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestTemporaryStorageStream()
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
var temporaryStorage = service.CreateTemporaryStreamStorage(System.Threading.CancellationToken.None);
......@@ -85,7 +85,7 @@ private void TestTemporaryStorage(ITemporaryStorageService temporaryStorageServi
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestTemporaryTextStorageExceptions()
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
var storage = service.CreateTemporaryTextStorage(CancellationToken.None);
......@@ -105,7 +105,7 @@ public void TestTemporaryTextStorageExceptions()
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestTemporaryStreamStorageExceptions()
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
var storage = service.CreateTemporaryStreamStorage(CancellationToken.None);
......@@ -131,7 +131,7 @@ public void TestTemporaryStreamStorageExceptions()
[Fact, Trait(Traits.Feature, Traits.Features.Workspace)]
public void TestTemporaryStorageMemoryMappedFileManagement()
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
var buffer = new MemoryStream(257 * 1024 + 1);
for (int i = 0; i < buffer.Length; i++)
......@@ -181,7 +181,7 @@ public void TestTemporaryStorageScaling()
// use up our address space in a 32 bit process.
if (Environment.Is64BitOperatingSystem && !Environment.Is64BitProcess)
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
using (var data = SerializableBytes.CreateWritableStream())
......@@ -217,7 +217,7 @@ public void TestTemporaryStorageScaling()
[Fact]
public void StreamTest1()
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
var storage = service.CreateTemporaryStreamStorage(CancellationToken.None);
......@@ -247,7 +247,7 @@ public void StreamTest1()
[Fact]
public void StreamTest2()
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
var storage = service.CreateTemporaryStreamStorage(CancellationToken.None);
......@@ -287,7 +287,7 @@ public void StreamTest2()
[Fact]
public void StreamTest3()
{
var textFactory = new TextFactoryServiceFactory.TextFactoryService();
var textFactory = new TextFactoryService();
var service = new TemporaryStorageServiceFactory.TemporaryStorageService(textFactory);
var storage = service.CreateTemporaryStreamStorage(CancellationToken.None);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册