PRB: Filters May Not Behave as Expected when Using cVSAEventStandard

ID: Q243262


The information in this article applies to:
  • Microsoft Visual Studio, Enterprise Edition 6.0


SYMPTOMS

When firing an event from your custom component that uses cVSAEventStandard as the dwFlags parameter, the event may not show up in the Visual Studio Analyzer Event list.


CAUSE

When passing cVSAEventStandard as the dwFlags parameter of the FireEvent method, no default values are set for the following parameters:

  • SourceComponent and TargetComponent


  • SourceMachine and TargetMachine


  • SourceProcess and TargetProcess


  • SourceSession and TargetSession


  • SourceThread and TargetThread


If a filter based on these parameters is used to view or record events, the filter will evaluate to false and no events will appear in the event list.


RESOLUTION

Provide default values for these parameters, or provide your own. You can provide default values for these parameters by passing cVSAEventDefaultTarget | cVSAEventDefaultSource as the dwFlags parameter of the FireEvent method.


STATUS

This behavior is by design.


MORE INFORMATION

Consider the following code fragment. The event is being fired from the MyProc.exe process.


const int MAXPARAMS = 2;

DWORD rgTypes[ MAXPARAMS ] =
{
     //custom parameter whose value will be an ANSI string
     cVSAParameterKeyString | cVSAParameterValueANSIString,
     //standard parameter SourceMachine
     cVSAParameterValueANSIString
};

DWORD rgKeys[ MAXPARAMS ] =
{
     //custom parameter name
     (DWORD) L"CustomParam",
     //SourceMachine
     cVSAStandardParameterSourceMachine
};     

DWORD rgValues[ MAXPARAMS ] =
{
     //value for CustomParam
     (DWORD) "This is a Custom Parameter",
     //value for SourceMachine
     (DWORD) "MyPc"
};

if( S_OK == pIEventFire->IsActive() )
{
     //fire the custom event
     pIEventFire->FireEvent(MYPROC_EVENT_1,MAXPARAMS,rgKeys,rgValues,rgTypes,0, 0, cVSAEventStandard );
} 

The following filter will evaluate to false as there is no default value set for SourceProcess:

( SourceProcess = "MyProc" ) 

The following filter will evaluate to true as you have explicitly provided your own value for SourceMachine:

( SourceMachine = "MyPc" ) 

Modifying the dwFlags parameter to generate default parameters will cause both filters to evaluate to true:

pIEventFire->FireEvent(MYPROC_EVENT_1,MAXPARAMS,rgKeys,rgValues,rgTypes,0, 0, cVSAEventDefaultSource | cVSAEventDefaultTarget ); 


REFERENCES

For additional information, click the article number below to view the article in the Microsoft Knowledge Base:

Q242298 INFO: Valid Filter Fields for Visual Studio Analyzer

MSDN Library: Visual Studio 6.0 Documentation; Visual Studio Documentation; Component, Design and Analysis Tools; Visual Studio Analyzer Reference; Visual Studio Analyzer Language Reference; ISystemDebugEventFireAuto, ISystemDebugEventFire; FireEvent

Additional query words:

Keywords : kbEEdition kbVC kbVisAnalyzer kbVS600bug kbDSupport kbGrpDSTools
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbprb


Last Reviewed: January 28, 2000
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.