[wix-users] Difference's accessing record in DTF

Joseph L. Casale jcasale at activenetwerx.com
Wed Jul 12 07:44:26 PDT 2017


-----Original Message-----
From: wix-users [mailto:wix-users-bounces at lists.wixtoolset.org] On Behalf
Of Lucas Lacroix
Sent: Tuesday, July 11, 2017 6:02 PM
To: WiX Toolset Users Mailing List <wix-users at lists.wixtoolset.org>
Subject: Re: [wix-users] Difference's accessing record in DTF

> What is the error you get?

Hey Lucas,
I get a Microsoft.Deployment.WindowsInstaller type stating "Function failed during execution.".

Overlook the lack of error checking, the following is merely repro code ;

// Works, one record exists in both the view and the newRecords collection.
using (Database database = session.Database)
using (View view = database.OpenView("SELECT * FROM IIsWebAddress"))
{
    view.Execute();

    foreach (Record record in view)
    {
        view.Modify(ViewModifyMode.Delete, record);
    }

    foreach (Record record in newRecords)
    {
        view.Modify(ViewModifyMode.InsertTemporary, record);
    }
}

// Throws, one record exists in both the view and the newRecords collection.
using (Database database = session.Database)
using (View view = database.OpenView("SELECT * FROM IIsWebAddress"))
{
    view.Execute();

    List<Record> records = new List<Record>();
    foreach (Record record in view)
    {
        records.Add(record);
    }

    foreach (Record record in records)
    {
        view.Modify(ViewModifyMode.Delete, record); // Throws here.
    }

    foreach (Record record in newRecords)
    {
        view.Modify(ViewModifyMode.InsertTemporary, record);
    }
}

More than likely related to the COM access within the framework.

Thanks,
jlc


More information about the wix-users mailing list