我目前在构建我的Xamarin.Forms解决方案时遇到了问题.我收到了错误The "XamlCTask" task failed unexpectedly.我试着查看Xamarin日志和Stacktrace,但我似乎无法找到问题所在.我可以开始寻找任何建议吗?
日志
<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>
Run Code Online (Sandbox Code Playgroud)
堆栈跟踪
严重级代码说明项目文件行抑制状态错误"XamlCTask"任务意外失败.System.ArgumentException:已添加具有相同键的项.
服务器堆栈跟踪:位于System.ThrowHelper.ThrowArgumentException(ExceptionResource资源)的System.Collections.Generic.Dictionary`2.Insert(TKey键,TValue值,布尔加法)位于Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode节点, Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader reader,布尔嵌套)的Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode节点,XmlReader阅读器)Xamarin.Forms.Xaml.XamlParser.ReadNode(XmlReader阅读器)的XmlReader阅读器,布尔嵌套),位于Xamarin.Forms.Build.Tasks.XamlCTask的Xamarin.Forms.Build.Tasks.XamlCTask.ParseXaml(Stream stream,TypeReference typeReference)的Xamarin.Forms.Xaml.XamlParser.ParseXamlElementFor(IElementNode节点,XmlReader阅读器)系统中的System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md,Object [] args,Object server,Object []和outArgs)中的Xamarin.Forms.Build.Tasks.XamlCTask.Execute()处于.Compile() .Runtime.Remoting.Messaging.StackBuilderSink.SyncProcessMessa ge(IMessage msg)
在[0]处重新抛出异常:位于Microsoft.Build的System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData&msgData,Int32类型)的System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg,IMessage retMsg).
Microsoft.Build.BackEnd.TaskBuilder.d__26.MoveNext()XXXXXXX.XXXXXX.XXXXXX上的Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()中的Framework.ITask.Execute()
我遇到的小问题.我一直试图找到错误,但我找不到它,如果你可以指出它,或者给我一些很好的修正.至于这里的代码是:
using UIKit;
namespace App10
{
public class Application
{
// This is the main entry point of the application.
static void Main(string[] args)
{
var listView = new ListView();
listView.ItemsSource = new string[] {
"Trainer 1",
"Trainer 2",
"Trainer 3",
"Trainer 4",
"Trainer 5",
"Trainer 6",
};
listView.ItemsSource.Add("Trainer");
Run Code Online (Sandbox Code Playgroud)