3

当我将 Windows SDK 升级到 17763 时,我发现我无法编译我的项目,并且我收到错误消息“midl:错误 MIDL9008:内部编译器问题 - 有关如何找到解决方法的建议,请参阅文档。”。这是输出:

1>Note: The Microsoft.Windows.CppWinRT Nuget package provides improved C++/WinRT project build support.
1>64 bit MIDLRT Processing G:\NagisaRepositories\Nagisa\Assassin\CustomConverter.idl
1>CustomConverter.idl
1>64 bit MIDLRT Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt\winrtbase.idl
1>winrtbase.idl
1>64 bit MIDLRT Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt\midlbase.idl
1>midlbase.idl
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.ai.machinelearning.machinelearningcontract\1.0.0.0\windows.ai.machinelearning.machinelearningcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.ai.machinelearning.preview.machinelearningpreviewcontract\2.0.0.0\windows.ai.machinelearning.preview.machinelearningpreviewcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.calls.background.callsbackgroundcontract\1.0.0.0\windows.applicationmodel.calls.background.callsbackgroundcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.calls.callsphonecontract\4.0.0.0\windows.applicationmodel.calls.callsphonecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.calls.callsvoipcontract\4.0.0.0\windows.applicationmodel.calls.callsvoipcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.communicationblocking.communicationblockingcontract\2.0.0.0\windows.applicationmodel.communicationblocking.communicationblockingcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.socialinfo.socialinfocontract\2.0.0.0\windows.applicationmodel.socialinfo.socialinfocontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.startuptaskcontract\3.0.0.0\windows.applicationmodel.startuptaskcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.custom.customdevicecontract\1.0.0.0\windows.devices.custom.customdevicecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.deviceslowlevelcontract\3.0.0.0\windows.devices.deviceslowlevelcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.printers.printerscontract\1.0.0.0\windows.devices.printers.printerscontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.smartcards.smartcardbackgroundtriggercontract\3.0.0.0\windows.devices.smartcards.smartcardbackgroundtriggercontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.smartcards.smartcardemulatorcontract\6.0.0.0\windows.devices.smartcards.smartcardemulatorcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.foundation.foundationcontract\3.0.0.0\windows.foundation.foundationcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.foundation.universalapicontract\7.0.0.0\windows.foundation.universalapicontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.gaming.xboxlive.storageapicontract\1.0.0.0\windows.gaming.xboxlive.storageapicontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.graphics.printing3d.printing3dcontract\4.0.0.0\windows.graphics.printing3d.printing3dcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.networking.connectivity.wwancontract\2.0.0.0\windows.networking.connectivity.wwancontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.networking.sockets.controlchanneltriggercontract\3.0.0.0\windows.networking.sockets.controlchanneltriggercontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.services.maps.guidancecontract\3.0.0.0\windows.services.maps.guidancecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.services.maps.localsearchcontract\4.0.0.0\windows.services.maps.localsearchcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.services.store.storecontract\4.0.0.0\windows.services.store.storecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.services.targetedcontent.targetedcontentcontract\1.0.0.0\windows.services.targetedcontent.targetedcontentcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.system.profile.profilehardwaretokencontract\1.0.0.0\windows.system.profile.profilehardwaretokencontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.system.profile.profilesharedmodecontract\2.0.0.0\windows.system.profile.profilesharedmodecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.system.profile.systemmanufacturers.systemmanufacturerscontract\3.0.0.0\windows.system.profile.systemmanufacturers.systemmanufacturerscontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.system.systemmanagementcontract\6.0.0.0\windows.system.systemmanagementcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.ui.viewmanagement.viewmanagementviewscalingcontract\1.0.0.0\windows.ui.viewmanagement.viewmanagementviewscalingcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.ui.xaml.core.direct.xamldirectcontract\1.0.0.0\windows.ui.xaml.core.direct.xamldirectcontract.winmd
1>64 bit MIDLRT Processing G:\NagisaRepositories\Nagisa\Assassin\TransferManager.idl
1>TransferManager.idl
1>64 bit MIDLRT Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt\winrtbase.idl
1>winrtbase.idl
1>64 bit MIDLRT Processing C:\Program Files (x86)\Windows Kits\10\Include\10.0.17763.0\winrt\midlbase.idl
1>midlbase.idl
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.ai.machinelearning.machinelearningcontract\1.0.0.0\windows.ai.machinelearning.machinelearningcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.ai.machinelearning.preview.machinelearningpreviewcontract\2.0.0.0\windows.ai.machinelearning.preview.machinelearningpreviewcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.calls.background.callsbackgroundcontract\1.0.0.0\windows.applicationmodel.calls.background.callsbackgroundcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.calls.callsphonecontract\4.0.0.0\windows.applicationmodel.calls.callsphonecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.calls.callsvoipcontract\4.0.0.0\windows.applicationmodel.calls.callsvoipcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.communicationblocking.communicationblockingcontract\2.0.0.0\windows.applicationmodel.communicationblocking.communicationblockingcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.socialinfo.socialinfocontract\2.0.0.0\windows.applicationmodel.socialinfo.socialinfocontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.applicationmodel.startuptaskcontract\3.0.0.0\windows.applicationmodel.startuptaskcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.custom.customdevicecontract\1.0.0.0\windows.devices.custom.customdevicecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.deviceslowlevelcontract\3.0.0.0\windows.devices.deviceslowlevelcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.printers.printerscontract\1.0.0.0\windows.devices.printers.printerscontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.smartcards.smartcardbackgroundtriggercontract\3.0.0.0\windows.devices.smartcards.smartcardbackgroundtriggercontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.devices.smartcards.smartcardemulatorcontract\6.0.0.0\windows.devices.smartcards.smartcardemulatorcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.foundation.foundationcontract\3.0.0.0\windows.foundation.foundationcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.foundation.universalapicontract\7.0.0.0\windows.foundation.universalapicontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.gaming.xboxlive.storageapicontract\1.0.0.0\windows.gaming.xboxlive.storageapicontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.graphics.printing3d.printing3dcontract\4.0.0.0\windows.graphics.printing3d.printing3dcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.networking.connectivity.wwancontract\2.0.0.0\windows.networking.connectivity.wwancontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.networking.sockets.controlchanneltriggercontract\3.0.0.0\windows.networking.sockets.controlchanneltriggercontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.services.maps.guidancecontract\3.0.0.0\windows.services.maps.guidancecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.services.maps.localsearchcontract\4.0.0.0\windows.services.maps.localsearchcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.services.store.storecontract\4.0.0.0\windows.services.store.storecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.services.targetedcontent.targetedcontentcontract\1.0.0.0\windows.services.targetedcontent.targetedcontentcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.system.profile.profilehardwaretokencontract\1.0.0.0\windows.system.profile.profilehardwaretokencontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.system.profile.profilesharedmodecontract\2.0.0.0\windows.system.profile.profilesharedmodecontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.system.profile.systemmanufacturers.systemmanufacturerscontract\3.0.0.0\windows.system.profile.systemmanufacturers.systemmanufacturerscontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.system.systemmanagementcontract\6.0.0.0\windows.system.systemmanagementcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.ui.viewmanagement.viewmanagementviewscalingcontract\1.0.0.0\windows.ui.viewmanagement.viewmanagementviewscalingcontract.winmd
1>Processing WinMD c:\program files (x86)\windows kits\10\references\10.0.17763.0\windows.ui.xaml.core.direct.xamldirectcontract\1.0.0.0\windows.ui.xaml.core.direct.xamldirectcontract.winmd
1>
1>midl : error MIDL9008: internal compiler problem - See documentation for suggestions on how to find a workaround.
1>midl: Assertion failed: false, file com\rpc\midl\midlrt\inc\nodeskl.hxx, line 4884

我试图解决这个问题,我发现如果我删除接口的定义它会成功编译。但我需要这些定义,因为它很重要。这是我删除的 IDL 定义。

/******************************************************************************
Project: Assassin
Description: Definition for the TransferManager.
File Name: TransferManager.idl
License: The MIT License
******************************************************************************/

namespace Assassin
{
    enum TransferTaskStatus
    {
        Canceled  = 0,
        Completed = 1,
        Error     = 2,
        Paused    = 3,
        Queued    = 4,
        Running   = 5
    };

    [version(1.0)]
    [uuid(B70ACDED-7354-3082-BF73-D931D80C047B)]
    interface ITransferTask : IInspectable
        requires Windows.UI.Xaml.Data.INotifyPropertyChanged
    {
        // Gets the Guid string of the task.
        String Guid
        {
            get;
        };

        // Gets the URI which to download the file.
        Windows.Foundation.Uri SourceUri
        {
            get;
        };

        // Gets the file name which to download the file.
        String FileName
        {
            get;
        };

        // Gets the save file object which to download the file.
        Windows.Storage.IStorageFile SaveFile
        {
            get;
        };

        // Gets the save folder object which to download the file.
        Windows.Storage.IStorageFolder SaveFolder
        {
            get;
        };

        // The current status of the task.
        TransferTaskStatus Status
        {
            get;
        };

        // The total number of bytes received. This value does not include 
        // bytes received as response headers. If the task has restarted, 
        // this value may be smaller than in the previous progress report.
        UInt64 BytesReceived
        {
            get;
        };

        // The speed of bytes received in one second.
        UInt64 BytesReceivedSpeed
        {
            get;
        };

        // The remain time, in seconds.
        UInt64 RemainTime
        {
            get;
        };

        // The total number of bytes of data to download. If this number is
        // unknown, this value is set to 0.
        UInt64 TotalBytesToReceive
        {
            get;
        };

        // Pauses a download operation.
        // Parameters:
        //   The function does not have parameters.
        // Return value:
        //   The function does not return a value.
        void Pause();

        // Resumes a paused download operation.
        // Parameters:
        //   The function does not have parameters.
        // Return value:
        //   The function does not return a value.
        void Resume();

        // Cancels a download operation.
        // Parameters:
        //   The function does not have parameters.
        // Return value:
        //   The function does not return a value.
        void Cancel();
    }

    typedef Windows.Foundation.Collections.IVectorView<ITransferTask> ITransferTaskVector;

    [version(1.0)]
    [uuid(976D09B5-65EE-39DE-9C00-26E47D6538D7)] 
    interface ITransferManager : IInspectable
        requires 
            Windows.Foundation.IClosable, 
            Windows.UI.Xaml.Data.INotifyPropertyChanged
    {
        // Gets the version of Nagisa.
        String Version
        {
            get;
        };

        // Gets or sets the filter to use for searching the task list.
        String SearchFilter
        {
            get;
            set;
        };

        // Gets the last used folder.
        Windows.Storage.IStorageFolder LastusedFolder
        {
            get;
        };

        // Gets or sets the default download folder.
        Windows.Storage.IStorageFolder DefaultFolder
        {
            get;
            set;
        };

        // Gets the total download bandwidth.
        UInt64 TotalDownloadBandwidth
        {
            get;
        };

        // Gets the total upload bandwidth.
        UInt64 TotalUploadBandwidth
        {
            get;
        };

        // Gets the task list.
        // Parameters:
        //   The function does not have parameters.
        // Return value:
        //   Returns an object which represents the task list.
        Windows.Foundation.IAsyncOperation<ITransferTaskVector> GetTasksAsync();

        // Add a task to the task list.
        // Parameters:
        //   SourceUri: The source uri object of task.
        //   DesiredFileName: The file name you desire.
        //   SaveFolder: The object of the folder which you want to save.
        // Return value:
        //   Returns an asynchronous object used to wait.
        Windows.Foundation.IAsyncAction AddTaskAsync(
            Windows.Foundation.Uri SourceUri,
            String DesiredFileName,
            Windows.Storage.IStorageFolder SaveFolder);

        // Removes a task to the task list.
        // Parameters:
        //   Task: The task object. 
        // Return value:
        //   Returns an asynchronous object used to wait.
        Windows.Foundation.IAsyncAction RemoveTaskAsync(
            ITransferTask Task);

        // Start all tasks.
        // Parameters:
        //   The function does not have parameters.
        // Return value:
        //   The function does not return a value.
        void StartAllTasks();

        // Pause all tasks.
        // Parameters:
        //   The function does not have parameters.
        // Return value:
        //   The function does not return a value.
        void PauseAllTasks();

        // Clears the task list.
        // Parameters:
        //   The function does not have parameters.
        // Return value:
        //   The function does not return a value.
        void ClearTaskList();
    }

    [version(1.0)]
    runtimeclass TransferManager :
        [default] ITransferManager
    {
        // Creates a new TransferManager object.
        // Parameters:
        //   EnableUINotify: Enable the UI notify timer if true. 
        // Return value:
        //   The function does not return a value.
        TransferManager(
            Boolean EnableUINotify);
    }
}

我想知道是什么原因造成的,是我的错还是 Windows SDK 的。

4

2 回答 2

1

经过几天的努力解决这个问题并试图找到解决方案后,解决方法变得非常简单:

namespace System {
    typedef Windows.Foundation.IClosable IDisposable;
}
namespace MyComponent.MyNamespace {
    interface IMyInterface : IInspectable requires System.IDisposable {
        ...
    }
}

上面的 typedef 可以放入单独的共享 .idl 文件中,只要需要派生外部接口,就可以将其包含在内。

更新(2020/06/06):一年和几次 SDK 更新后问题仍然存在。:(

此外,当我的修复程序不能很好地工作时,我遇到了一种特定情况 - 当一个 cppwinrt WRC 项目依赖于另一个 cppwinrt WRC 项目时。显然,typedef 成为导入的 .winmd 中的原始类型,因此引用的项目编译得很好,但引用项目失败,并出现相同的旧“内部编译器问题”。不幸的是,您无法使用上述包含修复它,因为导入的 .winmd 是在项目 .idl 之前处理的。

我已经去进一步调查这个问题,这就是我发现的:

  • 错误不仅发生在Windows.Foundation.IClosable本身,而且在任何其他接口都出现在需求树的某个地方
  • 当您从此类接口派生运行时类时不会发生错误(仅在接口“继承”时发生)
  • 解决方法非常简单且非常相似:如果您键入此类接口而不是直接使用它 - 一切都会被编译好。
于 2019-03-18T18:17:51.700 回答
0

我想知道是什么原因造成的,是我的错还是 Windows SDK 的。

这是最新 Windows SDK 附带的 MIDL 编译器中的一个已知错误。

于 2018-10-24T14:58:09.970 回答