waf / CSharpRepl

A command line C# REPL with syntax highlighting – explore the language, libraries and nuget packages interactively.
https://fuqua.io/CSharpRepl/
Mozilla Public License 2.0
2.76k stars 106 forks source link

`System.Diagnostics.Debug.Assert` causes crash on assertion fail #374

Open Emik03 opened 1 month ago

Emik03 commented 1 month ago

Version

C# REPL 0.6.7+d2955f13e744320cd6331c484e1286c3ed4f8612

What happened?

MRE

#define DEBUG
System.Diagnostics.Debug.Assert(false)  

STDOUT

Writing trace log to /home/emik/csharprepl-tracelog-2024-07-27.txt

Welcome to the C# REPL (Read Eval Print Loop)!
Type C# expressions and statements at the prompt and press Enter to evaluate them.
Type help to learn more, exit to quit, and clear to clear your terminal.

> #define DEBUG 
  System.Diagnostics.Debug.Assert(false)  
Process terminated. Assertion failed.
   at Submission#1.<<Initialize>>d__0.MoveNext()
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Submission#1.<Initialize>()
   at Submission#1.<Factory>(Object[] submissionArray)
   at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.CodeAnalysis.Scripting.ScriptExecutionState.RunSubmissionsAsync[TResult](ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, StrongBox`1 exceptionHolderOpt, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunSubmissionsAsync(ScriptExecutionState executionState, ImmutableArray`1 precedingExecutors, Func`2 currentExecutor, Func`2 catchExceptionOpt, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.Script`1.RunFromAsync(ScriptState previousState, Func`2 catchException, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.ScriptState.ContinueWithAsync[TResult](String code, ScriptOptions options, Func`2 catchException, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Scripting.ScriptState.ContinueWithAsync(String code, ScriptOptions options, CancellationToken cancellationToken)
   at CSharpRepl.Services.Roslyn.Scripting.ScriptRunner.EvaluateStringWithStateAsync(String text, ScriptState`1 state, InteractiveAssemblyLoader assemblyLoader, ScriptOptions scriptOptions, String[] args, CancellationToken cancellationToken) in /_/CSharpRepl.Services/Roslyn/Scripting/ScriptRunner.cs:line 135
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at CSharpRepl.Services.Roslyn.Scripting.ScriptRunner.EvaluateStringWithStateAsync(String text, ScriptState`1 state, InteractiveAssemblyLoader assemblyLoader, ScriptOptions scriptOptions, String[] args, CancellationToken cancellationToken)
   at CSharpRepl.Services.Roslyn.Scripting.ScriptRunner.RunCompilation(String text, String[] args, CancellationToken cancellationToken) in /_/CSharpRepl.Services/Roslyn/Scripting/ScriptRunner.cs:line 87
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at CSharpRepl.Services.Roslyn.Scripting.ScriptRunner.RunCompilation(String text, String[] args, CancellationToken cancellationToken)
   at CSharpRepl.Services.Roslyn.RoslynServices.EvaluateAsync(String input, String[] args, CancellationToken cancellationToken) in /_/CSharpRepl.Services/Roslyn/RoslynServices.cs:line 118
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at CSharpRepl.Services.Roslyn.RoslynServices.EvaluateAsync(String input, String[] args, CancellationToken cancellationToken)
   at CSharpRepl.ReadEvalPrintLoop.RunAsync(Configuration config) in /_/CSharpRepl/ReadEvalPrintLoop.cs:line 81
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at CSharpRepl.ReadEvalPrintLoop.RunAsync(Configuration config)
   at CSharpRepl.Program.Main(String[] args) in /_/CSharpRepl/Program.cs:line 71
   at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[TStateMachine](TStateMachine& stateMachine)
   at CSharpRepl.Program.Main(String[] args)
   at CSharpRepl.Program.<Main>(String[] args)
Aborted (core dumped)

LOG

2024-07-27T00:18:59 - Trace session starting
2024-07-27T00:18:59 - Starting background initialization
2024-07-27T00:18:59 - Discovered dotnet version .NET Core SDK 8.0.303 at /home/emik/.dotnet/sdk/8.0.303.
2024-07-27T00:18:59 - Available Reference Assemblies: "/home/emik/.dotnet/packs/Microsoft.NETCore.App.Ref": ["9.0.0-preview.2.24128.5", "5.0.0", "6.0.29", "7.0.18", "8.0.4", "9.0.0-preview.3.24172.9", "8.0.5", "6.0.30", "7.0.19", "9.0.0-preview.4.24266.19", "6.0.31", "7.0.20", "8.0.6", "9.0.0-preview.5.24306.7", "6.0.32", "8.0.7", "9.0.0-preview.6.24327.7"]
2024-07-27T00:18:59 - Available Implementation Assemblies: "/home/emik/.dotnet/shared/Microsoft.NETCore.App": ["9.0.0-preview.2.24128.5", "5.0.17", "6.0.29", "7.0.18", "8.0.4", "9.0.0-preview.3.24172.9", "8.0.5", "6.0.30", "7.0.19", "9.0.0-preview.4.24266.19", "6.0.31", "7.0.20", "8.0.6", "9.0.0-preview.5.24306.7", "6.0.32", "8.0.7", "9.0.0-preview.6.24327.7"]
2024-07-27T00:18:59 - .NET Version: Microsoft.NETCore.App / 8.0.7
2024-07-27T00:18:59 - Reference Assembly Paths: /home/emik/.dotnet/packs/Microsoft.NETCore.App.Ref/8.0.7/ref/net8.0
2024-07-27T00:18:59 - Implementation Assembly Paths: /home/emik/.dotnet/shared/Microsoft.NETCore.App/8.0.7
2024-07-27T00:18:59 - Shared Framework Paths: /home/emik/.dotnet/shared/Microsoft.NETCore.App/8.0.7
2024-07-27T00:18:59 - Loaded Reference Assemblies: "/home/emik/.dotnet/packs/Microsoft.NETCore.App.Ref/8.0.7/ref/net8.0": ["System.Net.Security.dll", "System.IO.Pipes.dll", "System.Reflection.Extensions.dll", "System.Runtime.Loader.dll", "System.Globalization.Extensions.dll", "System.Runtime.Extensions.dll", "System.Diagnostics.DiagnosticSource.dll", "System.Net.WebProxy.dll", "System.Reflection.Metadata.dll", "System.Diagnostics.TraceSource.dll", "System.IO.dll", "System.ComponentModel.Primitives.dll", "System.Security.SecureString.dll", "System.Windows.dll", "System.ComponentModel.TypeConverter.dll", "System.Web.HttpUtility.dll", "System.Runtime.CompilerServices.Unsafe.dll", "System.IO.FileSystem.Primitives.dll", "System.Text.Encoding.Extensions.dll", "System.Threading.dll", "System.Collections.Specialized.dll", "System.Net.dll", "System.Xml.XDocument.dll", "System.Dynamic.Runtime.dll", "System.Reflection.Emit.Lightweight.dll", "System.Security.Cryptography.X509Certificates.dll", "WindowsBase.dll", "System.Net.NetworkInformation.dll", "System.Security.Cryptography.Csp.dll", "System.Core.dll", "System.Reflection.Emit.ILGeneration.dll", "System.IO.Compression.dll", "System.Diagnostics.TextWriterTraceListener.dll", "System.Reflection.Emit.dll", "System.Linq.Expressions.dll", "System.Globalization.Calendars.dll", "System.Diagnostics.Tools.dll", "System.IO.FileSystem.dll", "System.Console.dll", "System.Reflection.dll", "System.Configuration.dll", "System.Linq.dll", "System.ValueTuple.dll", "System.Text.Encoding.CodePages.dll", "System.Net.ServicePoint.dll", "System.Runtime.Handles.dll", "System.Xml.dll", "System.Diagnostics.StackTrace.dll", "System.Diagnostics.Process.dll", "System.Web.dll", "System.Security.Cryptography.Cng.dll", "System.Text.Encoding.dll", "System.Runtime.Serialization.Xml.dll", "System.Net.Quic.dll", "System.Reflection.Primitives.dll", "System.IO.FileSystem.AccessControl.dll", "System.Net.Sockets.dll", "System.Threading.Channels.dll", "System.Runtime.InteropServices.RuntimeInformation.dll", "System.Threading.Tasks.Extensions.dll", "System.Net.Http.Json.dll", "System.IO.IsolatedStorage.dll", "System.Runtime.Serialization.Json.dll", "System.Security.Cryptography.OpenSsl.dll", "Microsoft.Win32.Registry.dll", "System.IO.Pipes.AccessControl.dll", "System.Memory.dll", "System.Xml.Serialization.dll", "System.Formats.Asn1.dll", "System.IO.MemoryMappedFiles.dll", "System.Reflection.TypeExtensions.dll", "System.Resources.Writer.dll", "System.Net.Ping.dll", "System.Net.WebClient.dll", "System.ComponentModel.Annotations.dll", "Microsoft.VisualBasic.Core.dll", "System.ServiceProcess.dll", "System.Net.HttpListener.dll", "System.Security.Cryptography.Primitives.dll", "System.Data.dll", "System.Net.Http.dll", "System.dll", "System.Net.Mail.dll", "System.Threading.Thread.dll", "System.Security.dll", "System.IO.Compression.FileSystem.dll", "System.Diagnostics.Debug.dll", "System.Linq.Parallel.dll", "System.Numerics.dll", "System.Resources.Reader.dll", "System.Buffers.dll", "System.Xml.Linq.dll", "System.Transactions.Local.dll", "System.ComponentModel.DataAnnotations.dll", "System.ServiceModel.Web.dll", "System.Diagnostics.Contracts.dll", "System.Xml.XmlSerializer.dll", "Microsoft.CSharp.dll", "System.ComponentModel.dll", "System.Xml.XPath.dll", "System.Security.Cryptography.dll", "Microsoft.VisualBasic.dll", "netstandard.dll", "System.Net.WebSockets.Client.dll", "System.Threading.Tasks.Dataflow.dll", "System.Reflection.DispatchProxy.dll", "System.Diagnostics.FileVersionInfo.dll", "System.Security.Principal.Windows.dll", "System.Text.Encodings.Web.dll", "System.Threading.Tasks.dll", "System.Xml.ReaderWriter.dll", "System.Threading.Overlapped.dll", "System.IO.Compression.ZipFile.dll", "System.Security.Cryptography.Algorithms.dll", "System.Text.RegularExpressions.dll", "System.Xml.XmlDocument.dll", "System.Net.WebSockets.dll", "Microsoft.Win32.Primitives.dll", "System.Collections.dll", "System.Text.Json.dll", "System.Drawing.dll", "System.Data.DataSetExtensions.dll", "System.ObjectModel.dll", "System.Security.Claims.dll", "System.Security.Cryptography.Encoding.dll", "System.Linq.Queryable.dll", "System.Security.AccessControl.dll", "System.Runtime.InteropServices.dll", "System.Collections.NonGeneric.dll", "System.Collections.Immutable.dll", "System.Formats.Tar.dll", "System.Transactions.dll", "System.Diagnostics.Tracing.dll", "System.Numerics.Vectors.dll", "System.Xml.XPath.XDocument.dll", "System.ComponentModel.EventBasedAsync.dll", "System.Runtime.Serialization.dll", "System.IO.Compression.Brotli.dll", "System.Drawing.Primitives.dll", "System.Net.NameResolution.dll", "System.Security.Principal.dll", "System.Data.Common.dll", "System.IO.FileSystem.DriveInfo.dll", "System.IO.UnmanagedMemoryStream.dll", "System.Collections.Concurrent.dll", "System.Resources.ResourceManager.dll", "mscorlib.dll", "System.Globalization.dll", "System.Net.WebHeaderCollection.dll", "System.Runtime.Serialization.Primitives.dll", "System.Runtime.Serialization.Formatters.dll", "System.Net.Primitives.dll", "System.Threading.Timer.dll", "System.Net.Requests.dll", "System.Runtime.Intrinsics.dll", "System.IO.FileSystem.Watcher.dll", "System.AppContext.dll", "System.Runtime.CompilerServices.VisualC.dll", "System.Runtime.InteropServices.JavaScript.dll", "System.Runtime.Numerics.dll", "System.Threading.Tasks.Parallel.dll", "System.Runtime.dll", "System.Threading.ThreadPool.dll"]
2024-07-27T00:18:59 - Loaded Implementation Assemblies: "/home/emik/.dotnet/shared/Microsoft.NETCore.App/8.0.7": ["System.Security.SecureString.dll", "System.Windows.dll", "System.Net.Quic.dll", "System.Reflection.Primitives.dll", "System.IO.FileSystem.AccessControl.dll", "System.Net.Sockets.dll", "System.Threading.Channels.dll", "System.Runtime.InteropServices.RuntimeInformation.dll", "System.Threading.Tasks.Extensions.dll", "System.Net.Http.Json.dll", "System.IO.IsolatedStorage.dll", "System.Runtime.Serialization.Json.dll", "System.Security.Cryptography.OpenSsl.dll", "Microsoft.Win32.Registry.dll", "System.Numerics.Vectors.dll", "System.Xml.XPath.XDocument.dll", "System.ComponentModel.EventBasedAsync.dll", "System.Web.HttpUtility.dll", "System.IO.FileSystem.Primitives.dll", "System.Threading.dll", "System.Net.dll", "System.Private.DataContractSerialization.dll", "System.Dynamic.Runtime.dll", "System.Security.Cryptography.X509Certificates.dll", "System.Net.NetworkInformation.dll", "System.Core.dll", "System.IO.Compression.dll", "System.Reflection.Emit.dll", "System.ComponentModel.DataAnnotations.dll", "System.Net.Security.dll", "System.IO.Pipes.dll", "System.Reflection.Extensions.dll", "System.Runtime.Loader.dll", "System.Globalization.Extensions.dll", "System.Runtime.Extensions.dll", "System.Private.Xml.Linq.dll", "System.Diagnostics.DiagnosticSource.dll", "System.Net.WebProxy.dll", "System.Reflection.Metadata.dll", "System.Diagnostics.TraceSource.dll", "System.IO.dll", "System.ComponentModel.Primitives.dll", "System.ServiceModel.Web.dll", "System.Xml.Serialization.dll", "System.IO.MemoryMappedFiles.dll", "System.Resources.Writer.dll", "System.Net.WebClient.dll", "Microsoft.VisualBasic.Core.dll", "System.Net.HttpListener.dll", "System.Data.dll", "System.dll", "System.Threading.Thread.dll", "System.IO.Compression.FileSystem.dll", "System.Linq.Parallel.dll", "System.Resources.Reader.dll", "System.Xml.Linq.dll", "System.Text.Encodings.Web.dll", "System.Threading.Tasks.dll", "System.Xml.ReaderWriter.dll", "System.Threading.Overlapped.dll", "System.IO.Compression.ZipFile.dll", "System.Security.Cryptography.Algorithms.dll", "System.Text.RegularExpressions.dll", "System.Xml.XmlDocument.dll", "System.Net.WebSockets.dll", "Microsoft.Win32.Primitives.dll", "System.Collections.dll", "System.Text.Json.dll", "System.Drawing.dll", "System.Data.DataSetExtensions.dll", "System.Formats.Asn1.dll", "System.Reflection.TypeExtensions.dll", "System.Net.Ping.dll", "System.ComponentModel.Annotations.dll", "System.ServiceProcess.dll", "System.Security.Cryptography.Primitives.dll", "System.Net.Http.dll", "System.Net.Mail.dll", "System.Security.dll", "System.Diagnostics.Debug.dll", "System.Numerics.dll", "System.Private.Uri.dll", "System.Buffers.dll", "System.Transactions.Local.dll", "System.Security.Principal.Windows.dll", "System.Runtime.Serialization.Formatters.dll", "System.Net.Primitives.dll", "System.Threading.Timer.dll", "System.Net.Requests.dll", "System.Runtime.Intrinsics.dll", "System.IO.FileSystem.Watcher.dll", "System.AppContext.dll", "System.Runtime.CompilerServices.VisualC.dll", "System.Runtime.InteropServices.JavaScript.dll", "System.Runtime.Numerics.dll", "System.Threading.Tasks.Parallel.dll", "System.Runtime.dll", "System.Threading.ThreadPool.dll", "System.IO.Pipes.AccessControl.dll", "System.Memory.dll", "System.Runtime.Serialization.dll", "System.IO.Compression.Brotli.dll", "System.Drawing.Primitives.dll", "System.Net.NameResolution.dll", "System.Security.Principal.dll", "System.Data.Common.dll", "System.IO.FileSystem.DriveInfo.dll", "System.IO.UnmanagedMemoryStream.dll", "System.Collections.Concurrent.dll", "System.Resources.ResourceManager.dll", "mscorlib.dll", "System.Globalization.dll", "System.Text.Encoding.dll", "System.Runtime.Serialization.Xml.dll", "System.Diagnostics.Contracts.dll", "System.Xml.XmlSerializer.dll", "Microsoft.CSharp.dll", "System.ComponentModel.dll", "System.Xml.XPath.dll", "System.Security.Cryptography.dll", "Microsoft.VisualBasic.dll", "netstandard.dll", "System.Net.WebSockets.Client.dll", "System.Threading.Tasks.Dataflow.dll", "System.Reflection.DispatchProxy.dll", "System.Diagnostics.FileVersionInfo.dll", "System.Globalization.Calendars.dll", "System.IO.FileSystem.dll", "System.Reflection.dll", "System.ComponentModel.TypeConverter.dll", "System.Runtime.CompilerServices.Unsafe.dll", "System.Text.Encoding.Extensions.dll", "System.Collections.Specialized.dll", "System.Xml.XDocument.dll", "System.Reflection.Emit.Lightweight.dll", "WindowsBase.dll", "System.Security.Cryptography.Csp.dll", "System.Reflection.Emit.ILGeneration.dll", "System.Diagnostics.TextWriterTraceListener.dll", "System.Linq.Expressions.dll", "System.Diagnostics.Tools.dll", "System.Console.dll", "System.Configuration.dll", "System.Private.Xml.dll", "System.Linq.dll", "System.ValueTuple.dll", "System.Text.Encoding.CodePages.dll", "System.Net.ServicePoint.dll", "System.Runtime.Handles.dll", "System.Xml.dll", "System.Diagnostics.StackTrace.dll", "System.Diagnostics.Process.dll", "System.Web.dll", "System.Security.Cryptography.Cng.dll", "System.Net.WebHeaderCollection.dll", "System.Runtime.Serialization.Primitives.dll", "System.Private.CoreLib.dll", "System.ObjectModel.dll", "System.Security.Claims.dll", "System.Security.Cryptography.Encoding.dll", "System.Linq.Queryable.dll", "System.Security.AccessControl.dll", "System.Runtime.InteropServices.dll", "System.Collections.NonGeneric.dll", "System.Collections.Immutable.dll", "System.Formats.Tar.dll", "System.Transactions.dll", "System.Diagnostics.Tracing.dll"]
2024-07-27T00:19:00 - MEF Default Assemblies: /home/emik/.dotnet/tools/.store/csharprepl/0.6.7/csharprepl/0.6.7/tools/net8.0/any/Microsoft.CodeAnalysis.Workspaces.dll, /home/emik/.dotnet/tools/.store/csharprepl/0.6.7/csharprepl/0.6.7/tools/net8.0/any/Microsoft.CodeAnalysis.CSharp.Workspaces.dll, /home/emik/.dotnet/tools/.store/csharprepl/0.6.7/csharprepl/0.6.7/tools/net8.0/any/Microsoft.CodeAnalysis.Features.dll, /home/emik/.dotnet/tools/.store/csharprepl/0.6.7/csharprepl/0.6.7/tools/net8.0/any/Microsoft.CodeAnalysis.CSharp.Features.dll
2024-07-27T00:19:00 - Background initialization complete
2024-07-27T00:19:00 - Warm-up Starting
2024-07-27T00:19:03 - Warm-up Complete