diff --git a/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs b/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs index 4e770f5ed4349..cffc2ee993c24 100644 --- a/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs +++ b/src/Compilers/CSharp/Test/Emit/PDB/PDBTests.cs @@ -98,11 +98,11 @@ class D { void M() {} } comp.VerifyPdb(@" - - + + -", options: PdbValidationOptions.ExcludeMethods); +", format: DebugInformationFormat.PortablePdb, options: PdbValidationOptions.ExcludeMethods); } [WorkItem(846584, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/846584")] diff --git a/src/Workspaces/Core/Portable/Workspace/Solution/DocumentInfo.cs b/src/Workspaces/Core/Portable/Workspace/Solution/DocumentInfo.cs index 2a26762408556..67cfc06717bac 100644 --- a/src/Workspaces/Core/Portable/Workspace/Solution/DocumentInfo.cs +++ b/src/Workspaces/Core/Portable/Workspace/Solution/DocumentInfo.cs @@ -104,7 +104,7 @@ private DocumentInfo With( var newDocumentServiceProvider = documentServiceProvider.HasValue ? documentServiceProvider.Value : DocumentServiceProvider; if (newAttributes == Attributes && - newLoader == TextLoader && + newLoader == _textLoader && newDocumentServiceProvider == DocumentServiceProvider) { return this; diff --git a/src/Workspaces/CoreTest/SolutionTests/DocumentInfoTests.cs b/src/Workspaces/CoreTest/SolutionTests/DocumentInfoTests.cs index 0a160d0b4602a..ecfa8740c4c1b 100644 --- a/src/Workspaces/CoreTest/SolutionTests/DocumentInfoTests.cs +++ b/src/Workspaces/CoreTest/SolutionTests/DocumentInfoTests.cs @@ -8,6 +8,8 @@ using System.Collections.Immutable; using System.IO; using System.Linq; +using Microsoft.CodeAnalysis.Host; +using Microsoft.CodeAnalysis.Test.Utilities; using Microsoft.CodeAnalysis.Text; using Xunit; @@ -44,6 +46,26 @@ public void Create() Assert.Equal(SourceCodeKind.Script, info.SourceCodeKind); Assert.Same(loader, info.TextLoader); Assert.True(info.IsGenerated); + Assert.Equal(SourceHashAlgorithm.Sha256, info.ChecksumAlgorithm); + } + + [Fact] + public void Create_NullLoader() + { + var id = DocumentId.CreateNewId(ProjectId.CreateNewId()); + + var info = DocumentInfo.Create( + id, + name: "doc", + sourceCodeKind: SourceCodeKind.Script, + loader: null, + isGenerated: true); + + Assert.Equal(id, info.Id); + Assert.Equal("doc", info.Name); + Assert.Equal(SourceCodeKind.Script, info.SourceCodeKind); + Assert.Null(info.TextLoader); + Assert.True(info.IsGenerated); } [Fact] @@ -80,11 +102,14 @@ public void TestProperties() var projectId = ProjectId.CreateNewId(); var documentId = DocumentId.CreateNewId(projectId); var instance = DocumentInfo.Create(DocumentId.CreateNewId(ProjectId.CreateNewId()), "doc"); + var serviceProvider = (IDocumentServiceProvider)new TestDocumentServiceProvider(); SolutionTestHelpers.TestProperty(instance, (old, value) => old.WithId(value), opt => opt.Id, documentId, defaultThrows: true); SolutionTestHelpers.TestProperty(instance, (old, value) => old.WithName(value), opt => opt.Name, "New", defaultThrows: true); SolutionTestHelpers.TestProperty(instance, (old, value) => old.WithSourceCodeKind(value), opt => opt.SourceCodeKind, SourceCodeKind.Script); SolutionTestHelpers.TestProperty(instance, (old, value) => old.WithTextLoader(value), opt => opt.TextLoader, (TextLoader)new FileTextLoader(Path.GetTempPath(), defaultEncoding: null, SourceHashAlgorithm.Sha256)); + SolutionTestHelpers.TestProperty(instance, (old, value) => old.WithDesignTimeOnly(value), opt => opt.Attributes.DesignTimeOnly, true); + SolutionTestHelpers.TestProperty(instance, (old, value) => old.WithDocumentServiceProvider(value), opt => opt.DocumentServiceProvider, serviceProvider); SolutionTestHelpers.TestListProperty(instance, (old, value) => old.WithFolders(value), opt => opt.Folders, "folder", allowDuplicates: true); }