|
Interesting and smart, Roger!
A further question, if we do not inser NOP, what are the additional efforts?
regards,
George
|
|
|
|
|
I think it might be impossible to do it w/o inserting the nop.
Lets say that we have an empty method that we want to modify.
public void Foo()
{
//empty
}
and lets pretend that it looks like this in memory:
1000000 ret //start and end of foo , we can only alter this single byte w/o overwriting the next methiod
1000001 start of next method
There would simply not be any space for us to insert the call to the modified method there, we can only alter 1 byte and if we alter more we start to overwrite some other method.
(But again, I do not know if my guess is how it works, but Id say it would be the easiest approach.)
|
|
|
|
|
Thanks Roger,
Your idea is cool. Let me know if you have found any related documents. I am interested in this topic.
regards,
George
|
|
|
|
|
In the debugger, you can also set breakpoints on lines like "{" "}". Breakpoints can be only set on instructions, so the C# compiler has to emit NOPs for those lines.
I don't know if edit-and-continue needs any additional NOPs.
|
|
|
|
|
Cool, Daniel!
Let us see if other people has experience to share why emitting NOP will facilitate edit-and-continue feature?
regards,
George
|
|
|
|
|
Daniel is correct, I verified this with reflector:
static void Main(string[] args)
{
if(true)
{
Console.Write("hello");
{
{
{
}
}
}
}
}
got emitted as:
.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
.maxstack 1
.locals init (
[0] bool CS$4$0000)
L_0000: nop
L_0001: ldc.i4.0
L_0002: stloc.0
L_0003: nop
L_0004: ldstr "hello"
L_0009: call void [mscorlib]System.Console::Write(string)
L_000e: nop
L_000f: nop
L_0010: nop
L_0011: nop
L_0012: nop
L_0013: nop
L_0014: nop
L_0015: nop
L_0016: ret
}
with one nop for each { and }
|
|
|
|
|
Cool, Roger!
But why NOP will facilitate edit-and-continue feature?
regards,
George
|
|
|
|
|
how can I read data from Video Capture Card
please help me
thanks .
en.mahdi
|
|
|
|
|
en.Mahdi wrote: please help me
Have you tried helping yourself yet?
google[^]
there's plenty of info there that'll help you . . .
|
|
|
|
|
|
Hi, I built an windows form application..
Now I copied the whole project folder into another location and I run it from there, it runs..
But when I make changes to the code or to the form design in this new location, it dosent do so and runs the old code..
Does it link to the older location??
How do I make this new code run from my new location without making changes to my old location or the old files??
|
|
|
|
|
Hi My Friend
In the Build menu select clean solution and then select clean "Your Project name" and after run your project and enjoy.
|
|
|
|
|
Reza Shojaee wrote: In the Build menu select clean solution and then select clean "Your Project name" and after run your project and enjoy.
Thanks for your answer...
But what does this "Clean Solution" mean??
|
|
|
|
|
I removes any intermediate files and rebuilds the whole solution from scratch.
So if you make changes and they don't get compiled (so the compiler is a little confused and has missed your changes) you have to tell it to rebuild everything.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Hi ,
In my project i have some dll (which written in c).
i want to use in my c# app. most of the function i am able to call, but following list of func. i don't know how to handle. any help is appreciated.
int foo(void *Buffer,UInt32 BufferLength,byte** Image);
and other is callback from DLL TO C# APP. (I implemented, but after callback, application crash).
|
|
|
|
|
How about:
int foo(IntPtr Buffer, int BufferLength, ref IntPtr Image);
I don't know if that will work or not, but it looks alright.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
Hi,
in addition to the above, if you need to pass a pointer to a managed object,
use the GCHandle class to pin the object, get its handle, pass it on, and when
done free the handle.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Good Day,
I wish to have a Console Application in my WinApp. I want to use it as a sort of a "Debug Window".
Is there an easy way to do this?
Thanks!
It is said that the most complex structures built by mankind are software systems. This is not generally appreciated because most people cannot see them. Maybe that's a good thing because if we saw them as buildings, we'd deem many of them unsafe.
|
|
|
|
|
goto project properties, select ouput type console application.
it will give gui+console. (which is very useful for debug).
|
|
|
|
|
Hi,
can any one guide me to How to Connect Ordacle DB via C#? Also, on the client macghine where I will deploy the final executable, do I require to provide separate oracle driver also? Or only using only the executable any client machine eill be able to connect?
Any pointers will be useful
Thanks,
Sankalp
|
|
|
|
|
Dude make a habbit of searching the answer on google before posting here
Go to www.google.co.in type there ' connect orcale c#.net' and you will find many .. links to your question ....
For a quick reference use ODBC data provider to connect to oracle database..
Regards
Dont Get Paid for the Hours you worked, Get Paid for the Work You Have Done in an Hour.
|
|
|
|
|
I have a windows form with some buttons and I am having problems setting focus on the buttons.
Basically an array of buttons gets passed in to the the form along with a default button as follows:
public void Show (Button defaultSelectedButton, Buttons[] btns)
{
foreach (Button btn in btns)
pnlButtons.Controls.Add (btn);
defaultSelectedButton.Focus();
}
however defaultSelectedButton.Focus(); does not seem to have any effect and the button with focus is always the first button that was added to pnlButtons.
Does anyone know how to apply focus to a particular button?
thanks
|
|
|
|
|
You might try first changing the foreach statement to just a for statement. Foreach statements have an odd way of going through the order of the buttons.
If that doesn't do anything, if the for loop you might try comparing a unique aspect of the defaultSelectedButton and a button in the btns array (I would use the Text property). If the unique aspects are the same then use focus.
If neither of those suggestions work, post back and I will try to find another alternative.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Why no use AddRange for adding the buttons, then you don't need a loop at all.
And of course, make sure that defaultSelectedButton is actually one of the buttons in the array, rather than a copy of.
I've just done a test and dynamically added a button to a form, then called myButton.Focus() and the newly added button does indeed get focus, so check up on the defaultSelectedButton, because it should be working.
My current favourite word is: Bacon!
-SK Genius
|
|
|
|
|
I just wanted to add that
- foreach loops the same way as you would probably yourself with a for loop (nothing strange about it, really) --> keep the foreach, because it is better readable
- Focus should work, to debug the problem, try to have a look at the ActiveControl property of your form or user control to see, which control has currently the focus and whether that control has a validate method that prevents setting of the focus to the button.
Urs
-^-^-^-^-^-^-^-
no risk no funk
|
|
|
|