none
ADODB.Recordset filter property when using array holding bookmarks breaks after Windows 10 Update KB4015217 & Windows 7 update KB4015549(KB4015546)

    Question

  • I apologize if mistaken section.

    After installing this updates, unable to filter recordset using array of bookmarks, there is an exception inside msado15.dll.

    For example, this code on C#:

    var rs = new ADODB.Recordset();
    rs.Fields.Append("Id",DataTypeEnum.adInteger);
    rs.Open();
    
    for (int i = 0; i < 9; i++) { 
      rs.AddNew();   
      rs.Fields[0].Value = i;
    }
    
    var bookmarks = new object[2];
    rs.MoveFirst(); rs.Find("Id=3");
    bookmarks[0] = rs.Bookmark;
    rs.MoveFirst(); rs.Find("Id=8");
    bookmarks[1] = rs.Bookmark;
    
    rs.Filter = bookmarks;

    produces Access Violation (0xC0000005) exception in msado15.dll, on the line when setting rs.Filter to bookmarks array.

    Callstack:

    >   msado15.dll!ExtractArray()  + 0x5cd bytes    
         msado15.dll!ExtractBookmarkArray()  + 0xa1 bytes    
         msado15.dll!CRecordset::SetFilter()  + 0x6f0 bytes    
         msado15.dll!CRecordset::put_Filter()  + 0x2e8 bytes    
         [Managed to Native Transition]    
         ConsoleApplication2.exe!ConsoleApplication2.Program.Main(string[] args = {string[0]}) Line 31 + 0xc bytes    C
         ...

    Is there any workaround, or update to fix this?

    Thank you in advance.


    Tuesday, April 18, 2017 6:41 AM

All replies

  • Yup. Others are hit by this problem as well.

    Since ADO is still supported technology that is part of WDAC, you can wait Microsoft to fix it later. Since it won't be critical update, I think the earliest time it'll ship is next patch Tuesday. If it's critical part of your application, since you have source code, you may want to change the code to apply filter at other levels. (Such as BindingSource, DataView, etc.) and see if it'll hit the problem too, or filter by altering relevant SQL statements directly. 

    Tuesday, April 18, 2017 8:30 AM
    Answerer
  • . . . you may want to change the code to apply filter at other levels. (Such as BindingSource, DataView, etc.) and see if it'll hit the problem too, or filter by altering relevant SQL statements directly. 

    Unfortunately setting `Filter` property to an array of bookmarks keeps the order of the bookmarks while the equivalent ID=a OR ID=b OR ID=c does not order the result by a, b and then c but keeps the original order of the unfiltered recordset.

    cheers,
    </wqw>

    Wednesday, April 19, 2017 7:45 AM