小编Sal*_*lly的帖子

错误:System.Windows.ni.dll中出现'System.Windows.Markup.XamlParseException'类型的第一次机会异常

我有windows手机应用程序; 当我运行应用程序时,我得到了这个异常并且它不再运行了

A first chance exception of type 'System.Windows.Markup.XamlParseException' occurred in System.Windows.ni.dll
Run Code Online (Sandbox Code Playgroud)

错误发生在intializecomponent()中的app.xaml文件中; 方法

public App()
    {
        // Global handler for uncaught exceptions.
        UnhandledException += Application_UnhandledException;

        // Standard XAML initialization
        InitializeComponent();

        // Phone-specific initialization
        InitializePhoneApplication();
Run Code Online (Sandbox Code Playgroud)

由于我在添加应用程序资源时发生错误

  <converter:RssTextTrimmer xmlns:converter="clr-namespace:HomePage" x:Key="RssTextTrimmer" />
Run Code Online (Sandbox Code Playgroud)

当我删除它时,应用程序运行良好.

以下是完整代码:

<Application
x:Class="HomePage.App"
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">

<!--Application Resources-->
<Application.Resources>
    <local:LocalizedStrings xmlns:local="clr-namespace:HomePage" x:Key="LocalizedStrings"/>
    <converter:RssTextTrimmer xmlns:converter="clr-namespace:HomePage" x:Key="RssTextTrimmer" />

</Application.Resources>

<Application.ApplicationLifetimeObjects>
    <!--Required object that handles lifetime events for the application-->
    <shell:PhoneApplicationService
        Launching="Application_Launching" Closing="Application_Closing"
        Activated="Application_Activated" Deactivated="Application_Deactivated"/>
</Application.ApplicationLifetimeObjects>
Run Code Online (Sandbox Code Playgroud)

转换器代码

namespace HomePage {class RssTextTrimmer:IValueConverter …

windows-phone-7 windows-phone-8

3
推荐指数
1
解决办法
5238
查看次数

错误:可访问性不一致:返回类型比方法'更难访问

我收到这个错误

错误6可访问性不一致:返回类型"HomePage.Models.SaveResult"比方法"HomePage.Models.CarDataStore.SaveFillup(HomePage.Models.Fillup,System.Action)"更难访问

这是班级:

 private const string CAR_PHOTO_DIR_NAME = "FuelTracker";
    private const string CAR_PHOTO_FILE_NAME = "CarPhoto.jpg";
    private const string CAR_PHOTO_TEMP_FILE_NAME = "TempCarPhoto.jpg";
    private const string CAR_KEY = "FuelTracker.Car";
    private static readonly IsolatedStorageSettings appSettings =
        IsolatedStorageSettings.ApplicationSettings;
    private static Car _car;

    public static event EventHandler CarUpdated;

    /// <summary>
    /// Gets or sets the car data, loading the data from isolated storage
    /// (if there is any saved data) on the first access. 
    /// </summary>
    public static Car Car 
    { 
        get
        {
            if (_car …
Run Code Online (Sandbox Code Playgroud)

c# windows-phone-7 windows-phone-8

1
推荐指数
1
解决办法
8806
查看次数

标签 统计

windows-phone-7 ×2

windows-phone-8 ×2

c# ×1