Thanks JB for the information.

I've already tried to use SequencePoint but I don't understand why it is 
always null. The below is my code: 


  public static int GetLineNumber(string sourceFile)
        {
            using (var _module = ModuleDefinition.ReadModule(sourceFile, 
new ReaderParameters() { ReadSymbols = true }))
            {

                foreach (TypeDefinition type in _module.Types)
                {
                    if (type.Name != MODULE_KEY_WORD)
                    {
                        foreach (MethodDefinition method in type.Methods)
                        {
                            //omit constructor
                            if (method.Name != CONSTRUCTOR_KEY_WORD)
                            {

                                //iterate all instructions in each method
                                foreach (var instruction in 
method.Body.Instructions)
                                {
                                    if (instruction.OpCode == OpCodes.Add)
                                    {
                                        //get line of code: GET NULL for 
Sequence Point
                                     *   SequencePoint seq = 
method.DebugInformation.GetSequencePoint(instruction);*



                                    }

                                }
                            }
                        }
                    }
                }
            }
            return 1;
        }

On Monday, June 25, 2018 at 10:42:03 PM UTC+1, Jb Evain wrote:
>
> Hi,
>
> This shows how to address this breaking change:
>
> http://cecil.pe/post/149243207656/mono-cecil-010-beta-1
>
> Jb
>
> On Sun, Jun 24, 2018 at 2:29 PM quy le <[email protected] <javascript:>> 
> wrote:
>
>> Dear all,
>>
>> I'm using Mono.Cecil.0.10 and in this version, the SequencePoint property 
>> which is used to determined line of code is removed. 
>>
>> My program aims to:
>>  - Read each instruction
>>  - Made some changes in the target instruction.
>>
>> I would like to specify line number of the updated instruction.
>>
>> I really appreciate your help.
>>
>> Many Thanks
>>
>> -- 
>> -- 
>> --
>> mono-cecil
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "mono-cecil" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
-- 
--
mono-cecil
--- 
You received this message because you are subscribed to the Google Groups 
"mono-cecil" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to