绑定iOS框架导致临时文件损坏

Mii*_*ite 3 xamarin.ios xamarin xamarin.ios-binding

我有一个非常庞大的 iOS 框架要绑定。这个框架依赖于另外两个。

我创建了绑定项目,成功生成了 ApiDefinitions.cs 文件和 StructsAndEnums.cs。到现在为止还挺好。

现在,当我尝试在调试模式下构建它时,我会收到大约 30 多个关于临时文件中的语法问题的错误。

这些错误仅发生在 Trampolines.g.cs 和 SupportDelegates.g.cs 文件中。两者中最糟糕的是 SupportDelegates.g.cs 文件,它看起来像这样:

   //
// Auto-generated from generator.cs, do not edit
//
// We keep references to objects, so warning 414 is expected

#pragma warning disable 414

using System;
using System.Drawing;
using System.Diagnostics;
using System.ComponentModel;
using System.Threading.Tasks;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using UIKit;
using GLKit;
using Metal;
using MapKit;
using Photos;
using ModelIO;
using SceneKit;
using Contacts;
using Security;
using Messages;
using AudioUnit;
using CoreVideo;
using CoreMedia;
using QuickLook;
using CoreImage;
using SpriteKit;
using Foundation;
using CoreMotion;
using ObjCRuntime;
using AddressBook;
using MediaPlayer;
using GameplayKit;
using CoreGraphics;
using CoreLocation;
using AVFoundation;
using NewsstandKit;
using FileProvider;
using CoreAnimation;
using CoreFoundation;

namespace System.Action`1[[Foundation.NSString, Xamarin.iOS, Version=0.0.0 {
    public delegate void 0, Culture=neutral, PublicKeyToken=84e04ff9cfb79065]] (NSString obj);
}
Run Code Online (Sandbox Code Playgroud)

Trampolines.g.cs 文件几乎完全生成,但在生成的 C# 代码中间出现了同样的问题:

static internal class SDActionArity2V1 {
            static internal readonly DActionArity2V1 Handler = Invoke;

            [MonoPInvokeCallback (typeof (DActionArity2V1))]
            static unsafe void Invoke (IntPtr block, IntPtr arg1, IntPtr arg2) {
                var descriptor = (BlockLiteral *) block;
                var del = (global::System.Action<NSString, global::System.Action<NSString>>) (descriptor->Target);
                if (del != null)
                    del ( Runtime.GetNSObject<NSString> (arg1), (System.Action`1[Foundation.NSString]) Marshal.GetDelegateForFunctionPointer (arg2, typeof (System.Action`1[Foundation.NSString])));
            }
        }
Run Code Online (Sandbox Code Playgroud)

其他一些绑定项目正在生成相同类型的文件,并且一切似乎都运行良好,所以我实际上正在努力寻找其根本原因。

有任何想法吗 ?

编辑:这里提供更多信息是生成的接口定义 https://gist.github.com/Miiite/367e17335431e932acdc92c65b504bd4

EDIT2:这是Sharpie作为日志输出生成的内容 https://gist.github.com/Miiite/e272622df2e853d53f1add4c8eb4eabf

mig*_*aza 5

我相信问题出在这里: void PresentCheckoutForSubmittingTransactionCompletionHandler(Action<OPPTransaction, NSError> completionHandler, [NullAllowed] Action<NSString, Action<NSString>> paymentBrandSelectedHandler, [NullAllowed] Action cancelHandler);

我认为 Action 中的 Action 导致了问题,生成器可能不支持这一点,因此您可能需要找到一种不同的绑定方式。