0

I have been having numerous problems concerning "unhandled win32 exceptions". They seem to crop up a lot of the time when I use data bindings, although not always. I have not found a solution to them yet, I have instead managed to find a way around the data bindings in the cases encountered so far, like in the question I have already posted on the matter, which is available here:

Bind to UIElement in code-behind crashing

However, I cannot use some other technique with my current issue, which is why I would like to be able to clear this up:

The exception appears as soon as the property that is bound to is changed, firing the OnPropertyChanged event, which is set up as follows:

private ObservableCollection<Element> elements;
public ObservableCollection<Element> Elements
{
    get { return elements; }
    set
    {
        elements = value;
        OnPropertyChanged("Elements");
    }
}

public event PropertyChangedEventHandler propertyChanged;
public void OnPropertyChanged(string propertyName)
{
    propertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
}

The markdown is as follows:

<ListView x:Name="taskList" Grid.Row="1" Grid.Column="1" Margin="10,10,20,20" Background="White" ItemsSource="{Binding Elements, UpdateSourceTrigger=PropertyChanged}">

In case you were wondering, this behaviour does not seem to be exclusive to ListViews with IEnumerables, as it appeared when binding to the UIElement in the previous question as well.

The exception presents this text in a warning window, followed by this menu:

Warning

A debugger is attached to [Project Name.exe] but not configured to debug this unhandled exception. To debug this exception, detach the current debugger.

Win32 exception choose debugger (The name is edited out for legal reasons)

If I choose to attach a instance of VS, it instantly stops debugging after realizing that another instance of VS is already attached. If I pick "No", the application stops execution. The error code in brackets in different upon every execution.

This error is driving me up the wall, so any pointers to what might be causing this are appreciated, since my project is suffering tremendously from it and progress stangates every time I run into it.

If you need any more code or information, just write a comment and I'll supply it.

Thank you very much for taking the time to look into this issue!

EDIT: I have further observed the issue and have found that using x:Bind does not help either, the exception is still thrown.

Light Drake
  • 121
  • 3
  • 9
  • Win32 exceptions are typically exceptions mapped from errors returned from P/Invoked Windows API routines. To be able to debug them properly, you may need to check "Enable native debugging" in project and/or ide settings. – Zastai Jun 16 '16 at 16:28
  • @Zastai could you tell me where to find this setting? I've been looking around, but can't find it. – Light Drake Jun 16 '16 at 16:34
  • It's possible it's something that applies to managed c++ projects only. Am working from memory; I'll have a look through vs2015 when i get home. – Zastai Jun 16 '16 at 16:35
  • I seem to be onto something now, it appears that my flag "DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION" was preventing the exception from firing (I was testing my exception handler), but now, I get a break with the info that a resource could not be found with its key. If I continue, the win32 exception fires. I may have to post a seperate question concerning this issue. – Light Drake Jun 16 '16 at 17:13
  • That sounds like something (your code or WPF, although the latter seems unlikely) is trying to access a win32-style resource; dotnet binaries tend to only have version info and one icon - the rest is in dotnet style resources in the assembly. – Zastai Jun 16 '16 at 17:43
  • No, it's line is on one with a staticresource to a converter inside a datatemplate, though I'm wondering why it can't find it, even though it's directly in the parent object. – Light Drake Jun 16 '16 at 17:45
  • Ok yes, that sounds like a wpf thing - am not very well versed in that. – Zastai Jun 16 '16 at 17:46
  • It's technically UWP, I'll post the issue tomorrow and link it from here. – Light Drake Jun 16 '16 at 17:47

0 Answers0