- anton.sodergren_pdx
- Posts: 18
- Joined:
XAML file name and line in error messages
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:
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.
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:
Code: Select all
[error] [ConditionListener.cpp:99] [Noesis - Binding]: 'Converter<BitmapImage>' binding converter failed to convert value 'null' (type '')
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.
Re: XAML file name and line in error messages
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
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
- Posts: 18
- Joined:
Re: XAML file name and line in error messages
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.
Re: XAML file name and line in error messages
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.
Also many improvements were implemented in our VSCode extension (this is using 3.2 too) for better error information.
- anton.sodergren_pdx
- Posts: 18
- Joined:
Re: XAML file name and line in error messages
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.
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
- Posts: 18
- Joined:
Re: XAML file name and line in error messages
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.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.
Re: XAML file name and line in error messages
These are binding errors right? So you need #2222 fixed, is that correct? I have increased the priority of that ticket.
- anton.sodergren_pdx
- Posts: 18
- Joined:
Re: XAML file name and line in error messages
Correct, for binding errors, so #2222 indeed. Thanks, that's great to hear!
Who is online
Users browsing this forum: Ahrefs [Bot], Google [Bot] and 5 guests