Buttonbase and button event firing bugged

  • Thread starter Thread starter silenius
  • Start date Start date
S

silenius

hi

with the compact framework 2
The only event which is fired by buttonbase, or button is the onclick event.
when I used the reflector on it I notice a mistake in the code of the button
base:

this is the microsoft code:

internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
PAL_ERROR pal_error1 = 0;
WM wm1 = wm;
if (wm1 == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
pal_error1 = 0x1001;
}
if (pal_error1 == null)
{
pal_error1 = base.WnProc(wm, wParam, lParam);
}
return pal_error1;
}

i think the right code should have been:

internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
PAL_ERROR pal_error1 = 0;
WM wm1 = wm;
if (wm1 == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
pal_error1 = 0x1001;
}
// 0 instead of null on the following line
if (pal_error1 == 0)
{
pal_error1 = base.WnProc(wm, wParam, lParam);
}
return pal_error1;
}

best one would have been (but maybe it is against code guideline of
microsoft) :

internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
if (wm == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
return 0x1001;
}
else
{
return base.WnProc(wm, wParam, lParam);
}
}

for now on we just create our own button derivating the control
 
No, it's not the Microsoft code. It's the code you see in reflector which
might be very different from original.

For example, PAL_ERROR is enum which is a value type and can not be null.

If you try to compile it, compiler would tell you that right away.
Conditional constructs might also look very different from original.



The normal way to report a bug would be to produce a simple repro code which
would demonstrate the issue. If you indeed see a problem, please do that.

Also, I'd like to point out you might be in violation of EULA:



(c) All other rights are reserved to Microsoft. Recipient shall not
provide, distribute, rent, lease, sell, sublicense, assign, or otherwise
transfer any portion of the Software. Recipient may not reverse engineer,
decompile or disassemble any portion of the Software, except and only to the
extent that this limitation is expressly prohibited by applicable law
notwithstanding this limitation.

Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
I don't think it's a mistake. They deliberatelly don't process any other
messages for performance considerations.
 
thanks you to inform me about the eula. I didn't remember about this part.

the strange point is that the use of reflector was advise to us by a
microsoft employe in a microsoft seminar about security one month ago.

best regards
 
I am not here to say microsoft is bad or anything. We allready remade the
button class from the picture box and all event just fire nicely,
so I don't mind anymore if there is a bug or not. I was just trying to be
nice to this community who help me a lot during this last 3 years
I have been using C# by pointing out an odd thing. Maybe the decompiler is
wrong, maybe my particular version is wrong.
It's not important for me to be wrong or right because my problem is solved.
But if i am right it would help others to know.

best regards

ps: we also have a customer service in our company, and I know we hate the
customer just keeps pretending we made a mistake.
 
I'm sorry if that upsets you. However, using tools which are "guessing" the
original code is questionable.

Don't get me wrong, reflector is a great tool, but it has good portion of
"randomness" in the output.

For example, in this case original code has just one 'if' and it has no
'null' in it. :)



In any case, we always appreciate bug reports. What is the high level issue
you see with ButtonBase?

It processes this particular message and fires an event, in other case it
passes message unprocessed to the base class.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).
 
I was wrong.

I did some more testing starting with a blank project and it worked

sorry

regards



Ilya Tumanov said:
I'm sorry if that upsets you. However, using tools which are "guessing"
the original code is questionable.

Don't get me wrong, reflector is a great tool, but it has good portion of
"randomness" in the output.

For example, in this case original code has just one 'if' and it has no
'null' in it. :)



In any case, we always appreciate bug reports. What is the high level
issue you see with ButtonBase?

It processes this particular message and fires an event, in other case it
passes message unprocessed to the base class.


Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

silenius said:
I am not here to say microsoft is bad or anything. We allready remade the
button class from the picture box and all event just fire nicely,
so I don't mind anymore if there is a bug or not. I was just trying to be
nice to this community who help me a lot during this last 3 years
I have been using C# by pointing out an odd thing. Maybe the decompiler
is wrong, maybe my particular version is wrong.
It's not important for me to be wrong or right because my problem is
solved. But if i am right it would help others to know.

best regards

ps: we also have a customer service in our company, and I know we hate
the customer just keeps pretending we made a mistake.


silenius said:
thanks you to inform me about the eula. I didn't remember about this
part.

the strange point is that the use of reflector was advise to us by a
microsoft employe in a microsoft seminar about security one month ago.

best regards





"Ilya Tumanov [MS]" <[email protected]> a écrit dans le
message de [email protected]...
No, it's not the Microsoft code. It's the code you see in reflector
which might be very different from original.

For example, PAL_ERROR is enum which is a value type and can not be
null.

If you try to compile it, compiler would tell you that right away.
Conditional constructs might also look very different from original.



The normal way to report a bug would be to produce a simple repro code
which would demonstrate the issue. If you indeed see a problem, please
do that.

Also, I'd like to point out you might be in violation of EULA:



(c) All other rights are reserved to Microsoft. Recipient shall
not provide, distribute, rent, lease, sell, sublicense, assign, or
otherwise transfer any portion of the Software. Recipient may not
reverse engineer, decompile or disassemble any portion of the Software,
except and only to the extent that this limitation is expressly
prohibited by applicable law notwithstanding this limitation.

Best regards,


Ilya

This posting is provided "AS IS" with no warranties, and confers no
rights.

*** Want to find answers instantly? Here's how... ***

1. Go to
http://groups-beta.google.com/group/microsoft.public.dotnet.framework.compactframework?hl=en
2. Type your question in the text box near "Search this group" button.
3. Hit "Search this group" button.
4. Read answer(s).

hi

with the compact framework 2
The only event which is fired by buttonbase, or button is the onclick
event.
when I used the reflector on it I notice a mistake in the code of the
button base:

this is the microsoft code:

internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
PAL_ERROR pal_error1 = 0;
WM wm1 = wm;
if (wm1 == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
pal_error1 = 0x1001;
}
if (pal_error1 == null)
{
pal_error1 = base.WnProc(wm, wParam, lParam);
}
return pal_error1;
}

i think the right code should have been:

internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
PAL_ERROR pal_error1 = 0;
WM wm1 = wm;
if (wm1 == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
pal_error1 = 0x1001;
}
// 0 instead of null on the following line
if (pal_error1 == 0)
{
pal_error1 = base.WnProc(wm, wParam, lParam);
}
return pal_error1;
}

best one would have been (but maybe it is against code guideline of
microsoft) :

internal override PAL_ERROR WnProc(WM wm, int wParam, int lParam)
{
if (wm == WM.WM_BUTTON_NOTIFYCLICKED)
{
this.OnClick(new EventArgs());
return 0x1001;
}
else
{
return base.WnProc(wm, wParam, lParam);
}
}

for now on we just create our own button derivating the control
 
Back
Top