System.Argument Exception in Visual Studio 2015

2019-09-07 05:06发布

I am trying to develop a windows universal app. Today, when I opened xaml editor I am facing the following issue.

System.ArgumentException
An item with the same key has already been added.
at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value,Boolean add)
at  Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.CachedAppPackageInfo.DeserializeCacheMappings(String[] values)
at  Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.AppXRecovery.GetExisti ngPackageInfoForProject(IHostProject project)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.WindowsXamlAppPackage.CreateOrRecover(IHostProject project, IHostProjectService projectService, IHostPlatformService platformService, IHostShadowCopyService shadowCopyService, PackageService packageService, IHostFileChangeWatcherService fileChangeWatcherService, String frameworkPackagePath)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.PackageService.<>c__DisplayClass10_0.<.ctor>b__0(IHostProject project, IHostProjectService projectService, IHostPlatformService platformService, IHostShadowCopyService shadowCopyService)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.PackageService.CreateAppPackage(IHostProject hostProject)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.PackageService.GetOrCreateAppPackage(IHostProject project, Boolean& isCreated)
at Microsoft.VisualStudio.DesignTools.HostUtility.AppPackage.PackageService.RegisterPackageForProject(IHostProject project)
at Microsoft.VisualStudio.DesignTools.DesignerHost.HostServices.HostProject.PreparePackageForActivation()
at Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateDesignerProcess(String applicationPath, String clientPort, Uri hostUri, IDictionary environmentVariables, Int32& processId, Object& processData)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory, IIsolationBoundary boundary, AppDomainSetup appDomainInfo, IIsolationTarget isolationTarget, String baseDirectory)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
at Microsoft.VisualStudio.DesignTools.HostUtility.Platform.AppContainerProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.Initialize()
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedObjectFactory.Initialize()
at Microsoft.VisualStudio.DesignTools.DesignerHost.Services.VSIsolationService.CreateObjectFactory(IIsolationTarget isolationTarget, IObjectCatalog catalog)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolationService.CreateLease(IIsolationTarget isolationTarget)
at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.CreateLease(IIsolationTarget isolationTarget, CancellationToken cancelToken, DesignerServiceEntry& entry, IServiceProvider serviceOverrides)
at Microsoft.VisualStudio.DesignTools.DesignerContract.IsolatedDesignerService.IsolatedDesignerView.CreateDesignerViewInfo(CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.InvokeWithCulture[T](CultureInfo culture, Func`2 func, CancellationToken cancelToken)
at Microsoft.VisualStudio.DesignTools.DesignerContract.Isolation.IsolatedTaskScheduler.<>c__DisplayClass10_0`1.<StartTask>b__0()
at System.Threading.Tasks.Task`1.InnerInvoke()
at System.Threading.Tasks.Task.Execute()

See the error screenshot here

Edit 1: The xaml page for reference. It was working fine. Also the designer is working for other projects.

<Page
x:Class="RoadTransportFinal.logout"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:RoadTransportFinal"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<ScrollViewer>
    <Grid x:Name="ownnum" RequestedTheme="Dark">
        <Grid.Background>
            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                <GradientStop Color="Black" Offset="0"/>
                <GradientStop Color="#FF015C70" Offset="1"/>
            </LinearGradientBrush>
        </Grid.Background>
        <TextBlock x:Name="about"
        Padding="5,0,0,5"
        HorizontalAlignment="Stretch" Margin="21,31,17,0" TextWrapping="Wrap" Text="Thank You for using the app..... "
              VerticalAlignment="Top" Foreground="#FF71CFC2" FontSize="33.333"  Height="91" Width="322"/>
        <Button x:Name="button_home" Content="Home" Click="home_Click" HorizontalAlignment="Stretch" Margin="133,532,160,0" VerticalAlignment="Top" Foreground="Black" FontWeight="Bold" Height="34" Width="66" BorderBrush="#FFFFFF19">
            <Button.Transitions>
                <TransitionCollection>
                    <EntranceThemeTransition/>
                </TransitionCollection>
            </Button.Transitions>
        </Button>
        <Image x:Name="image" HorizontalAlignment="Stretch" Height="35" Margin="189,79,127,0" VerticalAlignment="Top" Width="44" Source="ms-appx:///Assets/smilie.gif"/>
        <TextBlock x:Name="quote1" HorizontalAlignment="Stretch" Margin="40,155,25,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="295" Height="76" FontSize="18.667">
            <Run Text="&quot;Its better to be Mr. Late than Late Mr.&quot;"/>
            <LineBreak/>
            <Run Text="                                   -Anonymous"/>
        </TextBlock>
        <TextBlock x:Name="quote2" HorizontalAlignment="Stretch" Margin="49,255,42,0" TextWrapping="Wrap" VerticalAlignment="Top" Width="269" Height="85">
            <Run FontWeight="Bold" Text="                    FOLLOW RULES"/>
            <LineBreak/>
            <Run FontWeight="Bold" Text="                      DRIVE SAFELY"/>
            <LineBreak/>
            <Run FontWeight="Bold" Text="                       STAY HAPPY "/>
            <LineBreak/>
            <Run FontWeight="Bold" Text="                      STAY BLESSED"/>
            <LineBreak/>
            <Run FontWeight="Bold" Text="                             "/>
        </TextBlock>
        <Image x:Name="likefb" HorizontalAlignment="Stretch" Height="22" Margin="128,382,135,0" VerticalAlignment="Top" Source="ms-appx:///Assets/fb_icon.png"/>
        <HyperlinkButton Content="Facebook" NavigateUri="https://www.facebook.com/rishabh.saxena11" HorizontalAlignment="Stretch" Margin="230,375,47,0" VerticalAlignment="Top" FontSize="18.667" Height="34" Width="83" Foreground="White" FontWeight="Bold"/>
        <Image x:Name="thumbsup" HorizontalAlignment="Stretch" Height="22" Margin="4,157,326,0" VerticalAlignment="Top" Width="30" Source="ms-appx:///Assets/thumbsup.png"/>
        <Image x:Name="thumbsup2" HorizontalAlignment="Stretch" Height="32" Margin="83,260,235,0" VerticalAlignment="Top" Width="42" Source="ms-appx:///Assets/thumbsup.png"/>
        <Image x:Name="thumbsup3" HorizontalAlignment="Stretch" Height="32" Margin="249,259,69,0" VerticalAlignment="Top" Width="42" Source="ms-appx:///Assets/thumbsup.png"/>
        <Image x:Name="image2" HorizontalAlignment="Stretch" Height="24" Margin="144,411,143,0" VerticalAlignment="Top" Width="73" Source="ms-appx:///Assets/twitter.png"/>
        <HyperlinkButton Content="Twitter" NavigateUri="" HorizontalAlignment="Stretch" Margin="229,406,60,0" VerticalAlignment="Top" Foreground="White" FontWeight="Bold" FontSize="18.667" Height="35"/>
        <Image x:Name="instagram" HorizontalAlignment="Stretch" Height="48" Margin="130,434,131,0" VerticalAlignment="Top" Source="ms-appx:///Assets/instagram.png"/>
        <HyperlinkButton Content="Instagram" NavigateUri="https://instagram.com/rishabh.saxena11" HorizontalAlignment="Stretch" Margin="228,436,42,0" VerticalAlignment="Top" Foreground="White" FontSize="18.667" FontWeight="Bold"/>
        <Button x:Name="exit" Content="Exit" HorizontalAlignment="Stretch" Margin="215,533,79,0" Click="exit_Click" VerticalAlignment="Top" BorderBrush="#FFFFFF19" Foreground="Black" FontWeight="Bold" Width="66"/>

    </Grid>
</ScrollViewer>

Anyhelp will be appreciated! Thanks.

1条回答
虎瘦雄心在
2楼-- · 2019-09-07 05:17

Finally, I was able to solve the issues by removing my entire Source folder. Then I got the source back my map and get and it is working fine now. I think it is an issue with Team Foundation Server.

查看更多
登录 后发表回答