KirillOsenkov / RoslynQuoter

Roslyn tool that for a given C# program shows syntax tree API calls to construct its syntax tree
http://roslynquoter.azurewebsites.net
Apache License 2.0
922 stars 118 forks source link

OutOfMemoryException on Default Code #27

Closed kdelorey closed 7 years ago

kdelorey commented 7 years ago

I imagine this isn't because of the code, but nevertheless:

Code: class C { }

Parse As=File Open parenthesis on a new line=False Closing parenthesis on a new line=False Preserve original whitespace=False Keep redundant API calls=False Do not require 'using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;'=False

System.OutOfMemoryException: Insufficient memory to continue the execution of the program. at System.Runtime.InteropServices.Marshal.AllocHGlobal(IntPtr cb) at System.Reflection.Internal.NativeHeapMemoryBlock..ctor(Int32 size) at System.Reflection.Internal.StreamMemoryBlockProvider.ReadMemoryBlockNoLock(Stream stream, Boolean isFileStream, Int64 start, Int32 size) at System.Reflection.PortableExecutable.PEReader..ctor(Stream peStream, PEStreamOptions options, Int32 size) at Microsoft.CodeAnalysis.ModuleMetadata.CreateFromStream(Stream peStream, PEStreamOptions options) at Microsoft.CodeAnalysis.MetadataReference.CreateFromFile(String path, MetadataReferenceProperties properties, DocumentationProvider documentation) at Microsoft.CodeAnalysis.Scripting.Hosting.RuntimeMetadataReferenceResolver.<>c.<.ctor>b__8_0(String path, MetadataReferenceProperties properties) at Microsoft.CodeAnalysis.Scripting.Hosting.RuntimeMetadataReferenceResolver.CreateResolvedMissingReference(String fullPath) at Microsoft.CodeAnalysis.Scripting.Hosting.RuntimeMetadataReferenceResolver.ResolveMissingAssembly(MetadataReference definition, AssemblyIdentity referenceIdentity) at Microsoft.CodeAnalysis.CommonReferenceManager2.ResolveAndBindMissingAssemblies(TCompilation compilation, ImmutableArray1 explicitAssemblies, ImmutableArray1 explicitModules, ImmutableArray1 explicitReferences, ImmutableArray1 explicitReferenceMap, MetadataReferenceResolver resolver, MetadataImportOptions importOptions, Boolean supersedeLowerVersions, ArrayBuilder1 referenceBindings, Dictionary2 assemblyReferencesBySimpleName, ImmutableArray1& allAssemblies, ImmutableArray1& metadataReferences, ImmutableArray1& resolvedReferences, DiagnosticBag resolutionDiagnostics) at Microsoft.CodeAnalysis.CommonReferenceManager2.Bind(TCompilation compilation, ImmutableArray1 explicitAssemblies, ImmutableArray1 explicitModules, ImmutableArray1 explicitReferences, ImmutableArray1 explicitReferenceMap, MetadataReferenceResolver resolverOpt, MetadataImportOptions importOptions, Boolean supersedeLowerVersions, Dictionary2 assemblyReferencesBySimpleName, ImmutableArray1& allAssemblies, ImmutableArray1& implicitlyResolvedReferences, ImmutableArray1& implicitlyResolvedReferenceMap, DiagnosticBag resolutionDiagnostics, Boolean& hasCircularReference, Int32& corLibraryIndex) at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateAndSetSourceAssemblyFullBind(CSharpCompilation compilation) at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.ReferenceManager.CreateSourceAssemblyForCompilation(CSharpCompilation compilation) at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.BindScriptClass() at System.Lazy1.CreateValue() at System.Lazy1.LazyInitValue() at System.Lazy1.get_Value() at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetEntryPointAndDiagnostics(CancellationToken cancellationToken) at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.GetEntryPoint(CancellationToken cancellationToken) at Microsoft.CodeAnalysis.CSharp.CSharpCompilation.CommonGetEntryPoint(CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.Build[T](Compilation compilation, DiagnosticBag diagnostics, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.ScriptBuilder.CreateExecutor[T](ScriptCompiler compiler, Compilation compilation, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.Script1.GetExecutor(CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Scripting.Script1.RunAsync(Object globals, Func2 catchException, CancellationToken cancellationToken) at Quoter.Evaluate(String apiCallString, Boolean normalizeWhitespace) at Quoter.AddModifyingCall(ApiCall apiCall, MethodCall methodCall) at Quoter.AddModifyingCalls(Object treeElement, ApiCall apiCall, List1 values) at Quoter.QuoteNode(SyntaxNode node, String name) at Quoter.Quote(Object treeElement, String name) at Quoter.<QuoteList>b__31_0(Object o) at System.Linq.Enumerable.WhereSelectEnumerableIterator2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Collections.Generic.List1..ctor(IEnumerable1 collection) at Quoter.QuoteList(IEnumerable syntaxList, String name) at Quoter.QuotePropertyValue(SyntaxNode node, PropertyInfo property) at Quoter.<>c__DisplayClass28_0.<QuotePropertyValues>b__2(PropertyInfo propertyInfo) at System.Linq.Enumerable.WhereSelectArrayIterator2.MoveNext() at System.Linq.Enumerable.WhereEnumerableIterator1.MoveNext() at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection) at Quoter.QuotePropertyValues(SyntaxNode node) at Quoter.QuoteNode(SyntaxNode node, String name) at Quoter.Quote(Object treeElement, String name) at Quoter.Quote(SyntaxNode node) at QuoterService.Controllers.QuoterController.Get(String sourceText, NodeKind nodeKind, Boolean openCurlyOnNewLine, Boolean closeCurlyOnNewLine, Boolean preserveOriginalWhitespace, Boolean keepRedundantApiCalls, Boolean avoidUsingStatic)

KirillOsenkov commented 7 years ago

Try checking the "Keep redundant API calls" checkbox if you see this again. Thanks.