Ben*_*jin 23 .net c# windows-phone-8 win-universal-app
我正在尝试通过制作一个提供有关口袋妖怪信息的基本应用来学习Windows Phone开发.为此,我创建了一个可移植的类库(PokeLib.dll),因此它与通用应用程序兼容.我通过同一解决方案("测试")中的项目对此进行了测试,并且工作正常.您可以在我的Github上查看这些代码,但据我所知,这一切都很好.这两个项目都在一个解决方案中.对于Windows Phone应用程序的解决方案,我将PokeLib添加为"现有项目",添加了引用,并编写了几行代码以确保我可以调用它:
MainPage.xaml中:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Button Name="GetDataButton" Content="GetData" Click="GetDataButton_Click" Grid.Row="0" HorizontalAlignment="Center"/>
<TextBlock Name="DataText" Text="Click to get data" Grid.Row="1" Padding="10"/>
</Grid>
Run Code Online (Sandbox Code Playgroud)
MainPage.xaml.cs中:
protected override void OnNavigatedTo(NavigationEventArgs e)
{
p = new Pokemon(1); // gets data for Pokemon #1 (Bulbasaur)
}
Pokemon p;
int counter = 0;
private async void GetDataButton_Click(object sender, RoutedEventArgs e)
{
DataText.Text = "Fetching... Count: " + ++counter;
if (counter == 1) // first time button's clicked
{
await p.Create(); // populates the data container
DataText.Text = String.Format("Pokemon #{0}: {1}", p.Id, p.Name);
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试在手机模拟器上运行时,我收到以下消息:
.我正在将项目构建为"debug"并且未选中"Enable Just My Code".我不知道在Symbols窗格下要做什么,但我也可以添加它的截图,如果它有用的话.
无论如何,应用程序打开,但是当我按下GetData按钮时冻结.我预计它会冻结片刻,因为该调用是同步完成的,但这是永久性的.但是,不会抛出任何错误/异常.当我尝试进入p.Create()调用时,调试器也没有响应(可能源于屏幕截图中的消息).
任何人都知道我做错了什么?谢谢!
Iva*_*van 15
您可以转到项目属性 - >构建 - >高级按钮 - >调试信息下拉列表,并将其值更改为"完整".
我刚刚修正了同样的错误.我去了工具 - >选项 - >调试 - >符号,并在Visual Studio 2013中按下了空符号缓存.可能垃圾桶和obj文件夹的做法几乎不那么优雅.