Home Dashboard Directory Help
Search

Breaking change in how the ATL OLE DB CCommand::Execute method behaves by W_N


Status: 

Closed
 as Fixed Help for as Fixed


6
0
Sign in
to vote
Type: Bug
ID: 750369
Opened: 6/21/2012 2:28:05 PM
Access Restriction: Public
0
Workaround(s)
view
3
User(s) can reproduce this bug

Description

The VS2012 RC version of the CCommand::Execute method in the ATL OLE DB Consumer templates (atldbcli.h) behaves differently and causes certain code that uses the ATL OLE DB classes to fail. Compared to the VS2010 version of atldbcli.h, the VS2012 RC version adds two lines (lines 7486 and 7487) that cause a pointer to be set to NULL in certain success conditions. This pointer is subsequently used in other code in atldbcli.h, which fails (with an assert and returning an E_FAIL) due to the pointer being set to NULL.

Here is a snippet of code from CCommand::Execute from VS2012 RC (lines 7478 to 7493):
if (UseMultipleResults())
{
    hr = m_spCommand->Execute(NULL, __uuidof(IMultipleResults), pParams,
        pAffected, (IUnknown**)GetMultiplePtrAddress());

    if (SUCCEEDED(hr))
    {
        hr = GetNextResult(pAffected, false);
        if (SUCCEEDED(hr) && ppInterface != NULL)
            *ppInterface = NULL;
    }
    else
        // If we can't get IMultipleResults then just try to get IRowset
        hr = m_spCommand->Execute(NULL, GetIID(), pParams, pAffected,
            ppInterface);
}

The equivalent snippet of code (lines 7417 to 7428) from VS2010 is as follows
if (UseMultipleResults())
{
    hr = m_spCommand->Execute(NULL, __uuidof(IMultipleResults), pParams,
        pAffected, (IUnknown**)GetMultiplePtrAddress());

    if (SUCCEEDED(hr))
        hr = GetNextResult(pAffected, false);
    else
        // If we can't get IMultipleResults then just try to get IRowset
        hr = m_spCommand->Execute(NULL, GetIID(), pParams, pAffected,
        ppInterface);
}

Note how the VS2012 RC version of the code sets ppInterface to NULL in certain situations after the call to GetNextResult, whereas the VS2010 version of the code does not.
Details
Sign in to post a comment.
Posted by Microsoft on 2/13/2013 at 12:12 PM
We have fixed this bug for Dev12, and we'll attempting a fix for Dev11 thru VSUpdate.

Thanks.
Posted by tassh on 12/20/2012 at 9:52 AM
I agree with the comments below - the suggested workaround of finding and changing all the code related to this is not a small amount of effort.

As I understand it, the change in this function just appears to break MultipleResults functionality completely.

Please re-open this issue and fix this urgently.

Also, at a minimum, please provide a detailed explanation for why this change was made and also why such a breaking change was not documented as a breaking change (I've searched and all I can find is a link to this article).

Posted by Do Django on 12/18/2012 at 2:21 AM
Hi,

we agree with W_N, it is not really an acceptable workaround. Also we can not see any reason for this change:

if (SUCCEEDED(hr) && ppInterface != NULL)
            *ppInterface = NULL;

Patching the ATL header file to avoid setting *ppInterface to NULL seems to work but as we do not know the reason for this change we cannot estimate if we will get into trouble ...

Please reopen this issue, for us this is a show stopper for VS2012, thx!
Posted by Microsoft on 12/14/2012 at 4:04 PM

Hello W_N

Thank you very much for your feedback. Unfortunate the mentioned problem will not be fixed in Dev12. We will address the issue in next release of Visual Studio.

Windows C++ Libraries Team
Lukasz Chodorski

Posted by W_N on 6/26/2012 at 12:09 AM
Making extensive changes to the application code to avoid using the multiple result feature in order to overcome this problem introduced by VS2012 is not really an acceptable workaround and would be the last resort.

Thank you.
Posted by Microsoft on 6/25/2012 at 10:52 AM
Hello W_N,

Thank you very much for your feedback. Unfortunate this bug will not be fixed in Visual Studio 11. As workaround for this problem is it possible that your application will not use multiple result features?

Windows C++ Libraries Team
Lukasz Chodorski
Posted by Microsoft on 6/22/2012 at 12:05 AM
Thank you for submitting feedback on Visual Studio 11 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by Microsoft on 6/21/2012 at 2:52 PM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.