anton.sodergren_pdx
Topic Author
Posts: 18
Joined: 24 Mar 2022, 17:10

XAML file name and line in error messages

30 May 2023, 16:02

Hello!
I'm wondering if there's any way to get the XAML file and relevant line to show when printing error messages, to make the errors easier to debug. For example with an error message such as this:
[error] [ConditionListener.cpp:99] [Noesis - Binding]: 'Converter<BitmapImage>' binding converter failed to convert value 'null' (type '')
It can be quite difficult to know where to look. We can easily get the line in C++ code base where it is printed from with a macro, but since the error is probably in XAML, it would be much more useful to know where in XAML the error is caused. With the current information the error message is giving, the error could be caused just about anywhere.
Is there any way to print such info, or something similar? I realize that this is not trivial since it might involve a lot of metadata, but it would be immensely useful so I thought I'd ask at least.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: XAML file name and line in error messages

30 May 2023, 16:18

In Noesis 3.1, errors from XAML follow this pattern: path/filename.xaml (line): message
In Noesis 3.2, errors from XAML follow this pattern: path/filename.xaml (line,col): message

Noesis 3.2 also added a new error handler (ErrorHandler2) with information about the line and number (without having to parse any string) that can be set using SetThreadErrorHandler
 
anton.sodergren_pdx
Topic Author
Posts: 18
Joined: 24 Mar 2022, 17:10

Re: XAML file name and line in error messages

30 May 2023, 17:34

Interesting, we're currently on version 3.1.4. Perhaps there's something we haven't set up correctly, given that our Noesis error messages print in the format I pasted above (with no information about XAML file). We have a log handler set via Noesis::SetLogHandler.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: XAML file name and line in error messages

31 May 2023, 12:14

If you are not getting XAML and line information it is because the error is not happening when parsing the XAML. For example, in your case, bindings are applied after parsing (there is a ticket to improve this #2222). WPF is doing exactly the same in this case, but we could provide a better solution.

Also many improvements were implemented in our VSCode extension (this is using 3.2 too) for better error information.
 
anton.sodergren_pdx
Topic Author
Posts: 18
Joined: 24 Mar 2022, 17:10

Re: XAML file name and line in error messages

31 May 2023, 12:43

Ah yep, that makes sense then! Indeed, having that information for bindings would be amazing. I get that WPF also doesn't solve this, but any improvements you could find for this would be very appreciated. Nice to hear that there's a ticket for it already. :)

Haven't tried the VSCode extension yet, only been using Blend for that so far. Guess that's also something to look into after we update to 3.2.
 
anton.sodergren_pdx
Topic Author
Posts: 18
Joined: 24 Mar 2022, 17:10

Re: XAML file name and line in error messages

04 Mar 2024, 10:02

For example, in your case, bindings are applied after parsing (there is a ticket to improve this #2222). WPF is doing exactly the same in this case, but we could provide a better solution.
Hi, just wanted to check, has there been any further work on this? We're getting quite a few error messages in our error logs that are very difficult to debug and fix because we're not getting any XAML information in the error messages. Even though we try to avoid it, it will always happen every now and then that some of these error messages slip through, and then it's quite important that we're able to efficiently debug them. And I'd imagine this is true for other developers as well.
 
User avatar
jsantos
Site Admin
Posts: 3905
Joined: 20 Jan 2012, 17:18
Contact:

Re: XAML file name and line in error messages

04 Mar 2024, 15:27

These are binding errors right? So you need #2222 fixed, is that correct? I have increased the priority of that ticket.
 
anton.sodergren_pdx
Topic Author
Posts: 18
Joined: 24 Mar 2022, 17:10

Re: XAML file name and line in error messages

04 Mar 2024, 15:33

Correct, for binding errors, so #2222 indeed. Thanks, that's great to hear!

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot], Semrush [Bot] and 2 guests