Ask a Question

I am trying to add several source files to a profiling area in C++ in Visual Studio2015.

SOLVED
arthurqv
Occasional Contributor

I am trying to add several source files to a profiling area in C++ in Visual Studio2015.

I tried to mimic the VB script example, but my program always crashes when I try to add a second item to my created area. If I only add one item, it works fine. Does anybody have a C++ VS2015 example for adding items to an area using Area Manager?

My code looks like this:

 for (long i = 0; i < modCount; i++)
            {
                long itemCount;
                BSTR FullName = 0;;
                hr = DebugInfoManager->get_Module(i, &modObject);
                hr = modObject->get_ItemCount(dtSourceFile, &itemCount);
                for (long j = 0; j < itemCount; j++)
                {
                    CComPtr <IaqCOMAccessDbgSymbol>  SrcFileSymbol;
                    hr = modObject->get_Item(dtSourceFile, j, &SrcFileSymbol);
                    SrcFileSymbol->get_FullName(&FullName);
                    if (isFileNameOfInterest(FullName, listFileNames))
                    {
                        hr = aqArea->AddItem(SrcFileSymbol, &areaValue); <== crashes the second time around
                    }
                }
            }

 

Thanks in advance

4 REPLIES 4
AlexKaras
Champion Level 3

[Edited. Initial reply removed because of its irrelevance]

 

You may try AQTime's troubleshooter at https://support.smartbear.com/troubleshooter/?prod=AQtime-8 and contact Support directly via the https://support.smartbear.com/message/?prod=AQtime form if the troubleshooter does not help.

 

Also, can you provide the link to the initial mentioned VB script sample ?

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
arthurqv
Occasional Contributor

The link to the VB script I am trying to mimic in VS2015 C++ is:

https://support.smartbear.com/viewarticle/43119/#ID0ERKAE

 

And it is NOT the app that crashes. It is the program that tries to add a second file to the profiling area in the AQTime project.

I must be doing something dumb, but it's not obvious (to me) after staring at and debugging the code for a while.

 

Thanks for any help

Hi,

 

Well... I am far not an expert with C++ and found nothing suspicious in your code snippet.

I would recommend you to contact Support via the https://support.smartbear.com/message/?prod=AQtime form unless @HKosova can help you here.
Sorry for not been able to help...

Regards,
  /Alex [Community Champion]
____
[Community Champions] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Champions]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Champion] signature is assigned on quarterly basis and is used with permission by SmartBear Software.
https://community.smartbear.com/t5/Community-Champions/About-the-Community-Champions-Program/gpm-p/252662
================================
arthurqv
Occasional Contributor

Actually, I solved my problem, but I'm not 100% sure why:

The key was to reset the two CComPtr inside the loop. Not sure why, but I am not a COM expert:

CComPtr <IaqCOMAccessAreaItem> areaValue

CComPtr <IaqCOMAccessDbgSymbol> SrcFileSymbol;

......

for (long j = 0; j < itemCount; j++)

 

{

       areaValue = 0;

       SrcFileSymbol = 0;

       hr = modObject->get_Item(dtSourceFile, j, &SrcFileSymbol);

       SrcFileSymbol->get_FullName(&FullName);

       if (isFileNameOfInterest(FullName, listFileNames))

 

       {

              hr = aqArea->AddItem(SrcFileSymbol, &areaValue);

 

       }

}

Thanks to all for the suggestions.

cancel
Showing results for 
Search instead for 
Did you mean: