Xamarin.Forms - XamlCompilation MissingMethodException

2024-02-29

我想提高 Xamarin.Forms UWP 应用程序的性能,因为它在发布模式下非常慢(选中“.NET Native”)。因此,我在 PCL 项目中的程序集级别应用了 XAMLC:

[assembly: XamlCompilation (XamlCompilationOptions.Compile)]
namespace MyApp
{
}

但使用此属性我收到运行时错误:

“未找到方法:‘无效 Xamarin.Forms.Xaml.Internals.SimpleValueTargetProvider..ctor(System.Object[])'。”

根据这个:

https://github.com/xamarin/Xamarin.Forms/blob/master/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml https://github.com/xamarin/Xamarin.Forms/blob/master/docs/Xamarin.Forms.Xaml/Xamarin.Forms.Xaml.Internals/SimpleValueTargetProvider.xml

SimpleValueTargetProvider 类有 2 个版本:

  • 1.5.0.0 - 具有一个参数的构造函数 System.Object[]
  • 2.0.0.0 - 具有 2 个参数 System.Object[] 和 System.Object 的构造函数

我使用 Xamarin.Forms 2.3.3.163-pre3,因此我在项目中使用第二个版本(当我导航到 Xamarin.Forms.Xaml.Internals 中的 SimpleValueTargetProvider 时,我可以看到带有 2 个参数的构造函数)。我的理解是,显然“某些东西”仍在调用 SimpleValueTargetProvider 1.5.0.0,但我不知道它是什么。

我删除了所有第三方组件,但没有帮助。我使用融合日志来找出发生了什么,但这就是我得到的全部(说实话,我不知道这是否与我面临的问题有关):

> *** Assembly Binder Log Entry  (10/26/2016 @ 9:09:42 PM) ***
> 
> The operation failed. Bind result: hr = 0x80070002. The system cannot
> find the file specified.
> 
> Assembly manager loaded from: 
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\clr.dll Running under
> executable  C:\Program Files (x86)\Microsoft Visual
> Studio\VS15Preview\Common7\IDE\devenv.exe
> --- A detailed error log follows. 
> 
> === Pre-bind state information === LOG: DisplayName = XamlDesignerFaultInjection  (Partial) WRN: Partial binding information
> was supplied for an assembly: WRN: Assembly Name:
> XamlDesignerFaultInjection | Domain ID: 1 WRN: A partial bind occurs
> when only part of the assembly display name is provided. WRN: This
> might result in the binder loading an incorrect assembly. WRN: It is
> recommended to provide a fully specified textual identity for the
> assembly, WRN: that consists of the simple name, version, culture, and
> public key token. WRN: See whitepaper
> http://go.microsoft.com/fwlink/?LinkId=109270 for more information and
> common solutions to this issue. LOG: Appbase = file:///C:/Program
> Files (x86)/Microsoft Visual Studio/VS15Preview/Common7/IDE/ LOG:
> Initial PrivatePath = NULL LOG: Dynamic Base = NULL LOG: Cache Base =
> NULL LOG: AppName = devenv.exe Calling assembly : (Unknown).
> === LOG: This bind starts in default load context. LOG: Using application configuration file:
> C:\Users\blaze\AppData\Local\Microsoft\VisualStudio\15.0_2f751565\devenv.exe.config
> LOG: Using host configuration file:  LOG: Using machine configuration
> file from
> C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
> LOG: Policy not being applied to reference at this time (private,
> custom, partial, or location-based assembly bind). LOG: Attempting
> download of new URL file:///C:/Program Files (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection.DLL. LOG:
> Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection/XamlDesignerFaultInjection.DLL.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection.EXE. LOG:
> Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PublicAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Microsoft/TemplateProviders/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/Debugger/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/CommonExtensions/Platform/DiagnosticsHub/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection.EXE.
> LOG: Attempting download of new URL file:///C:/Program Files
> (x86)/Microsoft Visual
> Studio/VS15Preview/Common7/IDE/PrivateAssemblies/DataCollectors/x86/XamlDesignerFaultInjection/XamlDesignerFaultInjection.EXE.
> LOG: All probing URLs attempted and failed.

这是 Xamarin.Forms 或 XamlCTask 中的错误吗?有谁遇到过这个问题或者知道如何解决它?

  • Windows 10 64 位
  • Visual Studio 15 预览版 5
  • Xamarin 4.2.1.14
  • Xamarin.Forms 2.3.3.163-pre3

提前致谢


这很可能是 IDE 或项目级别的缓存问题。

如果是在 IDE 级别: - 做一个干净的 - 重新启动 VS 或 XS - 重建

但你可能已经尝试过了。

我的猜测是,其中一个 nuget 更新未正确清理,并且您的解决方案的不同项目引用了不同版本的 XF,或者一个.csproj文件引用旧的.targets file.

希望一些手动清理工作能够解决这个问题。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Xamarin.Forms - XamlCompilation MissingMethodException 的相关文章

随机推荐

  • 类作用域变量与方法作用域变量

    我知道变量范围是由块的开头包围的 和块的末尾 如果在块内声明相同的变量 则编译错误Variable already defined发生 但看看下面的例子 public class Test int x 0 Class scope varia
  • 三元运算符(内联如果没有其他)

    我有两个checkbox in a
  • java xml document.getTextContent() 保持为空

    我正在尝试在 JUnit 测试中构建 xml 文档 doc docBuilder newDocument Element root doc createElement Settings doc appendChild root Elemen
  • 如何使用 MVC Html Helpers 截断字符串?

    我正在尝试截断一个长字符串 以便仅在我的索引页上显示 它显示如下 td Html DisplayFor modelItem gt item Description td 描述可以有 500 个字符长 但我无法在网格布局上显示那么多 我想只显
  • 如何增加 tinter 列表框中行之间的间距 - python

    我有一个 tkinter 列表框初始化如下 self serives listbox tk Listbox parent font TkTextFont 20 exportselection False width 30 height 15
  • 捕获视频文件的输出以进行逐帧处理

    我试图从视频文件 7 秒长 中抓取各个帧 但遇到了巨大的内存问题 我正在使用 AVURLAsset 加载资产 然后创建一个AVAssetReader以及随附的AVAssetReaderTrackOutput 采用像素格式kCVPixelFo
  • 使用 KSoap 库使用 .NET Web 服务时出现错误

    我一直在使用 ksoap 库来使用 net Web 服务 我遇到了这种错误 预计 START TAG http schemas xmlsoap org soap envelope http schemas xmlsoap org soap
  • 在 OpenGL ES 2.0 / GLSL 中,哪里需要精度说明符?

    您要填充值的变量是否决定了您在等号右侧使用的精度 例如 这里的精度说明符在含义上是否有任何区别 gl FragColor lowp vec4 1 这是另一个例子 lowp float floaty 1 2 floaty lowp 1 low
  • Bash 监控磁盘使用情况

    我买了一个 NAS 盒子 上面有 debian 的精简版 前几天它空间不足 但我没有意识到 我基本上想编写一个 bash 脚本 每当磁盘已满 90 以上时就会提醒我 有谁知道可以执行此操作的脚本或给我一些关于编写脚本的建议吗 bin bas
  • C# 获取 cmd 输出,如真实 cmd 窗口中所示

    我有一个BackgroundWorker运行 cmd 进程并向其写入多个命令的线程 有些命令可能需要一段时间才能完成 因此我想向用户显示进度的 cmd 输出 我运行 cmd 命令的代码如下所示 private void background
  • 在C中的两点之间选取随机数

    我想知道 是否有可能在 c 中生成两个限制之间的随机数 IE 我的程序是这样设置的 function x generate random number while 1 function x delay 所以基本上我希望每次调用该函数时都会生
  • 何时在基准测试表达式中进行插值

    The 基准测试工具文档建议将全局变量插入基准测试表达式中 然而 他们提供的示例的运行时间差距似乎已经大大缩小 在他们的例子 https github com JuliaCI BenchmarkTools jl blob master do
  • 带有上下文管理器的 ThreadPoolExecutor

    我不明白为什么这段代码的行为方式不同 在第一种情况下 代码将打印 elo 19 秒后我们将看到 3 在其他情况下 我们将首先等待 19 秒 然后我们将看到 elo 你能给我解释一下吗 from concurrent futures impo
  • 斐波那契计算时间

    递归式斐波那契与循环式斐波那契之间是否存在明显的计算时间差异 我使用递归将斐波那契数列运行到 40 个位置 然后直接使用循环 看起来计算时间的差异只是academic 用C语言编写 递归解决方案 int main int argc cons
  • 如何在启动过程后切换Linux内核控制台?

    在我的嵌入式系统上 我通常使用 dev ttyS0 作 为主控制台 这是通过传递内核参数来实现的console dev ttyS0什么时候init尽其所能 getty在指定的同一设备上触发inittab by eg ttyS0 respaw
  • 将毫秒时间戳反序列化为 java.time.Instant

    我正在尝试使用 Jackson 读取 JSON 文件并将以纪元毫秒形式存储的字段之一存储为 JavaInstant 但是反序列化的行为并不如预期 这是我在尝试读取时间戳时看到的内容 1503115200000 杰克逊正在设定Instant字
  • 简单警报和徽章上的 IOS 10.2 UserNotifications 问题

    在写这篇文章之前 我对 UserNotification 框架进行了大量研究 该框架在 IOS 10 中取代了 UILocalNotification 我还按照本教程学习了有关此新功能的所有内容 http useyourloaf com b
  • 使用knitr使R块与文本对齐

    如何让 R 代码 R 块 与我的文本内联 Example 请使用 install packages ISwR 安装软件包 下列的来自一辉的建议 https groups google com forum fromgroups topic k
  • 如何让子字符串在 matlab 中工作?

    如果这是一个新问题 我很抱歉 但我已阅读文档here http www mathworks com help symbolic mupad ref substring html它没有说明在使用子字符串之前必须输入任何命令 但是 当我尝试按如
  • Xamarin.Forms - XamlCompilation MissingMethodException

    我想提高 Xamarin Forms UWP 应用程序的性能 因为它在发布模式下非常慢 选中 NET Native 因此 我在 PCL 项目中的程序集级别应用了 XAMLC assembly XamlCompilation XamlComp