40 references to From
BuildValidator (1)
LocalSourceResolver.cs (1)
51var sourceText = SourceText.From(fileStream, encoding: sourceTextInfo.SourceTextEncoding, checksumAlgorithm: sourceTextInfo.HashAlgorithm, canBeEmbedded: false);
Microsoft.CodeAnalysis (3)
EncodedStringText.cs (1)
156return SourceText.From(data, encoding, checksumAlgorithm, throwIfBinaryDetected, canBeEmbedded);
Text\SourceText.cs (2)
155=> From(stream, encoding, checksumAlgorithm, throwIfBinaryDetected, canBeEmbedded: false); 425/// <see cref="From(Stream, Encoding, SourceHashAlgorithm, bool, bool)"/>, then the canBeEmbedded arg must have
Microsoft.CodeAnalysis.CodeStyle (1)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
156return SourceText.From(data, encoding, checksumAlgorithm, throwIfBinaryDetected, canBeEmbedded);
Microsoft.CodeAnalysis.CSharp.Scripting (1)
CSharpScript.cs (1)
54return Script.CreateInitialScript<T>(CSharpScriptCompiler.Instance, SourceText.From(code, options?.FileEncoding), options, globalsType, assemblyLoader);
Microsoft.CodeAnalysis.Features (1)
EditAndContinue\CommittedSolution.cs (1)
449var sourceText = SourceText.From(fileStream, encoding, checksumAlgorithm);
Microsoft.CodeAnalysis.Features.Test.Utilities (1)
EditAndContinue\EditAndContinueWorkspaceTestBase.cs (1)
256var sourceText = SourceText.From(new MemoryStream(encoding.GetBytesWithPreamble(source.content)), encoding, checksumAlgorithm);
Microsoft.CodeAnalysis.Rebuild (1)
CompilationOptionsReader.cs (1)
236var embeddedText = SourceText.From(stream, encoding: sourceTextInfo.SourceTextEncoding, checksumAlgorithm: sourceTextInfo.HashAlgorithm, canBeEmbedded: true);
Microsoft.CodeAnalysis.Scripting (1)
Script.cs (1)
130return new Script<TResult>(Compiler, Builder, SourceText.From(code, options.FileEncoding), options, GlobalsType, this);
Microsoft.CodeAnalysis.UnitTests (27)
EmbeddedTextTests.cs (2)
43Assert.Throws<ArgumentException>("text", () => EmbeddedText.FromSource("path", SourceText.From(new MemoryStream(new byte[0]), Encoding.UTF8, canBeEmbedded: false))); 236SourceText.From(new MemoryStream(bytes), Encoding.ASCII, SourceHashAlgorithm.Sha1, canBeEmbedded: true) :
Text\LargeTextTests.cs (1)
123var text = SourceText.From(stream);
Text\SourceTextTests.cs (17)
64Assert.Same(s_unicode, SourceText.From(stream, s_unicode).Encoding); 65Assert.Equal(utf8NoBOM, SourceText.From(stream, null).Encoding); 78Assert.Equal(utf8BOM, SourceText.From(stream, s_unicode).Encoding); 79Assert.Equal(utf8BOM, SourceText.From(stream, null).Encoding); 91Assert.Equal(SourceHashAlgorithm.Sha1, SourceText.From(stream).ChecksumAlgorithm); 105Assert.Equal(algorithm, SourceText.From(stream, checksumAlgorithm: algorithm).ChecksumAlgorithm); 141verifyChecksumAndContentHash(SourceText.From(streamNoBOM, null, checksumAlgorithm), checksumNoBOM, expectedContentHash); 142verifyChecksumAndContentHash(SourceText.From(streamNoBOM, encodingNoBOM, checksumAlgorithm), checksumNoBOM, expectedContentHash); 143verifyChecksumAndContentHash(SourceText.From(streamNoBOM, encodingBOM, checksumAlgorithm), checksumNoBOM, expectedContentHash); 146verifyChecksumAndContentHash(SourceText.From(streamBOM, null, checksumAlgorithm), checksumBOM, expectedContentHash); 147verifyChecksumAndContentHash(SourceText.From(streamBOM, encodingNoBOM, checksumAlgorithm), checksumBOM, expectedContentHash); 148verifyChecksumAndContentHash(SourceText.From(streamBOM, encodingBOM, checksumAlgorithm), checksumBOM, expectedContentHash); 172verifyChecksumAndContentHash(fromChanges(SourceText.From(streamNoBOM, encodingNoBOM, checksumAlgorithm)), checksumNoBOM, expectedContentHash); 173verifyChecksumAndContentHash(fromChanges(SourceText.From(streamNoBOM, encodingBOM, checksumAlgorithm)), checksumBOM, expectedContentHash); 176verifyChecksumAndContentHash(fromChanges(SourceText.From(streamBOM, encodingNoBOM, checksumAlgorithm)), checksumBOM, expectedContentHash); 177verifyChecksumAndContentHash(fromChanges(SourceText.From(streamBOM, encodingBOM, checksumAlgorithm)), checksumBOM, expectedContentHash); 346Assert.Throws<InvalidDataException>(() => SourceText.From(stream, throwIfBinaryDetected: true));
Text\StringTextTest.cs (7)
75Assert.Throws<ArgumentNullException>(() => SourceText.From((Stream)null, Encoding.UTF8)); 76Assert.Throws<ArgumentException>(() => SourceText.From(new TestStream(canRead: false, canSeek: true), Encoding.UTF8)); 77Assert.Throws<NotImplementedException>(() => SourceText.From(new TestStream(canRead: true, canSeek: false), Encoding.UTF8)); 234var source = SourceText.From(new MemoryStream(bytes), Encoding.ASCII); 249var source = SourceText.From(new MemoryStream(bytes), Encoding.ASCII); 261var source = SourceText.From(new MemoryStream(bytes)); 276var source = SourceText.From(stream, Encoding.ASCII);
Microsoft.CodeAnalysis.Workspaces (1)
src\Compilers\Core\Portable\EncodedStringText.cs (1)
156return SourceText.From(data, encoding, checksumAlgorithm, throwIfBinaryDetected, canBeEmbedded);
Microsoft.VisualStudio.LanguageServices (1)
Implementation\AbstractEditorFactory.cs (1)
406return SourceText.From(stream);
Microsoft.VisualStudio.LanguageServices.Xaml (1)
Implementation\LanguageServer\Handler\Definitions\GoToDefinitionHandler.cs (1)
130var sourceText = SourceText.From(fileStream);