Click here to Skip to main content
15,891,828 members
Home / Discussions / C#
   

C#

 
GeneralRe: Edit and continue feature Pin
George_George26-Apr-08 22:49
George_George26-Apr-08 22:49 
GeneralRe: Edit and continue feature Pin
Anthony Mushrow27-Apr-08 0:37
professionalAnthony Mushrow27-Apr-08 0:37 
GeneralRe: Edit and continue feature Pin
George_George27-Apr-08 1:42
George_George27-Apr-08 1:42 
GeneralRe: Edit and continue feature Pin
Anthony Mushrow27-Apr-08 2:10
professionalAnthony Mushrow27-Apr-08 2:10 
GeneralRe: Edit and continue feature Pin
George_George27-Apr-08 2:21
George_George27-Apr-08 2:21 
GeneralA new idea Pin
Anthony Mushrow27-Apr-08 2:15
professionalAnthony Mushrow27-Apr-08 2:15 
GeneralRe: A new idea Pin
George_George27-Apr-08 2:25
George_George27-Apr-08 2:25 
GeneralRe: Edit and continue feature [modified] Pin
Roger Alsing27-Apr-08 2:38
Roger Alsing27-Apr-08 2:38 
Here is my guess:

If the compiler inserts a few nops at the _begining_ of a method, it can then replace those nops with a call + ret to another method.

thus it can re emit the entire method with all the changes, and just make a redirect from the original method to the altered method. thus not having to worry about adding too many or removing operands in the original body.

eg (pseudo):

original:

public int Foo()
{
    nop
    Console.Write("hello");
    return 1;
}


altered:

public int Foo()
{
    return RuntimeModifiedFoo(); //replaced nop with this call and return

    //will not execute
    Console.Write("hello");
    return 1;
}

//runtime emitted:
public int RuntimeModifiedFoo()
{
    Console.Write("hello");
    Console.WriteLine ("modified method");
    return 123;
}


And if you edit even more, it simply replace the first "return RuntimeModifiedFoo();" with a "return RuntimeModifiedFoo#2();"

MS introduced DynamicMethod http://msdn2.microsoft.com/en-us/library/system.reflection.emit.dynamicmethod.aspx[^]

in .NET 2, and that was at the same time as C# got edit and continue..

My 2 cents Smile | :)


modified on Sunday, April 27, 2008 8:47 AM

GeneralRe: Edit and continue feature Pin
George_George27-Apr-08 2:49
George_George27-Apr-08 2:49 
GeneralRe: Edit and continue feature Pin
Roger Alsing27-Apr-08 3:07
Roger Alsing27-Apr-08 3:07 
GeneralRe: Edit and continue feature Pin
George_George27-Apr-08 3:30
George_George27-Apr-08 3:30 
GeneralRe: Edit and continue feature Pin
Daniel Grunwald27-Apr-08 11:59
Daniel Grunwald27-Apr-08 11:59 
GeneralRe: Edit and continue feature Pin
George_George27-Apr-08 17:40
George_George27-Apr-08 17:40 
GeneralRe: Edit and continue feature Pin
Roger Alsing27-Apr-08 20:56
Roger Alsing27-Apr-08 20:56 
GeneralRe: Edit and continue feature Pin
George_George27-Apr-08 21:14
George_George27-Apr-08 21:14 
Questionhow can I read data from Video Capture Card? Pin
en.Mahdi26-Apr-08 22:05
en.Mahdi26-Apr-08 22:05 
AnswerRe: how can I read data from Video Capture Card? Pin
Jimmanuel27-Apr-08 2:46
Jimmanuel27-Apr-08 2:46 
GeneralRe: how can I read data from Video Capture Card? Pin
Bert delaVega29-Apr-08 6:05
Bert delaVega29-Apr-08 6:05 
GeneralProject Copy Problems.. Pin
som.nitk26-Apr-08 21:21
som.nitk26-Apr-08 21:21 
GeneralRe: Project Copy Problems.. Pin
Reza Shojaee26-Apr-08 21:40
Reza Shojaee26-Apr-08 21:40 
QuestionRe: Project Copy Problems.. Pin
som.nitk27-Apr-08 0:28
som.nitk27-Apr-08 0:28 
GeneralRe: Project Copy Problems.. Pin
Anthony Mushrow27-Apr-08 0:34
professionalAnthony Mushrow27-Apr-08 0:34 
GeneralDLL IMPORT - PINVOKE... Pin
temp555626-Apr-08 20:58
temp555626-Apr-08 20:58 
GeneralRe: DLL IMPORT - PINVOKE... Pin
Anthony Mushrow27-Apr-08 0:30
professionalAnthony Mushrow27-Apr-08 0:30 
GeneralRe: DLL IMPORT - PINVOKE... Pin
Luc Pattyn27-Apr-08 0:41
sitebuilderLuc Pattyn27-Apr-08 0:41 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.