Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Call to base constructor
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
seesharper  
View profile  
 More options Dec 23 2011, 5:44 am
From: seesharper <bernhard.rich...@gmail.com>
Date: Fri, 23 Dec 2011 02:44:34 -0800 (PST)
Local: Fri, Dec 23 2011 5:44 am
Subject: Call to base constructor
Hi!

I have this case where I need to inject code in a constructor AFTER
the call to the base constructor.

This is modifying an existing type so I do not have control over
calling the base constructor.

Is there any way I can search through the instructions and detect the
call to the base constructor.

   L_0000: ldarg.0
   L_0001: call instance void [mscorlib]System.Object::.ctor()
 -> Inject code here ........

Is there any generic way I can solve this so I can make sure my code
is injected after the call to the base constructor?

Regards

Bernhard Richter


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gábor Kozár  
View profile  
 More options Dec 23 2011, 10:54 am
From: Gábor Kozár <kozarga...@gmail.com>
Date: Fri, 23 Dec 2011 16:54:10 +0100
Local: Fri, Dec 23 2011 10:54 am
Subject: Re: [mono-cecil] Call to base constructor

That should be pretty simple. When you're modifying a constructor method,
just look for the first instruction after which the evaluation stack is
empty. That should be the constructor delegation call.

(Disclaimer: I'm not way an IL expert, so I'm not 100% sure about this, but
I'd try it this way.)

2011/12/23 seesharper <bernhard.rich...@gmail.com>


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Carlo Kok  
View profile  
 More options Dec 23 2011, 3:31 pm
From: Carlo Kok <c...@remobjects.com>
Date: Fri, 23 Dec 2011 21:31:24 +0100
Local: Fri, Dec 23 2011 3:31 pm
Subject: Re: [mono-cecil] Call to base constructor
On 23/12/2011 11:44, seesharper wrote:

Look for a *call* to a .ctor, there should be only 1. (new is used to
instantiate while call is only used for base/this calls)

--
Carlo Kok
RemObjects Software


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jb Evain  
View profile  
 More options Dec 23 2011, 4:09 pm
From: Jb Evain <jbev...@gmail.com>
Date: Fri, 23 Dec 2011 22:09:22 +0100
Local: Fri, Dec 23 2011 4:09 pm
Subject: Re: [mono-cecil] Call to base constructor
On Dec 23, 2011, at 9:31 PM, Carlo Kok wrote:

> Look for a *call* to a .ctor, there should be only 1. (new is used to instantiate while call is only used for base/this calls)

Except when creating structs with a non default ctor ;)

Jb


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »