Code Monkey home page Code Monkey logo

Comments (7)

DmitryFriesen avatar DmitryFriesen commented on July 24, 2024

in file ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs

from ilspy.

dsrbecky avatar dsrbecky commented on July 24, 2024

What do you mean? Do you know how to trigger thouse?

The first one would mean inconsisten stack - that is quite forbiden in CLR. So it would mean that there is a bug in the analysis.

The second/third would mean that there is unreachable IL code - that is probably allowed, but again, it more likely means there is some scenario I did not htink of.

from ilspy.

dsrbecky avatar dsrbecky commented on July 24, 2024

Oh, I see the other bug report now...

from ilspy.

DmitryFriesen avatar DmitryFriesen commented on July 24, 2024

ILSpy_0.1.0.325_Source

IL_00e9: ldloc.1
IL_00ea: stloc.s 4
IL_00ec: ldloc.s 4
IL_00ee: brfalse.s IL_010a
IL_00f0: ldstr "-"
IL_00f5: ldloc.2
IL_00f6: callvirt instance string [mscorlib]System.Text.StringBuilder::ToString()
IL_00fb: callvirt instance string string::Trim()
IL_0100: call string string::Concat(string, string)
IL_0105: stloc.3
IL_0106: br.s IL_011a
IL_0108: br.s IL_0119   <----- Ln 235: byteCode.StackBefore == null 
IL_010a: nop
IL_010b: ldloc.2
IL_010c: callvirt instance string [mscorlib]System.Text.StringBuilder::ToString()
IL_0111: callvirt instance string string::Trim()
IL_0116: stloc.3
IL_0117: br.s IL_011a
IL_0119: nop
IL_011a: ldloc.3
IL_011b: ret

from ilspy.

dsrbecky avatar dsrbecky commented on July 24, 2024

I do not see anything that would branch to IL_0108. Is there some branch to that location somewhere else? Or is the code really just plainly unreachable? Does that come from the C# compiler?

from ilspy.

DmitryFriesen avatar DmitryFriesen commented on July 24, 2024
    IL_0000: nop
    IL_0001: ldarg.0
    IL_0002: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<string, class RaceClient.clsRunningClock> class RaceClient.clsRaceClient::mRunningClocks
    IL_0007: ldarg.1
    IL_0008: callvirt instance bool [mscorlib]System.Collections.Generic.Dictionary`2<string, RaceClient.clsRunningClock>::ContainsKey(!0)
    IL_000d: ldc.i4.0
    IL_000e: ceq
    IL_0010: stloc.1
    IL_0011: ldloc.1
    IL_0012: brfalse.s IL_001c
    IL_0014: ldstr ""
    IL_0019: stloc.0
    IL_001a: br.s IL_0053
    IL_001c: ldarg.0
    IL_001d: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<string, class RaceClient.clsRunningClock> class RaceClient.clsRaceClient::mRunningClocks
    IL_0022: ldarg.1
    IL_0023: callvirt instance !1 [mscorlib]System.Collections.Generic.Dictionary`2<string, RaceClient.clsRunningClock>::get_Item(!0)
    IL_0028: ldnull
    IL_0029: ceq
    IL_002b: ldc.i4.0
    IL_002c: ceq
    IL_002e: stloc.1
    IL_002f: ldloc.1
    IL_0030: brfalse.s IL_0049
    IL_0032: ldarg.0
    IL_0033: ldfld class [mscorlib]System.Collections.Generic.Dictionary`2<string, class RaceClient.clsRunningClock> class RaceClient.clsRaceClient::mRunningClocks
    IL_0038: ldarg.1
    IL_0039: callvirt instance !1 [mscorlib]System.Collections.Generic.Dictionary`2<string, RaceClient.clsRunningClock>::get_Item(!0)
    IL_003e: ldarg.2
    IL_003f: callvirt instance string RaceClient.clsRunningClock::get_ClockString(int32)
    IL_0044: stloc.0
    IL_0045: br.s IL_0053
    IL_0047: br.s IL_0052    <---- byteCode.StackBefore == null
    IL_0049: nop
    IL_004a: ldstr ""
    IL_004f: stloc.0
    IL_0050: br.s IL_0053
    IL_0052: nop
    IL_0053: ldloc.0
    IL_0054: ret

This is the real code and Reflector shows:
public string get_GetClock(string ClockId, [Optional, DefaultParameterValue(0)] int TimeBase)
{
if (this.mRunningClocks.ContainsKey(ClockId) && (this.mRunningClocks[ClockId] != null))
{
return this.mRunningClocks[ClockId].get_ClockString(TimeBase);
}
return "";
}

from ilspy.

dsrbecky avatar dsrbecky commented on July 24, 2024

Should be fixed in adfc7fc

Please try it.

I did not address if (branchTarget.StackBefore.Count != newStack.Count) // is true
If you can reproduce it, please open new bug report

from ilspy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.