388 references to SourceHashAlgorithm
Microsoft.CodeAnalysis (87)
CommandLine\CommandLineArguments.cs (1)
254public SourceHashAlgorithm ChecksumAlgorithm { get; internal set; }
CommandLine\CommandLineParser.cs (4)
1207internal static SourceHashAlgorithm TryParseHashAlgorithmName(string arg) 1211return SourceHashAlgorithm.Sha1; 1216return SourceHashAlgorithm.Sha256; 1221return SourceHashAlgorithm.None;
CryptographicHashProvider.cs (12)
65internal static int GetHashSize(SourceHashAlgorithm algorithmId) 69case SourceHashAlgorithm.Sha1: 72case SourceHashAlgorithm.Sha256: 80internal static HashAlgorithm? TryGetAlgorithm(SourceHashAlgorithm algorithmId) 84case SourceHashAlgorithm.Sha1: 88case SourceHashAlgorithm.Sha256: 96internal static HashAlgorithmName GetAlgorithmName(SourceHashAlgorithm algorithmId) 100case SourceHashAlgorithm.Sha1: 104case SourceHashAlgorithm.Sha256: 216internal static ImmutableArray<byte> ComputeSourceHash(ImmutableArray<byte> bytes, SourceHashAlgorithm hashAlgorithm = SourceHashAlgorithms.Default) 228internal static ImmutableArray<byte> ComputeSourceHash(ImmutableArray<ConstantValue> constants, SourceHashAlgorithm hashAlgorithm = SourceHashAlgorithms.Default) 282internal static ImmutableArray<byte> ComputeSourceHash(IEnumerable<Blob> bytes, SourceHashAlgorithm hashAlgorithm = SourceHashAlgorithms.Default)
EmbeddedText.cs (6)
44public SourceHashAlgorithm ChecksumAlgorithm { get; } 52private EmbeddedText(string filePath, ImmutableArray<byte> checksum, SourceHashAlgorithm checksumAlgorithm, ImmutableArray<byte> blob) 136public static EmbeddedText FromStream(string filePath, Stream stream, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 175public static EmbeddedText FromBytes(string filePath, ArraySegment<byte> bytes, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
EncodedStringText.cs (8)
54/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 74SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 87SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 130SourceHashAlgorithm checksumAlgorithm, 230internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 233internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
PEWriter\DebugSourceInfo.cs (1)
34SourceHashAlgorithm checksumAlgorithm,
Syntax\SyntaxNode.cs (2)
326public SourceText GetText(Encoding? encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
Syntax\SyntaxTree.cs (2)
31private SourceHashAlgorithm _lazyHashAlgorithm; 381Debug.Assert(_lazyHashAlgorithm != default(SourceHashAlgorithm));
Text\CompositeText.cs (3)
28private CompositeText(ImmutableArray<SourceText> segments, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm) 347var algorithm = segments[i].ChecksumAlgorithm; 403var algorithm = segments[0].ChecksumAlgorithm;
Text\LargeText.cs (4)
33internal LargeText(ImmutableArray<char[]> chunks, Encoding? encodingOpt, ImmutableArray<byte> checksum, SourceHashAlgorithm checksumAlgorithm, ImmutableArray<byte> embeddedTextBlob) 50internal LargeText(ImmutableArray<char[]> chunks, Encoding? encodingOpt, SourceHashAlgorithm checksumAlgorithm) 55internal static SourceText Decode(Stream stream, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded) 81internal static SourceText Decode(TextReader reader, int length, Encoding? encodingOpt, SourceHashAlgorithm checksumAlgorithm)
Text\LargeTextWriter.cs (2)
15private readonly SourceHashAlgorithm _checksumAlgorithm; 22public LargeTextWriter(Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, int length)
Text\SourceHashAlgorithms.cs (16)
16public const SourceHashAlgorithm Default = SourceHashAlgorithm.Sha256; 23public const SourceHashAlgorithm OpenDocumentChecksumAlgorithm = Default; 28public static bool IsSupportedAlgorithm(SourceHashAlgorithm algorithm) 31SourceHashAlgorithm.Sha1 => true, 32SourceHashAlgorithm.Sha256 => true, 36public static Guid GetAlgorithmGuid(SourceHashAlgorithm algorithm) 39SourceHashAlgorithm.Sha1 => s_guidSha1, 40SourceHashAlgorithm.Sha256 => s_guidSha256, 44public static SourceHashAlgorithm GetSourceHashAlgorithm(Guid guid) 45=> (guid == s_guidSha256) ? SourceHashAlgorithm.Sha256 : 46(guid == s_guidSha1) ? SourceHashAlgorithm.Sha1 : 47SourceHashAlgorithm.None; 49private static HashAlgorithm CreateInstance(SourceHashAlgorithm algorithm) 54SourceHashAlgorithm.Sha1 => SHA1.Create(), 55SourceHashAlgorithm.Sha256 => SHA256.Create(),
Text\SourceText.cs (20)
36private readonly SourceHashAlgorithm _checksumAlgorithm; 50protected SourceText(ImmutableArray<byte> checksum = default, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, SourceTextContainer? container = null) 64internal SourceText(ImmutableArray<byte> checksum, SourceHashAlgorithm checksumAlgorithm, ImmutableArray<byte> embeddedTextBlob) 82internal static void ValidateChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 105public static SourceText From(string text, Encoding? encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 135SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 154public static SourceText From(Stream stream, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected) 183SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 225public static SourceText From(byte[] buffer, int length, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected) 253SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 384public SourceHashAlgorithm ChecksumAlgorithm => _checksumAlgorithm; 424/// If this text was constructed via <see cref="From(byte[], int, Encoding, SourceHashAlgorithm, bool, bool)"/> or 425/// <see cref="From(Stream, Encoding, SourceHashAlgorithm, bool, bool)"/>, then the canBeEmbedded arg must have 683internal static ImmutableArray<byte> CalculateChecksum(byte[] buffer, int offset, int count, SourceHashAlgorithm algorithmId) 692internal static ImmutableArray<byte> CalculateChecksum(Stream stream, SourceHashAlgorithm algorithmId)
Text\SourceTextWriter.cs (1)
14public static SourceTextWriter Create(Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, int length)
Text\StringBuilderText.cs (1)
24public StringBuilderText(StringBuilder builder, Encoding? encodingOpt, SourceHashAlgorithm checksumAlgorithm)
Text\StringText.cs (2)
27SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1,
Text\StringTextWriter.cs (2)
21private readonly SourceHashAlgorithm _checksumAlgorithm; 23public StringTextWriter(Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, int capacity)
Microsoft.CodeAnalysis.CodeStyle (8)
src\Compilers\Core\Portable\EncodedStringText.cs (8)
54/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 74SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 87SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 130SourceHashAlgorithm checksumAlgorithm, 230internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 233internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
Microsoft.CodeAnalysis.CSharp (14)
CommandLine\CSharpCommandLineParser.cs (3)
109var checksumAlgorithm = SourceHashAlgorithms.Default; 383var newChecksumAlgorithm = TryParseHashAlgorithmName(value!); 384if (newChecksumAlgorithm == SourceHashAlgorithm.None)
Syntax\CSharpSyntaxTree.cs (5)
348checksumAlgorithm: SourceHashAlgorithm.Sha1, 362SourceHashAlgorithm checksumAlgorithm) 402checksumAlgorithm: SourceHashAlgorithm.Sha1, 460return ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, diagnosticOptions, isGeneratedCode, cancellationToken); 928=> ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, diagnosticOptions, isGeneratedCode: null, cancellationToken);
Syntax\CSharpSyntaxTree.Dummy.cs (2)
19private const SourceHashAlgorithm ChecksumAlgorithm = SourceHashAlgorithm.Sha1;
Syntax\CSharpSyntaxTree.ParsedSyntaxTree.cs (2)
27private readonly SourceHashAlgorithm _checksumAlgorithm; 34SourceHashAlgorithm checksumAlgorithm,
Syntax\SyntaxFactory.cs (2)
1548=> CSharpSyntaxTree.Create((CSharpSyntaxNode)root, (CSharpParseOptions?)options ?? CSharpParseOptions.Default, path, encoding, SourceHashAlgorithm.Sha1); 1562return CSharpSyntaxTree.ParseText(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), (CSharpParseOptions?)options, path, diagnosticOptions: null, isGeneratedCode: null, cancellationToken);
Microsoft.CodeAnalysis.CSharp.CommandLine.UnitTests (4)
CommandLineTests.cs (4)
5822Assert.Equal(SourceHashAlgorithm.Sha1, parsedArgs.ChecksumAlgorithm); 5827Assert.Equal(SourceHashAlgorithm.Sha256, parsedArgs.ChecksumAlgorithm); 5833Assert.Equal(SourceHashAlgorithm.Sha256, parsedArgs.ChecksumAlgorithm); 14041context.AddSource("hint2", SourceText.From("class G2 { void F() {} }", Encoding.UTF8, checksumAlgorithm: SourceHashAlgorithm.Sha1));
Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests (1)
PdbSourceDocument\PdbSourceDocumentLoaderServiceTests.cs (1)
80var sourceDocument = new SourceDocument("goo.cs", Text.SourceHashAlgorithm.None, default, null, SourceLinkUrl: null);
Microsoft.CodeAnalysis.CSharp.Emit2.UnitTests (4)
PDB\CheckSumTest.cs (2)
34var tree1 = SyntaxFactory.ParseSyntaxTree(StringText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), path: "sha1.cs"); 35var tree256 = SyntaxFactory.ParseSyntaxTree(StringText.From(source256, Encoding.UTF8, SourceHashAlgorithm.Sha256), path: "sha256.cs");
PDB\PDBTests.cs (2)
104context.AddSource("hint2", SourceText.From("class G2 { void F() {} }", Encoding.UTF8, checksumAlgorithm: SourceHashAlgorithm.Sha256)); 106Assert.Throws<ArgumentException>(() => context.AddSource("hint3", SourceText.From("class G3 { void F() {} }", encoding: null, checksumAlgorithm: SourceHashAlgorithm.Sha256)));
Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests (9)
Syntax\Mocks\MockCSharpSyntaxTree.cs (1)
29_sourceText = source ?? SourceText.From("", Encoding.UTF8, SourceHashAlgorithm.Sha256);
Syntax\SyntaxFactoryTests.cs (2)
47Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 55Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm);
Syntax\SyntaxTreeTests.cs (6)
86SyntaxTreeFactoryKind.ParseText => CSharpSyntaxTree.ParseText(SourceText.From(source, Encoding.UTF8, SourceHashAlgorithm.Sha256), parseOptions), 87SyntaxTreeFactoryKind.Subclass => new MockCSharpSyntaxTree(root, SourceText.From(source, Encoding.UTF8, SourceHashAlgorithm.Sha256), parseOptions), 122Assert.Equal(SourceHashAlgorithm.Sha1, tree.GetText().ChecksumAlgorithm); 134Assert.Equal(SourceHashAlgorithm.Sha1, tree.GetText().ChecksumAlgorithm); 253Assert.Equal(SourceHashAlgorithm.Sha1, newText.ChecksumAlgorithm); 295Assert.Equal(SourceHashAlgorithm.Sha1, newText.ChecksumAlgorithm);
Microsoft.CodeAnalysis.CSharp.Test.Utilities (3)
CSharpTestBase.cs (2)
1095public static SyntaxTree Parse(string text, string filename = "", CSharpParseOptions options = null, Encoding encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
CSharpTestSource.cs (1)
39SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithms.Default)
Microsoft.CodeAnalysis.CSharp.Workspaces (3)
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.cs (1)
58public override SyntaxTree CreateSyntaxTree(string filePath, ParseOptions options, SourceText text, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, SyntaxNode root)
Workspace\LanguageServices\CSharpSyntaxTreeFactoryService.ParsedSyntaxTree.cs (2)
20private readonly SourceHashAlgorithm _checksumAlgorithm; 34SourceHashAlgorithm checksumAlgorithm)
Microsoft.CodeAnalysis.EditorFeatures (4)
EditAndContinue\PdbMatchingSourceTextProvider.cs (1)
127public async ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
Workspaces\EditorTextFactoryService.cs (3)
32public SourceText CreateText(Stream stream, Encoding? defaultEncoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 65public SourceText CreateText(TextReader reader, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 77private SourceText CreateTextInternal(Stream stream, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.EditorFeatures.Text (4)
Extensions.cs (1)
45internal static SourceText AsRoslynText(this ITextSnapshot textSnapshot, ITextBufferCloneService textBufferCloneServiceOpt, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm)
Extensions.SnapshotSourceText.cs (3)
38private SnapshotSourceText(ITextBufferCloneService? textBufferCloneService, ITextSnapshot editorSnapshot, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, TextBufferContainer container) 49public SnapshotSourceText(ITextBufferCloneService? textBufferCloneService, ITextImage textImage, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, TextBufferContainer? container) 267public ClosedSnapshotSourceText(ITextBufferCloneService? textBufferCloneService, ITextImage textImage, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm)
Microsoft.CodeAnalysis.EditorFeatures.UnitTests (1)
EditAndContinue\EditAndContinueLanguageServiceTests.cs (1)
270Text = SourceText.From(source3, Encoding.UTF8, SourceHashAlgorithm.Sha1)
Microsoft.CodeAnalysis.Features (21)
EditAndContinue\CommittedSolution.cs (8)
313var maybePdbHasDocument = TryReadSourceFileChecksumFromPdb(document, out var requiredChecksum, out var checksumAlgorithm); 322SourceText sourceText, string filePath, Document? currentDocument, IPdbMatchingSourceTextProvider sourceTextProvider, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 389if (TryReadSourceFileChecksumFromPdb(debugInfoReader, sourceFilePath, out var requiredChecksum, out var checksumAlgorithm) == true && 436private static bool IsMatchingSourceText(SourceText sourceText, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm) 439private static Optional<SourceText?> TryGetPdbMatchingSourceTextFromDisk(string sourceFilePath, Encoding? encoding, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm) 470private bool? TryReadSourceFileChecksumFromPdb(Document document, out ImmutableArray<byte> requiredChecksum, out SourceHashAlgorithm checksumAlgorithm) 494private static bool? TryReadSourceFileChecksumFromPdb(EditAndContinueMethodDebugInfoReader debugInfoReader, string sourceFilePath, out ImmutableArray<byte> checksum, out SourceHashAlgorithm algorithm) 508if (algorithm == SourceHashAlgorithm.None)
EditAndContinue\IPdbMatchingSourceTextProvider.cs (2)
16ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken); 27public ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
EditAndContinue\Remote\IRemoteEditAndContinueService.cs (1)
26ValueTask<string?> TryGetMatchingSourceTextAsync(RemoteServiceCallbackId callbackId, string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken);
EditAndContinue\Remote\RemoteEditAndContinueServiceProxy.cs (2)
35public ValueTask<string?> TryGetMatchingSourceTextAsync(RemoteServiceCallbackId callbackId, string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 56public async ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
MetadataAsSource\MetadataAsSourceGeneratedFileInfo.cs (1)
49public static SourceHashAlgorithm ChecksumAlgorithm => SourceHashAlgorithms.Default;
PdbSourceDocument\IPdbSourceDocumentLoaderService.cs (1)
23internal sealed record SourceFileInfo(string FilePath, string SourceDescription, TextLoader Loader, SourceHashAlgorithm ChecksumAlgorithm, bool FromRemoteLocation);
PdbSourceDocument\PdbSourceDocumentMetadataAsSourceFileProvider.cs (4)
224var projectChecksumAlgorithm = sourceDocuments[0].ChecksumAlgorithm; 307private ProjectInfo? CreateProjectInfo(Workspace workspace, Project project, ImmutableDictionary<string, string> pdbCompilationOptions, string assemblyName, string assemblyVersion, SourceHashAlgorithm checksumAlgorithm) 489internal sealed record SourceDocument(string FilePath, SourceHashAlgorithm ChecksumAlgorithm, ImmutableArray<byte> Checksum, byte[]? EmbeddedTextBytes, string? SourceLinkUrl); 491internal record struct SourceDocumentInfo(DocumentId DocumentId, Encoding Encoding, SourceHashAlgorithm ChecksumAlgorithm, ProjectId SourceProjectId, Workspace SourceWorkspace, DocumentInfo DocumentInfo);
SemanticSearch\SemanticSearchUtilities.cs (1)
64=> SourceText.From(query, Encoding.UTF8, SourceHashAlgorithm.Sha256);
Workspace\MiscellaneousFileUtilities.cs (1)
23SourceHashAlgorithm checksumAlgorithm,
Microsoft.CodeAnalysis.Features.Test.Utilities (5)
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (3)
232internal Guid EmitAndLoadLibraryToDebuggee(string source, string? sourceFilePath = null, Encoding? encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithms.Default, string assemblyName = "") 248SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithms.Default, 262SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithms.Default,
EditAndContinue\MockPdbMatchingSourceTextProvider.cs (2)
16public Func<string, ImmutableArray<byte>, SourceHashAlgorithm, string?>? TryGetMatchingSourceTextImpl { get; set; } 18public ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Features.UnitTests (13)
EditAndContinue\EditAndContinueMethodDebugInfoReaderTests.cs (1)
63var tree = CSharpTestSource.Parse(source, path: "/a/c.cs", options: TestOptions.Regular.WithNoRefSafetyRulesAttribute(), checksumAlgorithm: SourceHashAlgorithm.Sha1);
EditAndContinue\EditAndContinueWorkspaceServiceTests.cs (11)
70var sourceTreeC1 = SyntaxFactory.ParseSyntaxTree(SourceText.From(sourceBytesC1, sourceBytesC1.Length, encodingC, SourceHashAlgorithm.Sha1), TestOptions.Regular, sourceFileC.Path); 84.WithProjectChecksumAlgorithm(projectPId, SourceHashAlgorithm.Sha1); 115Assert.Equal(SourceHashAlgorithm.Sha1, solution.GetDocument(documentIdA).GetTextSynchronously(default).ChecksumAlgorithm); 116Assert.Equal(SourceHashAlgorithm.Sha1, solution.GetDocument(documentIdB).GetTextSynchronously(default).ChecksumAlgorithm); 117Assert.Equal(SourceHashAlgorithm.Sha1, solution.GetDocument(documentIdC).GetTextSynchronously(default).ChecksumAlgorithm); 118Assert.Equal(SourceHashAlgorithm.Sha1, solution.GetDocument(documentIdE).GetTextSynchronously(default).ChecksumAlgorithm); 623AddDocument("a.cs", SourceText.From(source1, Encoding.UTF8, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path); 921WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha1). 923AddDocument(documentId, "test.cs", SourceText.From(source1, encoding, SourceHashAlgorithm.Sha1), filePath: sourceFile.Path); 926var moduleId = EmitAndLoadLibraryToDebuggee(source1, sourceFilePath: sourceFile.Path, encoding: encoding, checksumAlgorithm: SourceHashAlgorithm.Sha256); 1791context.AddSource("generated.cs", SourceText.From("generated: " + additionalText, Encoding.UTF8, SourceHashAlgorithm.Sha256));
EditAndContinue\WatchHotReloadServiceTests.cs (1)
136context.AddSource("generated.cs", SourceText.From("generated: " + additionalText, Encoding.UTF8, SourceHashAlgorithm.Sha256));
Microsoft.CodeAnalysis.LanguageServer (3)
HostWorkspace\Razor\RazorDynamicFileInfoProvider.TextChangesTextLoader.cs (2)
19SourceHashAlgorithm checksumAlgorithm, 26private readonly SourceHashAlgorithm _checksumAlgorithm = checksumAlgorithm;
HostWorkspace\Razor\RazorProvideDynamicFileResponse.cs (1)
23public SourceHashAlgorithm ChecksumAlgorithm { get; set; }
Microsoft.CodeAnalysis.Rebuild (5)
CompilationOptionsReader.cs (4)
186var hashAlgorithm = 187hashAlgorithmGuid == HashAlgorithmSha1 ? SourceHashAlgorithm.Sha1 188: hashAlgorithmGuid == HashAlgorithmSha256 ? SourceHashAlgorithm.Sha256 189: SourceHashAlgorithm.None;
Records.cs (1)
21SourceHashAlgorithm HashAlgorithm,
Microsoft.CodeAnalysis.Rebuild.UnitTests (12)
BasicDeterministicKeyBuilderTests.cs (1)
30protected override SyntaxTree ParseSyntaxTree(string content, string fileName, SourceHashAlgorithm hashAlgorithm, VisualBasicParseOptions? parseOptions) =>
CSharpDeterministicKeyBuilderTests.cs (3)
27protected override SyntaxTree ParseSyntaxTree(string content, string fileName, SourceHashAlgorithm hashAlgorithm, CSharpParseOptions? parseOptions) => 77CSharpTestSource.Parse(@"System.Console.WriteLine(""Hello World"");", checksumAlgorithm: SourceHashAlgorithm.Sha1), 155checksumAlgorithm: SourceHashAlgorithm.Sha1);
DeterministicKeyBuilderTests.cs (8)
36public static SourceHashAlgorithm HashAlgorithm { get; } = SourceHashAlgorithm.Sha256; 37public static SourceHashAlgorithm[] HashAlgorithms { get; } = new[] 39SourceHashAlgorithm.Sha1, 40SourceHashAlgorithm.Sha256 183var syntaxTree = ParseSyntaxTree("", fileName: "test", SourceHashAlgorithm.Sha256, (TParseOptions)parseOptions); 261protected abstract SyntaxTree ParseSyntaxTree(string content, string fileName, SourceHashAlgorithm hashAlgorithm, TParseOptions? parseOptions = null); 280foreach (var hashAlgorithm in HashAlgorithms)
Microsoft.CodeAnalysis.Remote.ServiceHub (1)
Services\EditAndContinue\RemoteEditAndContinueService.cs (1)
62public ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Remote.Workspaces (1)
EditAndContinue\ManagedHotReloadLanguageService.cs (1)
37public ValueTask<string?> TryGetMatchingSourceTextAsync(string filePath, ImmutableArray<byte> requiredChecksum, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
Microsoft.CodeAnalysis.Test.Utilities (2)
Mocks\TestAdditionalText.cs (2)
22public TestAdditionalText(string text = "", Encoding? encoding = null, string path = "dummy", SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1)
Microsoft.CodeAnalysis.UnitTests (48)
EmbeddedTextTests.cs (26)
28Assert.Throws<ArgumentException>("checksumAlgorithm", () => EmbeddedText.FromBytes("path", new ArraySegment<byte>(new byte[0], 0, 0), SourceHashAlgorithm.None)); 54Assert.Throws<ArgumentException>("checksumAlgorithm", () => EmbeddedText.FromStream("path", new MemoryStream(), SourceHashAlgorithm.None)); 81var text = EmbeddedText.FromBytes("pathToEmpty", new ArraySegment<byte>(new byte[0], 0, 0), SourceHashAlgorithm.Sha1); 83Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 84AssertEx.Equal(SourceText.CalculateChecksum(new byte[0], 0, 0, SourceHashAlgorithm.Sha1), text.Checksum); 91var text = EmbeddedText.FromStream("pathToEmpty", new MemoryStream(new byte[0]), SourceHashAlgorithm.Sha1); 92var checksum = SourceText.CalculateChecksum(new byte[0], 0, 0, SourceHashAlgorithm.Sha1); 95Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 103var source = SourceText.From("", new UTF8Encoding(encoderShouldEmitUTF8Identifier: false), SourceHashAlgorithm.Sha1); 105var checksum = SourceText.CalculateChecksum(new byte[0], 0, 0, SourceHashAlgorithm.Sha1); 108Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 117var checksum = SourceText.CalculateChecksum(bytes, 0, bytes.Length, SourceHashAlgorithm.Sha1); 121Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 132var checksum = SourceText.CalculateChecksum(bytes, 0, bytes.Length, SourceHashAlgorithm.Sha1); 137Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 145var source = SourceText.From(SmallSource, Encoding.UTF8, SourceHashAlgorithm.Sha1); 149Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 200var expected = SourceText.From(SmallSource, Encoding.UTF8, SourceHashAlgorithm.Sha1); 203var actual = SourceText.From(new StringReader(SmallSource), SmallSource.Length, Encoding.UTF8, SourceHashAlgorithm.Sha1); 215var expected = SourceText.From(LargeSource, Encoding.UTF8, SourceHashAlgorithm.Sha1); 218var actual = SourceText.From(new StringReader(LargeSource), LargeSource.Length, Encoding.UTF8, SourceHashAlgorithm.Sha1); 236SourceText.From(new MemoryStream(bytes), Encoding.ASCII, SourceHashAlgorithm.Sha1, canBeEmbedded: true) : 237SourceText.From(bytes, bytes.Length, Encoding.ASCII, SourceHashAlgorithm.Sha1, canBeEmbedded: true); 241Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm); 242AssertEx.Equal(SourceText.CalculateChecksum(bytes, 0, bytes.Length, SourceHashAlgorithm.Sha1), source.GetChecksum()); 256Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm);
Text\LargeTextTests.cs (2)
33return LargeText.Decode(stream, encoding ?? Encoding.UTF8, SourceHashAlgorithm.Sha1, throwIfBinaryDetected: true, canBeEmbedded: false); 38return LargeText.Decode(reader, length, encoding ?? Encoding.UTF8, SourceHashAlgorithm.Sha1);
Text\SourceTextTests.cs (12)
85Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(HelloWorld).ChecksumAlgorithm); 88Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(bytes, bytes.Length).ChecksumAlgorithm); 91Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(stream).ChecksumAlgorithm); 95[InlineData(SourceHashAlgorithm.Sha1)] 96[InlineData(SourceHashAlgorithm.Sha256)] 97public void ChecksumAlgorithm1(SourceHashAlgorithm algorithm) 111var checksumAlgorithm = SourceHashAlgorithm.Sha1; 201private static SourceText FromLargeTextWriter(string source, Encoding encoding, SourceHashAlgorithm checksumAlgorithm) 252var hashAlgorithms = new[] { SourceHashAlgorithm.Sha1, SourceHashAlgorithm.Sha256 }; 265foreach (var algorithm in hashAlgorithms)
Text\StringTextDecodingTests.cs (8)
19private static SourceText CreateMemoryStreamBasedEncodedText(string text, Encoding writeEncoding, Encoding readEncodingOpt, SourceHashAlgorithm algorithm = SourceHashAlgorithm.Sha1) 26private static SourceText CreateMemoryStreamBasedEncodedText(byte[] bytes, Encoding readEncodingOpt, SourceHashAlgorithm algorithm = SourceHashAlgorithm.Sha1) 42SourceHashAlgorithm algorithm = SourceHashAlgorithm.Sha1) 134var data = CreateMemoryStreamBasedEncodedText("", Encoding.UTF8, readEncodingOpt: null, algorithm: SourceHashAlgorithm.Sha256); 161EncodedStringText.TestAccessor.Decode(stream, utf8, SourceHashAlgorithm.Sha1, throwIfBinaryDetected: false, canBeEmbedded: false);
Microsoft.CodeAnalysis.VisualBasic (10)
CommandLine\VisualBasicCommandLineParser.vb (1)
357If newChecksumAlgorithm = SourceHashAlgorithm.None Then
Syntax\SyntaxNodeFactories.vb (2)
37Return VisualBasicSyntaxTree.Create(DirectCast(root, VisualBasicSyntaxNode), If(DirectCast(options, VisualBasicParseOptions), VisualBasicParseOptions.Default), path, encoding, SourceHashAlgorithm.Sha1) 50Return ParseSyntaxTree(SourceText.From(text, encoding, SourceHashAlgorithm.Sha1), options, path, cancellationToken)
Syntax\VisualBasicSyntaxTree.DummySyntaxTree.vb (2)
16Private Const ChecksumAlgorithm As SourceHashAlgorithm = SourceHashAlgorithm.Sha1
Syntax\VisualBasicSyntaxTree.ParsedSyntaxTree.vb (2)
28Private ReadOnly _checksumAlgorithm As SourceHashAlgorithm 38checksumAlgorithm As SourceHashAlgorithm,
Syntax\VisualBasicSyntaxTree.vb (3)
174checksumAlgorithm:=SourceHashAlgorithm.Sha1, 186checksumAlgorithm As SourceHashAlgorithm) As SyntaxTree 222checksumAlgorithm:=SourceHashAlgorithm.Sha1,
Microsoft.CodeAnalysis.VisualBasic.CommandLine.UnitTests (3)
CommandLineTests.vb (3)
1909Assert.Equal(SourceHashAlgorithm.Sha1, parsedArgs.ChecksumAlgorithm) 1914Assert.Equal(SourceHashAlgorithm.Sha256, parsedArgs.ChecksumAlgorithm) 1919Assert.Equal(SourceHashAlgorithm.Sha256, parsedArgs.ChecksumAlgorithm)
Microsoft.CodeAnalysis.VisualBasic.Syntax.UnitTests (5)
Syntax\SyntaxFactoryTests.vb (2)
16Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm) 23Assert.Equal(SourceHashAlgorithm.Sha1, text.ChecksumAlgorithm)
Syntax\SyntaxTreeTests.vb (3)
18Assert.Equal(SourceHashAlgorithm.Sha1, tree.GetText().ChecksumAlgorithm) 120Assert.Equal(SourceHashAlgorithm.Sha1, newText.ChecksumAlgorithm) 160Assert.Equal(SourceHashAlgorithm.Sha1, newText.ChecksumAlgorithm)
Microsoft.CodeAnalysis.VisualBasic.Test.Utilities (1)
BasicTestSource.vb (1)
22Optional checksumAlgorithm As SourceHashAlgorithm = SourceHashAlgorithms.Default) As SyntaxTree
Microsoft.CodeAnalysis.VisualBasic.Workspaces (3)
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.ParsedSyntaxTree.vb (2)
19Private ReadOnly _checksumAlgorithm As SourceHashAlgorithm 33checksumAlgorithm As SourceHashAlgorithm)
Workspace\LanguageServices\VisualBasicSyntaxTreeFactoryService.vb (1)
73Public Overrides Function CreateSyntaxTree(filePath As String, options As ParseOptions, text As SourceText, encoding As Encoding, checksumAlgorithm As SourceHashAlgorithm, root As SyntaxNode) As SyntaxTree
Microsoft.CodeAnalysis.Workspaces (59)
Serialization\SerializableSourceText.cs (4)
185var checksumAlgorithm = (SourceHashAlgorithm)reader.ReadInt32(); 194var checksumAlgorithm = (SourceHashAlgorithm)reader.ReadInt32();
Shared\Extensions\SourceTextExtensions.cs (1)
225public static SourceText ReadFrom(ITextFactoryService textService, ObjectReader reader, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
SourceGeneration\IRemoteSourceGenerationService.cs (1)
83[property: DataMember(Order = 2)] SourceHashAlgorithm ChecksumAlgorithm);
src\Compilers\Core\Portable\EncodedStringText.cs (8)
54/// from <see cref="SourceText.From(Stream, Encoding, SourceHashAlgorithm, bool)"/> in two ways: 74SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 87SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1, 130SourceHashAlgorithm checksumAlgorithm, 230internal static SourceText Create(Stream stream, Lazy<Encoding> getEncoding, Encoding defaultEncoding, SourceHashAlgorithm checksumAlgorithm, bool canBeEmbedded) 233internal static SourceText Decode(Stream data, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, bool throwIfBinaryDetected, bool canBeEmbedded)
src\Compilers\Core\Portable\Text\SourceHashAlgorithms.cs (16)
16public const SourceHashAlgorithm Default = SourceHashAlgorithm.Sha256; 23public const SourceHashAlgorithm OpenDocumentChecksumAlgorithm = Default; 28public static bool IsSupportedAlgorithm(SourceHashAlgorithm algorithm) 31SourceHashAlgorithm.Sha1 => true, 32SourceHashAlgorithm.Sha256 => true, 36public static Guid GetAlgorithmGuid(SourceHashAlgorithm algorithm) 39SourceHashAlgorithm.Sha1 => s_guidSha1, 40SourceHashAlgorithm.Sha256 => s_guidSha256, 44public static SourceHashAlgorithm GetSourceHashAlgorithm(Guid guid) 45=> (guid == s_guidSha256) ? SourceHashAlgorithm.Sha256 : 46(guid == s_guidSha1) ? SourceHashAlgorithm.Sha1 : 47SourceHashAlgorithm.None; 49private static HashAlgorithm CreateInstance(SourceHashAlgorithm algorithm) 54SourceHashAlgorithm.Sha1 => SHA1.Create(), 55SourceHashAlgorithm.Sha256 => SHA256.Create(),
TemporaryStorage\TemporaryStorageService.cs (3)
183SourceHashAlgorithm checksumAlgorithm, 247SourceHashAlgorithm checksumAlgorithm, 253public SourceHashAlgorithm ChecksumAlgorithm => checksumAlgorithm;
Workspace\Host\SyntaxTreeFactory\AbstractSyntaxTreeFactoryService.cs (1)
20public abstract SyntaxTree CreateSyntaxTree(string filePath, ParseOptions options, SourceText text, Encoding encoding, SourceHashAlgorithm checksumAlgorithm, SyntaxNode root);
Workspace\Host\SyntaxTreeFactory\ISyntaxTreeFactoryService.cs (1)
30SyntaxTree CreateSyntaxTree(string? filePath, ParseOptions options, SourceText? text, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, SyntaxNode root);
Workspace\Host\TextFactory\ITextFactoryService.cs (2)
33SourceText CreateText(Stream stream, Encoding? defaultEncoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken); 43SourceText CreateText(TextReader reader, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken);
Workspace\Host\TextFactory\TextFactoryService.cs (2)
25public SourceText CreateText(Stream stream, Encoding? defaultEncoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken) 31public SourceText CreateText(TextReader reader, Encoding? encoding, SourceHashAlgorithm checksumAlgorithm, CancellationToken cancellationToken)
Workspace\ProjectSystem\ProjectSystemProject.cs (2)
83private SourceHashAlgorithm _checksumAlgorithm = SourceHashAlgorithms.Default; 422public SourceHashAlgorithm ChecksumAlgorithm
Workspace\Solution\DocumentState.cs (2)
305public DocumentState UpdateChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 521SourceHashAlgorithm checksumAlgorithm,
Workspace\Solution\LoadTextOptions.cs (2)
15public SourceHashAlgorithm ChecksumAlgorithm { get; } 17public LoadTextOptions(SourceHashAlgorithm checksumAlgorithm)
Workspace\Solution\ProjectInfo.cs (8)
87internal SourceHashAlgorithm ChecksumAlgorithm => Attributes.ChecksumAlgorithm; 239checksumAlgorithm: SourceHashAlgorithm.Sha1, 361internal ProjectInfo WithChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 418SourceHashAlgorithm checksumAlgorithm, 487public SourceHashAlgorithm ChecksumAlgorithm { get; } = checksumAlgorithm; 542Optional<SourceHashAlgorithm> checksumAlgorithm = default, 642var checksumAlgorithm = (SourceHashAlgorithm)reader.ReadByte();
Workspace\Solution\ProjectState.cs (3)
652public SourceHashAlgorithm ChecksumAlgorithm => this.ProjectInfo.ChecksumAlgorithm; 770public ProjectState WithChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm) 782private TextDocumentStates<DocumentState> UpdateDocumentsChecksumAlgorithm(SourceHashAlgorithm checksumAlgorithm)
Workspace\Solution\Solution.cs (1)
442internal Solution WithProjectChecksumAlgorithm(ProjectId projectId, SourceHashAlgorithm checksumAlgorithm)
Workspace\Solution\SolutionCompilationState.cs (1)
457ProjectId projectId, SourceHashAlgorithm checksumAlgorithm)
Workspace\Solution\SolutionState.cs (1)
589public StateChange WithProjectChecksumAlgorithm(ProjectId projectId, SourceHashAlgorithm checksumAlgorithm)
Microsoft.CodeAnalysis.Workspaces.MSBuild.UnitTests (3)
VisualStudioMSBuildWorkspaceTests.cs (3)
281Assert.Equal(SourceHashAlgorithm.Sha1, project.State.ChecksumAlgorithm); 283Assert.All(project.Documents, d => Assert.Equal(SourceHashAlgorithm.Sha1, d.GetTextSynchronously(default).ChecksumAlgorithm)); 284Assert.All(project.AdditionalDocuments, d => Assert.Equal(SourceHashAlgorithm.Sha1, d.GetTextSynchronously(default).ChecksumAlgorithm));
Microsoft.CodeAnalysis.Workspaces.Test.Utilities (2)
TestTextLoader.cs (1)
18public TestTextLoader(string text = "test", SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithms.Default)
Workspaces\TestHostDocument.cs (1)
64public SourceHashAlgorithm ChecksumAlgorithm { get; } = SourceHashAlgorithms.Default;
Microsoft.CodeAnalysis.Workspaces.UnitTests (39)
SolutionTests\ProjectInfoTests.cs (1)
196SolutionTestHelpers.TestProperty(instance, (old, value) => old.WithChecksumAlgorithm(value), opt => opt.ChecksumAlgorithm, SourceHashAlgorithm.None);
SolutionTests\SolutionTests.cs (38)
305Assert.Equal(SourceHashAlgorithm.Sha1, tree.GetText().ChecksumAlgorithm); 350var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1); 451var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1); 539var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1); 622var text = SourceText.From("new text without pp directives", encoding: null, SourceHashAlgorithm.Sha1); 705var text = SourceText.From("#if true", encoding: null, SourceHashAlgorithm.Sha1); 781var text = SourceText.From("new text", encoding: null, SourceHashAlgorithm.Sha1); 868var text = SourceText.From(" ", encoding: null, SourceHashAlgorithm.Sha1); 1108loader: TextLoader.From(TextAndVersion.Create(SourceText.From("class NewD1;", Encoding.UTF32, SourceHashAlgorithm.Sha256), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD1.cs"))), 1127loader: TextLoader.From(TextAndVersion.Create(SourceText.From("new text1", Encoding.UTF32, SourceHashAlgorithm.Sha256), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD1.cs"))), 1146loader: TextLoader.From(TextAndVersion.Create(SourceText.From("#new empty1", Encoding.UTF32, SourceHashAlgorithm.Sha256), VersionStamp.Create(), filePath: Path.Combine(s_projectDir, "newD1.cs"))), 1238Assert.Equal(SourceHashAlgorithm.Sha256, newText1.ChecksumAlgorithm); 1259Assert.Equal(SourceHashAlgorithm.Sha256, newAddText1.ChecksumAlgorithm); 1280Assert.Equal(SourceHashAlgorithm.Sha256, newConfigText1.ChecksumAlgorithm); 1618var textLoaderA = new TestTextLoader("class A {}", SourceHashAlgorithm.Sha1); 1619var textC = SourceText.From("class C {}", encoding: null, checksumAlgorithm: SourceHashAlgorithm.Sha1); 1623.WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha1); 1630await Verify(solution.GetRequiredDocument(documentAId), SourceHashAlgorithm.Sha1); 1631await Verify(solution.GetRequiredDocument(documentBId), SourceHashAlgorithm.Sha1); 1632await Verify(solution.GetRequiredDocument(documentCId), SourceHashAlgorithm.Sha1); 1633await Verify(solution.GetRequiredDocument(fileDocumentId), SourceHashAlgorithm.Sha1, checksumSHA1); 1636solution = solution.WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha256); 1637await Verify(solution.GetRequiredDocument(documentAId), SourceHashAlgorithm.Sha1); 1638await Verify(solution.GetRequiredDocument(documentBId), SourceHashAlgorithm.Sha1); 1639await Verify(solution.GetRequiredDocument(documentCId), SourceHashAlgorithm.Sha1); 1640await Verify(solution.GetRequiredDocument(fileDocumentId), SourceHashAlgorithm.Sha256, checksumSHA256); 1643solution = solution.WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha1); 1644await Verify(solution.GetRequiredDocument(documentAId), SourceHashAlgorithm.Sha1); 1645await Verify(solution.GetRequiredDocument(documentBId), SourceHashAlgorithm.Sha1); 1646await Verify(solution.GetRequiredDocument(documentCId), SourceHashAlgorithm.Sha1); 1647await Verify(solution.GetRequiredDocument(fileDocumentId), SourceHashAlgorithm.Sha1, checksumSHA1); 1649static async Task Verify(Document document, SourceHashAlgorithm expectedAlgorithm, byte[]? expectedChecksum = null) 2365var loader = new TestTextLoader(checksumAlgorithm: SourceHashAlgorithm.Sha1); 2373Assert.Equal(SourceHashAlgorithm.Sha1, document.GetTextSynchronously(default).ChecksumAlgorithm); 2483var root = CSharp.SyntaxFactory.ParseSyntaxTree(SourceText.From("class C {}", encoding: null, SourceHashAlgorithm.Sha1)).GetRoot(); 2484Assert.Equal(SourceHashAlgorithm.Sha1, root.SyntaxTree.GetText().ChecksumAlgorithm); 2513Assert.Equal(SourceHashAlgorithm.Sha1, root.SyntaxTree.GetText().ChecksumAlgorithm); 3773.AddDocument(did, "test", SourceText.From(language == LanguageNames.CSharp ? "class C {}" : "Class C : End Class", Encoding.UTF8, SourceHashAlgorithm.Sha256), filePath: "old path");
Microsoft.VisualStudio.LanguageServices.CSharp.UnitTests (1)
ProjectSystemShim\CPS\CSharpCompilerOptionsTests.cs (1)
188Assert.Equal(SourceHashAlgorithm.Sha1, environment.Workspace.CurrentSolution.Projects.Single().State.ChecksumAlgorithm);
Roslyn.VisualStudio.Next.UnitTests (8)
Services\ServiceHubServicesTests.cs (6)
496private static SourceText CreateText(string content, Encoding encoding = null, SourceHashAlgorithm checksumAlgorithm = SourceHashAlgorithm.Sha1) 506return SourceText.From(stream, encoding, SourceHashAlgorithm.Sha1, throwIfBinaryDetected: true); 510return SourceText.From(bytes, bytes.Length, encoding, SourceHashAlgorithm.Sha1, throwIfBinaryDetected: true); 593[("SG.cs", CreateText("X", Encoding.UTF8, checksumAlgorithm: SourceHashAlgorithm.Sha1))], 594[("SG.cs", CreateText("X", Encoding.UTF8, checksumAlgorithm: SourceHashAlgorithm.Sha256))]);
Services\SolutionServiceTests.cs (2)
262.WithProjectChecksumAlgorithm(projectId, SourceHashAlgorithm.Sha1 + version) 278Assert.Equal(SourceHashAlgorithm.Sha1 + version, project.State.ChecksumAlgorithm);
StackDepthTest (1)
Program.cs (1)
79var tree = SyntaxFactory.ParseSyntaxTree(SourceText.From(stringText, encoding: null, SourceHashAlgorithm.Sha256), parseOptions);