Xamarin.Forms - XamlCompilation MissingMethodException

本文关键字:MissingMethodException XamlCompilation Forms Xamarin | 更新日期: 2023-09-27 18:15:05

我想提高Xamarin的性能。表单UWP应用程序,因为它是极其缓慢的发布模式("。. NET原生"选中)。因此,我在PCL项目的组装级别应用XAMLC:

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

但是使用这个属性我收到运行时错误:

"方法未找到:'无效Xamarin.Forms.Xaml.Internals.SimpleValueTargetProvider . .男星(System.Object[])"。"

根据这个:

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

SimpleValueTargetProvider类有两个版本:

  • 1.5.0.0 -构造函数与一个参数系统。对象[]
  • 2.0.0.0 -构造函数与2参数系统。对象[]和系统。

我用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的一个bug吗?Forms还是XamlCTask?有人遇到这个问题或知道如何解决它吗?

  • Windows 10 64位
  • Visual studio15 Preview 5
  • Xamarin 4.2.1.14
  • Xamarin的。表格2.3.3.163-pre3

Thanks in advance

Xamarin.Forms - XamlCompilation MissingMethodException

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

如果是IDE级别:-做个清洁-重启VS或XS——重建

但是你可能已经试过了。

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

希望一些人工清洁可以解决这个问题。

如果您的项目依赖于使用XamlC的第三方程序集,并且如果该程序集是在XF<2.3.3上构建的,则仍然可能遇到此问题。

已经有一个修复,将作为XF 2.3.3的第一个服务版本的一部分发布

在我这边,我有不同的Xamarin。窗体版本在我的核心和Android版本。在所有项目上安装相同的解决方案

相关文章:
  • 没有找到相关文章