Hi

I am messing around with objects where I don't have the latest codebase, I have earlier versions so it's a not major problem :)

[EDIT] hmm this can easily be fixed by replacing eg CS$0$0000 with a valid variablename, right?

A few examples (just snippets)
Type casting:
private void DecryptCapabilities(Capabilities capabilities)
{
    try
    {
        int CS$0$0000 = (int) capabilities;
        this.capabilities = (Capabilities) Enum.Parse(typeof(Capabilities), CS$0$0000.ToString());
        this.applicationProtocol = (capabilities & Capabilities.ApplicationProtocol) != 0;
        this.deleteProtected = (capabilities & Capabilities.DeleteProtected) != 0;

Should have been
try
            {
                this.capabilities = (Capabilities)Enum.Parse(typeof(Capabilities), ((int)capabilities).ToString());

                this.applicationProtocol = (capabilities & BizTalkCore.Capabilities.ApplicationProtocol) != 0;
                this.deleteProtected = (capabilities & BizTalkCore.Capabilities.DeleteProtected) != 0;

Another example: Switch (also caused by typecasting)
string CS$4$0003 = bc.GetType().ToString();
                if (CS$4$0003 == null)
                {
                    return os;
                }
                if (!(CS$4$0003 == "Microsoft.VisualStudio.EFT.SendShape"))
                {
                    if (CS$4$0003 != "Microsoft.VisualStudio.EFT.ReceiveShape")
                    {
                        if (CS$4$0003 == "Microsoft.VisualStudio.EFT.VariableAssignmentShape")
                        {
                            os.ShapeType = ShapeType.VariableAssignment;
                            return os;
                        }
                        if (CS$4$0003 == "Microsoft.VisualStudio.EFT.MessageAssignmentShape")
                        {
                            os.ShapeType = ShapeType.MessageAssignment;
                        }
                        return os;
                    }
                }
                else
                {
                    os.ShapeType = ShapeType.SendShape;
                    return os;
                }

Should've been
switch (bc.GetType().ToString())
				{
					case "Microsoft.VisualStudio.EFT.SendShape": os.ShapeType = ShapeType.SendShape; break;
					case "Microsoft.VisualStudio.EFT.ReceiveShape": os.ShapeType = ShapeType.ReceiveShape; break;
					case "Microsoft.VisualStudio.EFT.VariableAssignmentShape": os.ShapeType = ShapeType.VariableAssignment; break;
					case "Microsoft.VisualStudio.EFT.MessageAssignmentShape": os.ShapeType = ShapeType.MessageAssignment; break;
				}

Please let me know if you need further information

Thanks in advance /Peter
plykkegaard
0

Comments

2 comments

  • Clive Tong
    Thanks for the feedback.

    I imagine you're running a debug build and a pdb is available?

    Reflector has an option, View->Options->Disassembler "Show Pdb symbols", which changes the decompilation to try to preserve symbols mentioned in the pdb.

    For a small cut down example, with this option checked I get a decompilation like

    string CS$4$0000 = bc.GetType().ToString();
    if (CS$4$0000 != null)
    {

    and with it unchecked, I get

    object obj2 = null;
    string str = obj2.GetType().ToString();
    if (str != null)

    which is more like the code you'd like.

    I still get a set of if statements instead of a switch and will take a look at that on Monday.
    Clive Tong
    0
  • Clive Tong
    I've logged the failure to regenerate the switch statement as issue RP-692.
    Clive Tong
    0

Add comment

Please sign in to leave a comment.