【发布时间】:2021-01-13 21:37:03
【问题描述】:
我正在关注文档:https://docs.microsoft.com/en-us/xamarin/essentials/screenshot 截取屏幕截图并将其保存到MemoryStream,然后将其用作“imagetest”的图像源(单击按钮。下面是我的CaptureScreenshot() 函数代码,并且在 Android 10 设备上执行按钮单击时出现以下错误。我正在运行最新版本的 Xamarin.Essentials 和 Xamarin.Forms。
功能:
private async void CaptureScreenshot(object sender, EventArgs e)
{
var screenshot = await Screenshot.CaptureAsync();
var stream = await screenshot.OpenReadAsync();
var array_image = ImageSource.FromStream(() => stream);
imagetest.Source = array_image;
}
错误:
"System.TypeLoadException Message=Could not load type of field 'Order_Form_V1.CustomArrayConfiguration+d__3:5__2' (6) due to: 无法使用 typeref 中的令牌 01000029 解析类型(程序集“Xamarin.Essentials,版本”中的预期类“Xamarin.Essentials.ScreenshotResult” =1.0.0.0,Culture=neutral,PublicKeyToken=null') 程序集:Xamarin.Essentials,Version=1.0.0.0,Culture=neutral,PublicKeyToken=null 类型:Xamarin.Essentials.ScreenshotResult 成员:(null)"
感谢我能得到的任何意见。
【问题讨论】:
标签: c# xamarin.forms screenshot xamarin.essentials