I'm trying to figure il code out, but cannot understand why next code crashed. When I use the same code without next row:call string [mscorlib]System.Console::ReadLine() code behavior are expected, but adding above described row force crash. What's wrong in this statement??

.assembly Hello {}
    .method public static void SomeFunction() cil managed
    {
         .entrypoint
         ldstr "Hello, world!"
         call void [mscorlib]System.Console::WriteLine(string)
         call string [mscorlib]System.Console::ReadLine()
         ret
    }
有帮助吗?

解决方案

ReadLine is returning string, so I guess there should be "pop" before ret ?

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top