Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

xaml parse error on interaction triggers wp8.1(silverlight)

I have a working solution for WP8.0. But I needed to upgrade to get access to WNS. I have succeeded in adding WNS to the upgrade solution in the main menu works. But after Upgrading to wp8.1(silverlight), I have had some weird errors, that only happens on runtime. As an example it happens in the following usercontrol:

<UserControl
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"
 xmlns:i="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity"
xmlns:cmd="clr-namespace:GalaSoft.MvvmLight.Command;assembly=GalaSoft.MvvmLight.Platform"
xmlns:View="clr-namespace:ShieldGenerator.View"
xmlns:phone="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone"
x:Class="ShieldGenerator.View.MoveableShieldGear"
mc:Ignorable="d"
Canvas.Left="{Binding Gear.x}" Canvas.Top="{Binding Gear.y}" Canvas.ZIndex="{Binding Gear.z}" >

<Path Data="{Binding Gear.Path}" Fill="{Binding Gear.Color}" Stretch="Fill" UseLayoutRounding="False" Height="{Binding Gear.Height}" Width="{Binding Gear.Width}" Opacity="{Binding Gear.Opacity}">
    <Path.RenderTransform>
        <TransformGroup>
            <ScaleTransform ScaleX="{Binding Gear.Scale}" ScaleY="{Binding Gear.Scale}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}"/>
            <RotateTransform Angle="{Binding Gear.Rotate}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}" />
            <SkewTransform AngleX="{Binding Gear.SkewX}" AngleY="{Binding Gear.SkewY}" CenterX="{Binding Gear.CenterX}" CenterY="{Binding Gear.CenterY}" />
        </TransformGroup>
    </Path.RenderTransform>

    <i:Interaction.Triggers>

        <i:EventTrigger EventName="ManipulationStarted">
            <cmd:EventToCommand Command="{Binding MouseDownGearCommand}" PassEventArgsToCommand="True"/>
        </i:EventTrigger>

        <i:EventTrigger  EventName="ManipulationDelta">
            <cmd:EventToCommand Command="{Binding MouseGearMoveCommand, Mode=OneWay}" PassEventArgsToCommand="True"/>
        </i:EventTrigger>

        <i:EventTrigger  EventName="ManipulationCompleted">
            <cmd:EventToCommand Command="{Binding MouseUpGearCommand}" PassEventArgsToCommand="True"/>
        </i:EventTrigger>

        <i:EventTrigger  EventName="DoubleTap">
            <cmd:EventToCommand Command="{Binding DoubleTapCommand}" PassEventArgsToCommand="True"/>
        </i:EventTrigger>
    </i:Interaction.Triggers>

</Path>

</UserControl>

Where the events are binded to my VM, the commands in the VM are defined as RelayCommand. As stated this was a working solution with no errors. I updated and still no errors when compiling. I have no code behind the view, but the error occurs in the line below marked with ERROR (in the *.g.cs file)

namespace ShieldGenerator.View {


public partial class MoveableShieldGear : System.Windows.Controls.UserControl {

    private bool _contentLoaded;

    /// <summary>
    /// InitializeComponent
    /// </summary>
    [System.Diagnostics.DebuggerNonUserCodeAttribute()]
    public void InitializeComponent() {
        if (_contentLoaded) {
            return;
        }
        _contentLoaded = true;
        System.Windows.Application.LoadComponent(this, new System.Uri("/ShieldGenerator;component/View/MoveableShieldGear.xaml", System.UriKind.Relative)); //ERROR
    }
}
}

The error refers to the line in <i:Interaction.Triggers> in the above xaml code.

I have tried uninstalling and installing several packages with no success. I have tried to search around, and found ideas for including Mode=Oneway, and some stating error in the xaml parser. I am at a complete loss.

Hope somebody can help!

The errorenter image description here

This error is displayed everywhere I use i:interaction. I have looked for a way to find an wp8.1 version of System.Windows.Interactivity But have not been able to do so. I have therefore made sure that the MVVMLight tools are updated:

enter image description here

Information based on the Comment

Difference in new app.config Is a new addition.

Difference in new WMAppManifest.xml NotificationService="WNS" Because I have set it up and it works

NEW

<Capabilities>
  <Capability Name="ID_CAP_NETWORKING" />
  <Capability Name="ID_CAP_MEDIALIB_AUDIO" />
  <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" /> 
  <Capability Name="ID_CAP_MEDIALIB_PHOTO" />
</Capabilities>

OLD

<Capabilities>
  <Capability Name="ID_CAP_NETWORKING" />
  <Capability Name="ID_CAP_MEDIALIB_AUDIO" />
  <Capability Name="ID_CAP_MEDIALIB_PLAYBACK" />
  <Capability Name="ID_CAP_SENSORS" />
  <Capability Name="ID_CAP_WEBBROWSERCOMPONENT" />
  <Capability Name="ID_CAP_MEDIALIB_PHOTO" />
  <Capability Name="ID_CAP_PUSH_NOTIFICATION" />
  <Capability Name="ID_CAP_IDENTITY_USER" />
 </Capabilities>

I have removed the capabilities I did not use anymore. And added in the new Package.appxmanifest for WP8.1

<Capabilities>
<Capability Name="internetClientServer" />
<Capability Name="musicLibrary" />
<Capability Name="picturesLibrary" />

I have per the other question also problem with the AGHost.exe, but I have not tried to delete it as I thought the below was mandatory.

<Applications>
<Application Id="xd82c080dy903dy47f4yba02y5a36d745c72bx" Executable="AGHost.exe" EntryPoint="StartUp/FirstPage.xaml">
  <m3:VisualElements DisplayName="XXXXX" Square150x150Logo="Assets\SquareTile150x150.png" Square44x44Logo="Assets\Logo.png" Description="XXXX" ForegroundText="light" BackgroundColor="#464646" ToastCapable="true">
    <m3:DefaultTile Square71x71Logo="Assets\SquareTile71x71.png">
    </m3:DefaultTile>
    <m3:SplashScreen Image="Assets\Splashscreen.png" />
  </m3:VisualElements>
</Application>


</Applications>
<Capabilities>
    <Capability Name="internetClientServer" />
    <Capability Name="musicLibrary" />
    <Capability Name="picturesLibrary" />
</Capabilities>
<Extensions>
  <Extension Category="windows.activatableClass.inProcessServer">
    <InProcessServer>
      <Path>AgHostSvcs.dll</Path>
      <ActivatableClass ActivatableClassId="AgHost.BackgroundTask" ThreadingModel="both" />
    </InProcessServer>
  </Extension>
</Extensions>

Cannot find any other issue in this file. AssemblyInfo.cs and AppManifest.xml are the same. Looking at the reference folder the references seems okay, and are updated for wp8.1 (those that could)

Extra

If I copy the xaml code (i.e path with interaction) into another page that worked. Then it fails with the same error, during the xaml parsing for the page that worked without the snippet.

New Update It seems that upon my upgrade something got damaged in the solutions and the projects. The following I has found, is that I can get the code up and working in a new project. The code works if I run and deploy the project.

If I on the other hand use the same project, that worked when deployed, now navigate to it from another project "/BC_Creator;component/MainPage.xaml" Then the above error occurs again. My only idea now is to try and create completely new projects and copy-pasting the code into new files. Since importing them still does not seem to work.

WTF has happend :S

like image 884
JTIM Avatar asked Jul 21 '15 17:07

JTIM


1 Answers

I am still open for answers.

But my current result is that the it is in fact the MVVMLight package that is the issue.

After upgrading the solutions, uninstalling and reinstalling using the packmanager console, I had removed all errors. But the solution was not working. This has ended with me having to create a new solution and importing the old projects. Some of the issues however persisted, resulting in a copy-paster into new files, created with the same names. And suddenly it worked, so odd :/

The old solution is still not working, and even testing to import the old files (not project JUST code files) did not work, only recreating and copying worked.

It is really odd, so still open for solutions, because this will take a looong time!

like image 91
JTIM Avatar answered Nov 04 '22 07:11

JTIM