-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added max file limit when reading text file from disk.
this is added so that we can reduce chance of OOM when user added massive size text file to solution. current default max is 100MB. but user can override it through hidden reg key if they want to. if such file is added, FileTextLoader will throw InvalidDataException and Workspace will raise Workspace Failed event. in VS host case, we will show the failed event in output windows. made it to use test option service since option is mutable workspace state which affects all other tests.
- Loading branch information
1 parent
dee2f95
commit e83cd71
Showing
8 changed files
with
167 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
src/Workspaces/CoreTest/Host/WorkspaceServices/TestOptionsServiceFactory.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// 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; | ||
using System.Collections.Immutable; | ||
using System.Composition; | ||
using Microsoft.CodeAnalysis.Host; | ||
using Microsoft.CodeAnalysis.Host.Mef; | ||
using Microsoft.CodeAnalysis.Options; | ||
using Microsoft.CodeAnalysis.Options.Providers; | ||
using Roslyn.Utilities; | ||
|
||
namespace Microsoft.CodeAnalysis.UnitTests | ||
{ | ||
[ExportWorkspaceServiceFactory(typeof(IOptionService), ServiceLayer.Host), Shared] | ||
internal class TestOptionsServiceFactory : IWorkspaceServiceFactory | ||
{ | ||
private readonly ImmutableArray<Lazy<IOptionProvider>> _providers; | ||
|
||
[ImportingConstructor] | ||
public TestOptionsServiceFactory( | ||
[ImportMany] IEnumerable<Lazy<IOptionProvider>> optionProviders) | ||
{ | ||
_providers = optionProviders.ToImmutableArray(); | ||
} | ||
|
||
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) | ||
{ | ||
// give out new option service per workspace | ||
return new OptionServiceFactory.OptionService( | ||
new GlobalOptionService(_providers, SpecializedCollections.EmptyEnumerable<Lazy<IOptionPersister>>()), | ||
workspaceServices); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters