Microsoft KB Archive/811532

From BetaArchive Wiki
Knowledge Base


FIX: The Windows Forms ActiveX Control Importer (Aximp.exe) does not correctly handle default values

Article ID: 811532

Article Last Modified on 9/27/2005



APPLIES TO

  • Microsoft .NET Framework 1.0
  • Microsoft Visual Studio .NET 2002 Professional Edition
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Architect
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Enterprise Developer
  • Microsoft Visual Studio .NET 2002 Professional Edition



SYMPTOMS

The Visual Studios .NET ActiveX Control Importer, Aximp.exe, converts type definitions in a COM type library for an ActiveX control to a Windows Forms control.

Windows Forms can only host Windows Forms controls such as classes that are derived from System.Windows.Forms.Control. Aximp.exe generates a wrapper class for an ActiveX control that can be hosted on a Windows Form. This permits you to use the same design-time support and programming methodology that you use for other Windows Forms controls.

To host the ActiveX control, you must generate a wrapper control that derives from System.Windows.Forms.AxHost. This wrapper control contains an instance of the underlying ActiveX control. It can communicate with the ActiveX control, but it appears as a Windows Forms control. This generated control hosts the ActiveX control and exposes its properties, methods, and events as those of the generated control.

When a method of this type of ActiveX control has optional parameters, and you call to that method without specifying those optional parameters, the expected behavior is to pass the default value. However, a value of 0 is passed instead.

RESOLUTION

To resolve this problem, a code change was made that implements the following behavior:

  • For all the methods in an ActiveX control that have optional parameters, the wrapper class contains two overloaded methods: one that has all the optionals included, and the other that has optionals removed. The OptionalAttribute is no longer emitted. You must specify all or none of the optional parameters.
  • For indexed properties, the OptionalAttribute is no longer emitted. You must specify all parameters.

A supported fix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Apply it only to systems that are experiencing this specific problem. This fix may receive additional testing. Therefore, if you are not severely affected by this problem, Microsoft recommends that you wait for the next Visual Studio .NET service pack that contains this fix.

To resolve this problem immediately, download the fix by clicking the download link later in this article or contact Microsoft Product Support Services to obtain the fix. For a complete list of Microsoft Product Support Services phone numbers and information about support costs, visit the following Microsoft Web site:

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.


Keywords: kbbug kbfix kbqfe kbvs2002sp1sweep kbhotfixserver KB811532