"XamlCTask" Xamarin中的任务意外失败 [英] The "XamlCTask" task failed unexpectedly in Xamarin
问题描述
我目前在构建Xamarin.Forms解决方案时遇到问题.我收到错误The "XamlCTask" task failed unexpectedly
.我尝试查看Xamarin日志和Stacktrace,但似乎找不到问题所在.有什么建议可以让我开始寻找吗?
I am currently having a problem building my Xamarin.Forms solution. I'm getting an error of The "XamlCTask" task failed unexpectedly
. I tried looking at the Xamarin logs and Stacktrace but I can't seem to find what's the issue. Any suggestions where I can start looking?
日志
<E2ETraceEvent xmlns="http://schemas.microsoft.com/2004/06/E2ETraceEvent">
<System xmlns="http://schemas.microsoft.com/2004/06/windows/eventlog/system">
<EventID>0</EventID>
<Type>3</Type>
<SubType Name="Warning">0</SubType>
<Level>4</Level>
<TimeCreated SystemTime="2016-10-11T10:45:07.4999078Z" />
<Source Name="Xamarin.VisualStudio.Android.Designer.MonoAndroidDesignerService" />
<Correlation ActivityID="{00000000-0000-0000-0000-000000000000}" />
<Execution ProcessName="devenv" ProcessID="19260" ThreadID="1" />
<Channel />
<Computer>XXXXXX</Computer>
</System>
<ApplicationData>An unexpected error occurred trying to initialize Android Designer.</ApplicationData>
</E2ETraceEvent>
堆栈跟踪
严重性代码描述项目文件行抑制状态 错误"XamlCTask"任务意外失败. System.ArgumentException:具有相同键的项已经被 添加.
Severity Code Description Project File Line Suppression State Error The "XamlCTask" task failed unexpectedly. System.ArgumentException: An item with the same key has already been added.
服务器堆栈跟踪:位于 System.ThrowHelper.ThrowArgumentException(Exception资源资源) 在System.Collections.Generic.Dictionary`2.Insert(TKey键,TValue 值,布尔加法) Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode节点, XmlReader阅读器)位于 Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader reader,Boolean 嵌套) Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode节点, XmlReader阅读器)位于 Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader reader,Boolean 嵌套) Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode节点, XmlReader阅读器)位于 Xamarin.Forms.Build.Tasks.XamlCTask.ParseXaml(Stream stream, TypeReference typeReference)在 Xamarin.Forms.Build.Tasks.XamlCTask.Compile()在 Xamarin.Forms.Build.Tasks.XamlCTask.Execute()在 System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md,Object []参数,Object Server,Object []& outArgs) System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
Server stack trace: at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) at Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode node, XmlReader reader) at Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader reader, Boolean nested) at Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode node, XmlReader reader) at Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader reader, Boolean nested) at Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode node, XmlReader reader) at Xamarin.Forms.Build.Tasks.XamlCTask.ParseXaml(Stream stream, TypeReference typeReference) at Xamarin.Forms.Build.Tasks.XamlCTask.Compile() at Xamarin.Forms.Build.Tasks.XamlCTask.Execute() at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Object[]& outArgs) at System.Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessage(IMessage msg)
在[0]处抛出异常:
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg,IMessage retMsg)
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData,Int32类型),位于Microsoft.Build.Framework.ITask.Execute()
在
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
在
Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()XXXXXXX.XXXXXX.XXXXXX
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage
reqMsg, IMessage retMsg) at
System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&
msgData, Int32 type) at Microsoft.Build.Framework.ITask.Execute()
at
Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()
at
Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext() XXXXXXX.XXXXXX.XXXXXX
推荐答案
tl; dr:
在失败的页面上禁用XamlC
[XamlCompilationAttribute (XamlCompilationOptions.Skip)]
public partial class MyPageThrowing {}
或在大会一级
[assembly:XamlCompilationAttribute (XamlCompilationOptions.Skip)]
长篇故事
下一个(迄今为止)的 xamarin.forms 的问题,应为2.3.3-pre3或2.3.4.
Long Story
An issue throwing the same exception and the same StackTrace had been fixed in the next (to date) version of xamarin.forms which should be 2.3.3-pre3 or 2.3.4.
唯一可以确定的方法是将失败的Xaml页面粘贴在甚至更好的 http://上bugzilla.xamarin.com .
The only way to know for sure would be to paste your failing Xaml page here, or even better, on http://bugzilla.xamarin.com.
我真的鼓励您这样做.如果问题尚未解决.要么是Xaml中的问题,这需要抛出更好的异常,要么是XamlC中不受支持的情况,并且需要修复.
I really encourage you to do so. If the issue is not fixed already. Either it's an issue in your Xaml and this needs a better exception being thrown, or it's an unsupported case in XamlC, and this require a fix.
这篇关于"XamlCTask" Xamarin中的任务意外失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!