2016-05-12 12 views
1

Visual Studio 2015 DebugNull Ausnahme - Ctor genannt nicht in WPF

Im XAML einen Fehler auf

xmlns:local="clr-namespace:Poker" 

Der Fehler XMLParseException ist, und dann SystemArgumentNullException in System.Core.dll

Der ctor von Poker.MainWindow wird nie
App.xaml.cs aufgerufen, aber es tut nichts
Der nächste Schritt ist der Fehler auf xmlns: localDiese ist eine app, die ich gearbeitet habe von für ein paar Wochen und keine Probleme

reinigen, wieder aufzubauen zeigt keine Fehler
Run-Code-Analyse findet keine Fehler
Ich denke, es ist etwas, über Laufzeit-Analyse, dass es bricht .

wenn ich Xmlns entfernen: local Ich kann es wieder hinzufügen, indem Sie zu Poker

Andere Anwendungen laufen ganz gut auf diesem PC
Der PC hat abstürzen nicht

Jemand für Code gefragt

<Window x:Class="Poker.MainWindow"  
    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:local="clr-namespace:Poker" 
    mc:Ignorable="d" 
    ResizeMode="NoResize"   
    DataContext="{Binding RelativeSource={RelativeSource self}}" 
    Title="No Limit Holdem Poker 6 Player Sit And Go (SNG) - Beat the Bots" Height="600" Width="650"> 
<Window.Resources> 
    <BooleanToVisibilityConverter x:Key="bvc" /> 
    <local:BackGroundConverter x:Key="backGroundConverter"/> 
    <local:BackGroundConverterCard x:Key="backGroundConverterCard"/> 
    <local:BackGroundConverterSuit x:Key="backGroundConverterSuite"/> 
    <Style TargetType="TextBlock"> 
     <Setter Property="FontSize" Value="20"/> 
    </Style> 
    <Style TargetType="TextBlock" x:Key="StdMargin"> 
     <Setter Property="FontSize" Value="18"/> 
     <Setter Property="Margin" Value="16,0,0,0"/> 
    </Style> 
    <Style TargetType="TextBlock" x:Key="StdMarginPlus"> 
     <Setter Property="FontSize" Value="20"/> 
     <Setter Property="Margin" Value="24,0,0,0"/> 
    </Style> 
    <Style TargetType="ComboBox"> 
     <Setter Property="FontSize" Value="18"/> 
    </Style> 
    <Color x:Key="ColorMyLighLightGray">#EDEDED</Color> 
    <SolidColorBrush x:Key="BrushMyLightLightGrey" Color="{StaticResource ColorMyLighLightGray}"/> 
</Window.Resources> 
<Grid Margin="10,0,2,0"> 
</Grid> 
</Window> 

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Windows; 
using System.Windows.Controls; 
using System.Windows.Data; 
using System.Windows.Documents; 
using System.Windows.Input; 
using System.Windows.Media; 
using System.Windows.Media.Imaging; 
using System.Windows.Navigation; 
using System.Windows.Shapes; 
using System.ComponentModel; 
using System.Diagnostics; 
//using System.Threading; 

namespace Poker 
{ 

    public enum enumSuite : byte { spade = 0, club = 1, heart = 3, diamond = 4, none = 5 }; 
    public enum enumRank : byte { one = 1, two = 2, three = 3, four = 4, five = 5, six = 6, seven = 7, eight = 8, nine = 9, ten = 10, jack = 11, queen = 12, king = 13, ace = 14 }; 
    public enum enumHand : byte { high = 0, onePair = 1, twoPair = 2, trip = 3, straight = 4, flush = 5, boat = 6, quad = 7, strtFlush = 8 }; 
    public enum enumHandDraw : byte { onePair = 1, twoPairTrips = 2, straight = 4, flush = 5, boat = 6, quad = 7, strtFlush = 8 }; 
    public enum enumPlayerType : byte { callSn = 0, rock = 1, GTO = 2 }; 

    // 0 nothing 
    // 1 pair 
    // 2 pair 
    // 3 trips 
    // 4 straight 
    // 5 flush 
    // 6 boat 
    // 7 four of a kind 
    // 8 straight flush 

    /// <summary> 
    /// Interaction logic for MainWindow.xaml 
    /// </summary> 
    public partial class MainWindow : Window, INotifyPropertyChanged 
    { 

     public event PropertyChangedEventHandler PropertyChanged; 
     private void NotifyPropertyChanged(String info) 
     { 
      if (PropertyChanged != null) 
      { 
       PropertyChanged(this, new PropertyChangedEventArgs(info)); 
      } 
     } 

     public MainWindow() 
     { 
      Debug.WriteLine("ctor"); // does not get called 
      //LoopCount(); 
      ProcessShuffle(); 
      EveryOneBet(0, true); 
      before = false; 
      InitializeComponent(); 
     } 
+0

@Clemens Mainwindow a hat ctor und es heißt nicht – Paparazzi

+0

Unklar was ich verlange? Nichts anderes zu geben. Das ist die Zeile mit dem Fehler und das ist die Fehlermeldung. Was brauchst du noch? – Paparazzi

+1

Arbeitsbeispiel (MainWindow.xaml, MainWindow.cs), wo das Problem reproduziert wird, wäre hilfreich, um die Ursache des Problems zu verstehen. –

Antwort

1

ich nicht schreiben sie den gesamten Code

Eigentlich war es in den Code hinter

Ich hatte

namespace 
{ 
    MainWindow 
    { 
    } 
    public class 
    { 
    } 
} 

Und zog ich eine Klasse in Hauptfenster, um eine statische Variable
zuzugreifen Und das brach die Dinge schlecht ohne Compiler-Fehler

namespace 
{ 
    MainWindow 
    { 
     public class 
     { 
     } 
    } 
}