Break change in IE Interoperable Control Instantiation
A custom ActiveX Control, used to get computer name, made by Visual Basic preformed not properly in IE 11 but works fine on IE 8, 9 and 10.
Reviewing the source code, we found the following function:
Private Sub UserControl_ReadProperties(PropBag As PropertyBag)
gComputerName = PropBag.ReadProperty("ComputerName", "")
End Sub
The ReadProperties event attempts to read the value stored in the name of the property. So in this code we are setting the private variable gComputerName. The property is stored with the name "ComputerName". If a value has been previously set for this, it is read and assigned to gComputerName. If the property has not yet been set, as in a new control that is drawn on a form, the default value "" is read. So if a value is present, it is retrieved and assigned to our variable, otherwise the default value is assigned.
The reciprocal event is the WriteProperties event.
Private Sub UserControl_WriteProperties(PropBag As PropertyBag)
Call PropBag.WriteProperty("ComputerName", gComputerName, "")
End Sub
Whenever a property gets changed, this event is called and the new value is stored in the PropertyBag for us. These two events, ReadProperties and WriteProperties are responsible for making the properties of our ActiveX control persistent. So when a programmer adds a value for a ComputerName, it is written to the PropertyBag. Then when the program is run, the control is destroyed and recreated in the running program. As it gets initialized, the ComputerName property is read from the property bag and assigned to our internal variable. This is how the magic of property persistence occurs, even though our control is constantly getting destroyed and brought back to life through the cycle of design and run.
ReadProperties event occurs when loading an old instance of an object that has a saved state. When this event occurs, the object author can load in the saved state from pb, by calling the ReadProperty method of the PropertyBag object for each value that is to be loaded. This event occurs after the Initialize event
In IE 11, there is internal breaking change which we will introduce an action to update Property Bag after the instance was created. Therefore, ReadProperties will be called after the instances was initialized.
Unfortunately, in our code, ComputerName was set during initialization, but not set to Property Bag yet, because we have no chance to PropertyChanged procedures during initialization. Then the ReadProperties can't get property ComputerName from property bag so that set it to default value "". Hence, we can't get the expected value but an empty "" string.
-Ray Wang from APGC DSI Team