首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Visual Studio / Expression - RemoteException

Visual Studio / Expression - RemoteException
EN

Stack Overflow用户
提问于 2013-03-11 02:51:51
回答 1查看 715关注 0票数 1

创建带有地理位置的WP7项目时,VS2012 UI设计器会抛出以下错误:

代码语言:javascript
复制
Microsoft.Expression.DesignHost.Isolation.Remoting.RemoteException
Could not load file or assembly 'LocationService.Interop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=24eec0d8c86cda1e' or one of its dependencies. System could not find the specified file.
   in System.Device.Location.GeoCoordinateWatcher.Dispose(Boolean disposing)
   in System.Device.Location.GeoCoordinateWatcher.Finalize()

我在谷歌和StackOverflow上搜索,没有找到任何有用的东西。如果我重新加载设计器,它会在Visual Studio 2012中工作一到两分钟。但是,如果我尝试打开项目,Expression Blend会立即崩溃。

这是我的一个页面的内容(但无论内容如何,它都会在每个页面崩溃):

代码语言:javascript
复制
<phone:PhoneApplicationPage 
x:Class="Dropi.MapView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
xmlns:shell="clr-namespace:Microsoft.Phone.Shell;assembly=Microsoft.Phone"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
FontFamily="{StaticResource PhoneFontFamilyNormal}"
FontSize="{StaticResource PhoneFontSizeNormal}"
Foreground="{StaticResource PhoneForegroundBrush}"
SupportedOrientations="Portrait" Orientation="Portrait"
mc:Ignorable="d" d:DesignHeight="768" d:DesignWidth="480"
shell:SystemTray.IsVisible="True" xmlns:my="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps" Loaded="onLoaded" Unloaded="onViewUnloaded">

<!--LayoutRoot is the root grid where all page content is placed-->
<Grid x:Name="LayoutRoot" Background="Transparent">
    <Grid.RowDefinitions>
        <RowDefinition Height="Auto"/>
        <RowDefinition Height="*"/>
    </Grid.RowDefinitions>

    <!--TitlePanel contains the name of the application and page title-->
    <StackPanel x:Name="TitlePanel" Grid.Row="0" Margin="12,17,0,28"></StackPanel>

    <!--ContentPanel - place additional content here-->
    <Grid x:Name="ContentPanel" Grid.Row="1" Margin="12,0,12,0">
        <my:Map Height="717" HorizontalAlignment="Left" Name="myMap" VerticalAlignment="Top" Width="450" CredentialsProvider="ApxwcCwErohOLVMieO3OPc0MrdT379URDUphvhbyR10udU9QmiYBK2urEPZZ1pl-" Mode="Road" ZoomBarVisibility="Visible" ZoomLevel="12"/>
    </Grid>
</Grid>

<!--Sample code showing usage of ApplicationBar-->
<!--<phone:PhoneApplicationPage.ApplicationBar>
    <shell:ApplicationBar IsVisible="True" IsMenuEnabled="True">
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button1.png" Text="Button 1"/>
        <shell:ApplicationBarIconButton IconUri="/Images/appbar_button2.png" Text="Button 2"/>
        <shell:ApplicationBar.MenuItems>
            <shell:ApplicationBarMenuItem Text="MenuItem 1"/>
            <shell:ApplicationBarMenuItem Text="MenuItem 2"/>
        </shell:ApplicationBar.MenuItems>
    </shell:ApplicationBar>
</phone:PhoneApplicationPage.ApplicationBar>-->

有什么想法吗?

提前感谢!

EN

回答 1

Stack Overflow用户

发布于 2013-03-22 21:26:59

我也有同样的问题。为了解决这个问题,我只做了这样的事情:

代码语言:javascript
复制
 if (!ViewModelBase.IsInDesignModeStatic)
 {
     _watcher = new GeoCoordinateWatcher(GeoPositionAccuracy.High) { MovementThreshold = 5 };
 }

更新这是MVVM Light解决方案。您可以通过检查System.ComponentModel.DesignerProperties.IsInDesignTool来检查是否处于设计模式

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/15326131

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档