locked
An unhandled Exception has occurred (Click here to reload the designer) in App.xaml

    Question

  • Any suggestions how I can fix:

    System.UnauthorizedAccessException
     
    Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED))
     
    at Microsoft.Expression.DesignHost.Isolation.Remoting.NativeMethods.IApplicationActivationManager.ActivateApplication(String appUserModelId, String activationContext, ActivateOptions options, Int32& processId) at Microsoft.Expression.DesignHost.Platform.TailoredDomainFactory.CreateDesignerProcess(String applicationPath, String clientPort, String hostUri, IDictionary environmentVariables, Int32& processId) at Microsoft.Expression.DesignHost.Isolation.Primitives.ProcessDomainFactory.ProcessIsolationDomain..ctor(ProcessDomainFactory factory, IIsolationBoundary boundary, AppDomainSetup appDomainInfo, FrameworkName targetFramework) at Microsoft.Expression.DesignHost.Isolation.Primitives.ProcessDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary) at Microsoft.Expression.DesignHost.Platform.TailoredDomainFactory.CreateIsolationDomain(IIsolationBoundary boundary) at Microsoft.Expression.DesignHost.Isolation.Primitives.IsolationBoundary.Initialize() at Microsoft.Expression.DesignHost.Isolation.Primitives.IsolationBoundary.CreateInstance[T](Type type) at Microsoft.Expression.DesignHost.Isolation.IsolatedExportProvider.Initialize() at Microsoft.VisualStudio.ExpressionHost.Services.VSIsolationService.CreateExportProvider(FrameworkName frameworkName, IsolationInformation isolationInformation, ICatalogFactory catalogFactory, IExportFilter filter) at Microsoft.Expression.DesignHost.Isolation.IsolationService.CreateLease(FrameworkName frameworkName, IsolationInformation isolationInformation) at Microsoft.Expression.DesignHost.IsolatedDesignerService.CreateLease(FrameworkName targetFramework, IsolationInformation isolationInformation, DesignerServiceEntry& entry) at Microsoft.Expression.DesignHost.IsolatedDesignerService.CreateDesignerViewInfo(FrameworkName targetFramework, IsolationInformation isolationInformation, IHostSourceItem item, IHostTextEditor editor, CancellationToken cancelToken) at Microsoft.Expression.DesignHost.IsolatedDesignerService.<>c__DisplayClass10.<CreateDesigner>b__f() at System.Threading.Tasks.Task`1.InnerInvoke() at System.Threading.Tasks.Task.Execute()

    Context:

    I typed in a C++ Hello world program and am trying to add a few things.

     

     The App.xaml shows:

    <Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    x:Class="hello.App" />

     

    After I exit VS11, and reload the project, I see in App.xaml:

    <UserControl x:Class="hello.MainPage"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        mc:Ignorable="d"
        d:DesignHeight="768" d:DesignWidth="1366">
       
        <Grid x:Name="LayoutRoot" Background="#FF0C0C0C">
            <StackPanel>
                <Button Content="Click Me" FontSize="24" Width="200" Height="60" Click="HelloButton_Click" />
                <TextBlock x:Name="DisplayText" FontSize="48" Foreground="White" />
            </StackPanel>

        </Grid>
       
    </UserControl>

     

     

    he app.xaml.h shows:

    #pragma once

    #include "pch.h"
    #include "App.g.h"

    namespace hello
    {
        ref class App
        {
        public:
            virtual void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs);
        };
    }

    .cpp

    #include "pch.h"
    #include "MainPage.xaml.h"
    using namespace Windows::UI::Xaml;
    using namespace hello;

    App::App()
    {
        InitializeComponent();
    }

    App::~App()
    {
    }

    void App::OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs^ pArgs)
    {
        Window::Current->Content = ref new MainPage();
        Window::Current->Activate();
    }


    #pragma once

    #include "pch.h"
    #include "MainPage.g.h"

    namespace hello
    {

     value struct Coordinates
     {
       Float64 Latitude;
       Float64 Longitude;
     };


        public ref class MainPage
        {
            public:
                MainPage();
                ~MainPage();

       void acceptAudio();

       void HelloButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e);


        };
    }

    _____________

     

    #include "pch.h"
    #include "MainPage.xaml.h"

    using namespace Windows::UI::Xaml;
    using namespace Windows::UI::Xaml::Controls;
    using namespace Windows::UI::Xaml::Data;
    using namespace hello;

    MainPage::MainPage()
    {
        InitializeComponent();
    }

    MainPage::~MainPage()
    {
    }

    ____________________

     

     auto initializeOperation = mc->InitializeAsync();

     

     auto  ras =  ref new InMemoryRandomAccessStream();   // provides IRandomAccessStream^ stream
     
     StartRecordOperation^ sro = mc->StartRecordToStreamAsync( encodingProfile, ras );
     mc->StopRecordAsync();

    }


    void hello::MainPage::HelloButton_Click(Platform::Object^ sender, Windows::UI::Xaml::RoutedEventArgs^ e)
    {
        DisplayText->Text = "Hello World";

    }
    I can build:

    1>------ Build started: Project: hello, Configuration: Debug Win32 ------
    1>  App.xaml.cpp
    1>  MainPage.xaml.cpp
    1>  Generating Code...
    1>  hello.vcxproj -> C:\Users\andrew7webb\Documents\Visual Studio 11\Projects\Hello\Debug\hello\hello.winmd
    1>  MainPage.g.cpp
    1>  XamlTypeInfo.g.cpp
    1>  Generating Code...
    1>  hello.vcxproj -> C:\Users\andrew7webb\Documents\Visual Studio 11\Projects\Hello\Debug\hello\hello.exe
    1>  hello -> C:\Users\andrew7webb\Documents\Visual Studio 11\Projects\Hello\Debug\hello\hello.build.appxrecipe
    ========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========

     

     

    Wednesday, September 28, 2011 11:28 PM

Answers

  • Right.  The project is open, I can build the project, but the XAML designer is consistently failing to load in Visual Studio Express.

    New info:  I just noticed that I have two instances of VS11 running!

    I can't seem to alt - tab to the one that has the project loaded, so I close the other one which was on the start page.  Still can't stay on the VS11 I want to try. 

    At the moment, XDesProc is not in the processes according to task manager.

     OK. I'm going to reboot, and try again from scratch. 

     -----------------

    After a restart, I load VS11, and still see 

    System.UnauthorizedAccessException

    Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) etc

    -----------------

    Light bulb !

    I had restored the Windows Start menu by setting HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer  RPEnabled to 0.  I had been starting VS11 using the Win7 start menu.

    Thinking that this might cause trouble with the XAML designer, I set RPEnabled back to 1, and reboot.  Now using the METRO interface,  I click on VS11, and the XAML designer returns.

    XDesProc.exe is running happily, and my mood has improved too.

    So perhaps Designer should fail with more clarity in such a situation, and I should leave the registry alone for a while.


    Friday, September 30, 2011 2:54 AM

All replies

  • Hi Andrew,

    To clarify, you can open and build the project, but the XAML designer is consistently failing to load in Visual Studio Express?

    After exiting Visual Studio Express, do you still see any instances of XDesProc.exe in any state other than Terminated? If so, could you right-click on it and generate a dump file for us to review?

    Then right-click and End the process and reopen the project.

    Thanks,

    -David

    Friday, September 30, 2011 1:20 AM
    Moderator
  • Right.  The project is open, I can build the project, but the XAML designer is consistently failing to load in Visual Studio Express.

    New info:  I just noticed that I have two instances of VS11 running!

    I can't seem to alt - tab to the one that has the project loaded, so I close the other one which was on the start page.  Still can't stay on the VS11 I want to try. 

    At the moment, XDesProc is not in the processes according to task manager.

     OK. I'm going to reboot, and try again from scratch. 

     -----------------

    After a restart, I load VS11, and still see 

    System.UnauthorizedAccessException

    Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) etc

    -----------------

    Light bulb !

    I had restored the Windows Start menu by setting HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer  RPEnabled to 0.  I had been starting VS11 using the Win7 start menu.

    Thinking that this might cause trouble with the XAML designer, I set RPEnabled back to 1, and reboot.  Now using the METRO interface,  I click on VS11, and the XAML designer returns.

    XDesProc.exe is running happily, and my mood has improved too.

    So perhaps Designer should fail with more clarity in such a situation, and I should leave the registry alone for a while.


    Friday, September 30, 2011 2:54 AM
  • Thanks for investigating this issue Andrew. We will look into this issue but strongly recommend NOT to use any hacks on these bits.

    -Navit Saxena

    Tuesday, October 4, 2011 8:15 AM