Access Violation when modifying the AutoComplete list of ComboBox or Edit box

Article ID: 952544
Expand all | Collapse all
Source: Microsoft Support

RAPID PUBLISHING

RAPID PUBLISHING ARTICLES PROVIDE INFORMATION DIRECTLY FROM WITHIN THE MICROSOFT SUPPORT ORGANIZATION. THE INFORMATION CONTAINED HEREIN IS CREATED IN RESPONSE TO EMERGING OR UNIQUE TOPICS, OR IS INTENDED SUPPLEMENT OTHER KNOWLEDGE BASE INFORMATION.

Action

An application modifies the AutoComplete candidate list of a System.Windows.Forms.Edit control or System.Windows.Forms.ComboBox in its KeyPress, KeyDown or KeyUp event.

Result



Application throws an access violation and/or crashes.



The stack will be similar to:

# ChildEBP RetAddr
00 0012e790 75f8b05b browseui!CAutoComplete::_EditWndProc+0xfd
01 0012e7a4 773e1eaa browseui!CAutoComplete::s_EditWndProc+0x25
02 0012e800 773e20cf comctl32!CallNextSubclassProc+0x3c
03 0012e854 7e418734 comctl32!MasterSubclassProc+0x54
04 0012e880 7e418816 USER32!InternalCallWinProc+0x28
05 0012e8e8 7e41b4c0 USER32!UserCallWinProcCheckWow+0x150
06 0012e93c 7e41b50c USER32!DispatchClientMessage+0xa3
07 0012e964 7c90eae3 USER32!__fnDWORD+0x24
08 0012e988 7e41daf6 ntdll!KiUserCallbackDispatcher+0x13
09 0012e9a8 7b08c5a2 USER32!NtUserDestroyWindow+0xc

...

Cause



The control is in the middle of showing the AutoComplete list when at the same time it is being modified, resulting in the crash.



The underlying AutoComplete implementation does not allow for changing the AutoComplete candidate list object once it has been set on a window.  To allow changing the list, WinForms destroys the Edit control or ComboBox and recreates it.  This causes an exception if the underlying control is destroyed while the AutoComplete window is still use it.

Resolution

Do not modify the AutoComplete candidate list dynamically during key events.

DISCLAIMER

MICROSOFT AND/OR ITS SUPPLIERS MAKE NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY, RELIABILITY OR ACCURACY OF THE INFORMATION CONTAINED IN THE DOCUMENTS AND RELATED GRAPHICS PUBLISHED ON THIS WEBSITE (THE “MATERIALS”) FOR ANY PURPOSE. THE MATERIALS MAY INCLUDE TECHNICAL INACCURACIES OR TYPOGRAPHICAL ERRORS AND MAY BE REVISED AT ANY TIME WITHOUT NOTICE.

TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, MICROSOFT AND/OR ITS SUPPLIERS DISCLAIM AND EXCLUDE ALL REPRESENTATIONS, WARRANTIES, AND CONDITIONS WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING BUT NOT LIMITED TO REPRESENTATIONS, WARRANTIES, OR CONDITIONS OF TITLE, NON INFRINGEMENT, SATISFACTORY CONDITION OR QUALITY, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, WITH RESPECT TO THE MATERIALS.

Properties

Article ID: 952544 - Last Review: April 30, 2008 - Revision: 1.0
Keywords: 
kbnomt kbrapidpub KB952544

Give Feedback

 

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com