Count of Instructions in ILProcessor.Body.Instructions is 0 for namespace System.ServiceModel.Dispatcher... internal class SyncMethodInvoker... method Invoke.

17 views
Skip to first unread message

jasper

unread,
Mar 1, 2013, 2:05:56 AM3/1/13
to mono-...@googlegroups.com
Hi I just wanted to get the sequence points for the method Invoke in class SyncInvoker an internal class found in  System.ServiceModel.Dispatcher namespace which is under System.ServiceModel dll.

This is what I did

                AssemblyDefinition assembly = AssemblyDefinition.ReadAssembly(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.0\Profile\Client\System.ServiceModel.dll");
                List<SequencePoint> seqPointsIns = new List<SequencePoint>();
                
                //Gets all types of the MainModule of the assembly
                foreach(TypeDefinition type in assembly.MainModule.Types)
                {
                    if (type.Name == "SyncMethodInvoker")
                    {
                        foreach (MethodDefinition method in type.Methods)
                        {
                            if (method.Name == "Invoke")
                            {
                                var il = method.Body.GetILProcessor();
                                foreach (var item in il.Body.Instructions)
                                {
                                    if (item.SequencePoint != null)
                                    {
                                        seqPointsIns.Add(item.SequencePoint);
                                    }
                                }
                            }
                        }
                    }
                }

As you can see I try get sequence points. Here the il.Body.Instructions is 0. What is wrong and how can it be rectified.?

-Jasper
Reply all
Reply to author
Forward
0 new messages