Last active
July 5, 2020 16:37
-
-
Save johnfn/7bfe2d8412b871ce6bc86030a47a494e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.IO; | |
using System.Threading; | |
namespace testingconsole | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
while (true) | |
{ | |
Thread.Sleep(500); | |
Test(); | |
} | |
} | |
static void Test() | |
{ | |
Console.WriteLine("Hello World!"); | |
var p = new Program(); | |
Console.WriteLine(p.OtherTest()); | |
} | |
// comment out this function and comment in the one below to see the error: | |
// Unhandled exception. System.InvalidCastException: Unable to cast object of type 'System.Collections.Generic.Dictionary`2[System.Int32,System.String]' to type 'System.Int32'. | |
// at testingconsole.Program.OtherTest() | |
// at testingconsole.Program.Test() in /Users/johnfn/code/testingconsole/Program.cs:line 24 | |
// at testingconsole.Program.Main(String[] args) in /Users/johnfn/code/testingconsole/Program.cs:line 15 | |
public int OtherTest() { | |
return 5; | |
} | |
// public Dictionary<int, string> OtherTest() { | |
// return new Dictionary<int, string>(); | |
// } | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Diagnostics; | |
using System.IO; | |
using System.Threading; | |
namespace testingconsole | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
while (true) | |
{ | |
Thread.Sleep(500); | |
Test(); | |
} | |
} | |
static void Test() | |
{ | |
Console.WriteLine("Hello World."); | |
// Console.WriteLine("Hello World 2."); | |
var p = new Program(); | |
OtherTest(); | |
} | |
// Comment out this function, and comment in the second "Console.WriteLine" in Test() and the function below | |
// to cause the bug: | |
public static void OtherTest() { | |
return; | |
} | |
// public static Dictionary<int, string> OtherTest() { | |
// return new Dictionary<int, string>(); | |
// } | |
} | |
} | |
// Unhandled exception. IlCompilationException: System.AggregateException: Instruction compilation failed: 10: pop (Cannot Pop elements from an empty ImmutableStack) | |
// ---> System.InvalidOperationException: Cannot Pop elements from an empty ImmutableStack | |
// at LiveSharp.Runtime.Infrastructure.ImmutableStack`1.Pop() | |
// at LiveSharp.Runtime.IL.InstructionContext.PopStack() | |
// at LiveSharp.Runtime.IL.IlExpressionCompilerHandlers.Pop(InstructionContext ctx) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Threading; | |
namespace testingconsole | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
while (true) | |
{ | |
Thread.Sleep(500); | |
Test(); | |
} | |
} | |
static void Test() | |
{ | |
// uncomment this line to see the error | |
// var projectDirectory = Directory.GetParent(Environment.CurrentDirectory).Parent?.Parent?.FullName; | |
Console.WriteLine("Hello World!"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment