BUG: A Visual Basic Application Stops Responding While It Disconnects from the Managed Event Source (827418)
The information in this article applies to:
- Microsoft .NET Framework 1.1
- Microsoft .NET Framework 1.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
SYMPTOMSA Visual Basic application may stop responding if you follow
these steps:
- You define an event as the connection point to Component
Object Model (COM) clients in the .NET Framework component. The .NET Framework
component is the event source and raises events.
- You create an unmanaged COM client application, such as a
Microsoft Visual Basic 6.0 application, to implement the event sink
interface.
- You create WithEvents variables in the Visual Basic 6.0 application to handle events
that are raised by the event source. The WithEvents variables reference the same instance of the managed
class.
- You try to disconnect the WithEvents variables from the event source.
CAUSEThis problem occurs because Microsoft Visual Basic Virtual
Machine 6.0 (MSVBVM60) uses the Next method of the IEnumConnections interface to enumerate current connections to the connectable
object (event). In this case, the IEnumeration::Next method does not move the internal pointer to the next element
while it closes connections. This creates an infinite loop, and the Visual
Basic application stops responding while it disconnects from the event
source.RESOLUTIONTo resolve this problem, close connections to the event
source in the reverse order of the connection creation. To do so, create the
sample that is listed in the "More Information" section of this article, and
then follow these steps:
- Replace the code in the Command1_Click procedure of Form1 with the following code:
'Disconnect myButton1, myButton2 from the event source.
Set myButton2 = Nothing
Set myButton1 = Nothing
MsgBox ("Disconnected from the event source") - On the Run menu, click
Start.
- Click Command1.
STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are
listed at the beginning of this article.
REFERENCES For additional information,
click the following article number to view the article in the Microsoft
Knowledge Base: 813105
FIX: .NET Framework Implementation of IEnumConnections::Next Causes the
Client Application to Stop Responding
For more information, visit the following MSDN,
Microsoft Developer Network, Web sites:
| Modification Type: | Major | Last Reviewed: | 9/15/2003 |
|---|
| Keywords: | kbDLL kbEvent kbManaged kbCOMInterop kbbug KB827418 kbAudDeveloper |
|---|
|