-
Notifications
You must be signed in to change notification settings - Fork 128
Fix IndexOutOfRangeException #2717
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
That may be the async state machine since SimpleWasmTestRunner uses |
|
@akoeplinger thanks, I noticed that too - I still find the mangled method name surprising since it doesn't look like it gets mangled for this simple example: https://sharplab.io/#v2:EYLgtghglgdgNAFxFANgHwAICYCMBYAKAwAYACDHAVgG5CMBmcrUgYVIG9DTvSueKAbOQAc5AQB5YCAHykAstBgAKAJQc+PHlNJRSAXlLFaBTZowBOeYtXHTW0gGoDOW3fIB2Ha+4BfQj6A=. (Here the state machine type is called |
|
@sbomer it seems to be some issue with SharpLab, if I compile and disassemble the same code locally then I do get this special @ashmind how does SharpLab disassemble the IL? not using ildasm I assume? |
|
@akoeplinger It uses ReflectionDisassembler from ILSpy. |
|
@ashmind hmm weird, if I use ReflectionDisassembler in a console app with similar code like you have in SharpLab then it does disassemble the using ICSharpCode.Decompiler;
using ICSharpCode.Decompiler.Disassembler;
using ICSharpCode.Decompiler.Metadata;
using (var assemblyFile = new PEFile("_", File.OpenRead("bin/Debug/net6.0/C.dll")))
{
var output = new PlainTextOutput(Console.Out) { IndentationString = " " };
var disassembler = new ReflectionDisassembler(output, CancellationToken.None)
{
DebugInfo = null,
ShowSequencePoints = true
};
disassembler.WriteAssemblyHeader(assemblyFile);
output.WriteLine(); // empty line
disassembler.WriteModuleContents(assemblyFile);
}Is it possible to see which flags SharpLab passes to Roslyn? |
|
@akoeplinger If you use any top level statements, SharpLab will automatically switch to Something I would have to think about -- might be worth having a way to force |
|
@ashmind ahh that explains it, thanks! I think having a way to force console and maybe being able to view the options passed to Roslyn somewhere would make this clearer in the future 😄 Oh and thank you for creating sharplab, I use it all the time ❤️ |
Commit migrated from dotnet/linker@b4acac5
Forgot to check for array length in #2689.
I'll see if I can find out what methods were hitting this in dotnet/runtime#67381 (comment), to see if they need different handling.
edit: the logs from that run suggest it might have been hit for the method
SimpleWasmTestRunner.<Main>(String[]). I'm not clear on why the main method would be emitted with that name, but in any case this seems to be one example.