我正在使用 Xamarin.Controls.SignaturePad.Forms 进行签名。以下代码在我调试时工作得很好。但是应用程序在发布版本中崩溃了。 当我从属性中恢复点时,应用程序崩溃。
public partial class MainPage : ContentPage
{
public IEnumerable<Point> Points { get; private set; }
private SignaturePadView sigview;
public MainPage()
{
InitializeComponent();
var x = new StackLayout();
sigview = new SignaturePadView()
{
HeightRequest = 320,
WidthRequest = 240,
BackgroundColor = Color.White,
CaptionText = "Caption this",
CaptionTextColor = Color.Black,
ClearText = "Clear!",
ClearTextColor = Color.Black,
SignatureLineColor = Color.Black,
StrokeColor = Color.Black,
StrokeWidth = 2
};
var btn1 = new Button(){ Text = "save"};
var btn2 = new Button(){Text = "Restore"};
btn1.Clicked += Btn1_Clicked;
btn2.Clicked += Btn2_Clicked;
x.Children.Add(sigview);
x.Children.Add(btn1);
x.Children.Add(btn2);
this.Content = x;
}
private void Btn2_Clicked(object sender, EventArgs e)
{
this.sigview.Clear();
this.sigview.Points = this.Points;
}
private void Btn1_Clicked(object sender, EventArgs e)
{
this.Points = this.sigview.Points;
}
}
例外记录
ComTypeMarshalling_MissingInteropData at SharedLibrary!+ 0x4846fa at SharedLibrary!+ 0x48419f at SharedLibrary!+ 0x483ead at SharedLibrary!+ 0x483e37 at SharedLibrary!+ 0x4837d1 at SharedLibrary!+ 0x48375c at SharedLibrary!+ 0x483702 at SharedLibrary!+ 0x4e5701 at ProteusMMX.UWP!+ 0x23942e7 at Xamarin.Controls.Extensions&LT;&GT; c__DisplayClass4_0.b__1(Foundation.Point [] s)在SharedLibrary!+ 0x3c1adf at SharedLibrary!+ 0x39b50e at SharedLibrary!+ 0x39b56b at ProteusMMX.UWP!+ 0x1e1a54c at SharedLibrary!+ 0x574410 at SharedLibrary!+ 0x574509 at ProteusMMX.UWP!+ 0x1d0dc6c at ProteusMMX.UWP!+ 0x1d0dd3c at ProteusMMX.UWP!+ 0x1d0dd9d at Xamarin.Controls.Extensions.AddStrokes(UI.Input.Inking.InkPresenter inkPresenter,Collections.Generic.IList 笔画,UI.Color颜色,单宽度)at Xamarin.Controls.SignaturePadCanvasView.LoadPoints(Foundation.Point [] loadedPoints)at SignaturePad.Forms.SignaturePadCanvasRenderer.OnPointsSpecified(对象 sender,Forms.SignaturePadCanvasView.PointsEventArgs e)at SignaturePad.Forms.SignaturePadCanvasView.SetSignaturePoints(Collections.Generic.IEnumerable 点) SignaturePad.Forms.SignaturePadView.set_Points(Collections.Generic.IEnumerable 值)