UWP Radial Gauge maximum property causing exception - xaml

I have an UWP application that recieves data over MQTT from my ESP32 and displays on the screen. I have one radial gauge that was working nicely but now it's throwing a weird exception about the "Maximum" property.
Windows.UI.Xaml.Markup.XamlParseException
HResult=0x802B000A
Message=The text associated with this error code could not be found.
Failed to assign to property 'Windows.UI.Xaml.Controls.Primitives.RangeBase.Value'. [Line: 66 Position: 98]
Source=Windows
StackTrace:
at Windows.UI.Xaml.Application.LoadComponent(Object component, Uri resourceLocator, ComponentResourceLocation componentResourceLocation)
at UWP.Dcem.InitializeComponent() in C:\Users\ale_5\source\repos\UWP\UWP\UWP\obj\x86\Debug\Dcem.g.i.cs:line 59
at UWP.Dcem..ctor() in C:\Users\ale_5\source\repos\UWP\UWP\UWP\Dcem.xaml.cs:line 33
Without setting that property the gauge appears and doesn't throw any exception, but it's useless as it starts from 0 and ends at 0.
This is the code I'm currently using to render the gauge
<controls:RadialGauge Margin="0 65 0 10" x:Name="RadialGaugeControl" Value="0" Minimum="0"
Maximum="3300" TickSpacing="330" ScaleWidth="20" Unit="mV" TickBrush="Gainsboro"
ScaleTickBrush="AliceBlue" TrailBrush="#4c79a1" NeedleWidth="5" TickLength="18" Width="300"/>
The exception is thrown even when using the Microsoft's example from here
<controls:RadialGauge x:Name="RadialGaugeControl" Column="1" Value="70" Minimum="0"
Maximum="180" TickSpacing="20" ScaleWidth="26" Unit="Units" TickBrush="Gainsboro"
ScaleTickBrush="{ThemeResource ApplicationPageBackgroundThemeBrush}"
NeedleWidth="5" TickLength="18">
</controls:RadialGauge>
Control reference
xmlns:controls="using:Microsoft.Toolkit.Uwp.UI.Controls"
Version 6.0.0
Does anyone know whats causing this issue?

I tested your rendering code and it worked. And from the error message, it should be that you assigned the wrong value type to Value (for example, a non-double value such as a string is assigned to Value), independent of the Maximum proeprty.
There are some omissions in the official example, RadialGauge does not contain the Column property, please remove this property, or change to Grid.Column="1", it can run normally.
We will report the problem with this document to modify it as soon as possible to avoid misunderstanding.

Related

"Content" property / XAML

I'm trying the use WinUI 3 Gallery but I experiencing this error most of the code.
The property 'Default' is set more than once.
I tried StackLayout but this time it gives this.
An unexpected file break has occurred. The following items are not closed: Window. Line 24, position 17.
I expecting:
No error.
This error An unexpected file break has occurred. The following items are not closed: Window. Line 24, position 17.
Means that your XAML file is missing a at the end
You mention using a StackLayout, you likely mean StackPanel and if you are using a StackLayout, it is not going to do what you think it will do

How to get Exception source “Activity Description name”

When exceptions occur in a UIPath project I have an email that is sent out with the exception info included. There seems to be an issue though where I can only see where the error occured by looking at the selector information such as:
Cannot find the UI element corresponding to this selector:
<html app='chrome.exe' title='Microsoft Dynamics GP' />
<webctrl aaname='Add' idx='1'
parentid='a00000000000000008549000000030009000000000001000000000000' tag='DIV' />
This info and the stack trace or any other info is not really helpful for quickly finding the source of the problem. I have looked through the UIPath documentation and forum and found only the this question, which seemed to point to using the exception.Source to show the name of the activity where the error occurred. exception.Source only returns “UiPath.Core.Activities” though instead of "Type into Copy Job# 'INPUT'" in the following example:
This obviously causes a big problem with exception handling. How can I easily return the source with each exception?
When your selector fails, you will end up with a new object of type UiPath.Core.SelectorNotFoundException. However, until the team at UiPath decides to add the Display Name into the inner exception, there is little you can do in this particular case.
Take the following example - the first line shows the Inner Exception, and the second one in red is essentially just the exception being rethrown. Note that only the latter one contains the Display Name property.
The Source itself will usually be of type UiPath.Core.Activities, but since this is just the type's name, we don't have any link to the faulting object. Here's what you can do:
Add some details to your exception. You don't want to do this for each activity, but you could have certain blocks of try-catches (example: logging into the system consists of three individual activites, and they reside in one block).
Rethrow the exception. That way the Display Name will end up in the execution log file.

WP Windows Phone Invalid XAML

I get exception
An exception of type 'Windows.UI.Xaml.Markup.XamlParseException'
occurred in WP.MyOffice.exe but was not handled in user code
WinRT information: Unable to resolve property '%1' while processing
properties for Uid '%0'. [Line: 79 Position: 27]
1 - line 79 position 27
2 - "Invalid XAML" in Error List window
In Resources.recw has Hub.Header and HubSection1.Header
How found what is wrong?
Check your resources.resw file, you probably have something like Hub.Text, while the "Hub" element doesn't support that attribute (text). Maybe you already used the key Hub for something else
Strategy to fix:
Remove the x:uid properties and worry about localization later, get the Hub working.
If it still doesn't work create a basic hub with no items. Once working add the hub items/sections back until the point of failure.
Once the failure is determined resolve.

Parse.com preventing whitespaces in custom tracking events?

2 months ago I added custom tracking events with whitespaces in my app, such as:
[PFAnalytics trackEvent:#"Share Button Click" dimensions:dimensions];
However, it seems like Parse is no longer allowing whitespaces, which in turn has caused my code to stop registering analytics. Does anyone know a fix around this?
Here's the error:
Error: invalid event name: cannot contain whitespace (Code: 160, Version: 1.4.2)
2014-11-01 runEventually command failed. Error:Error Domain=Parse Code=160 "The operation couldn’t be completed. (Parse error 160.)" {code=160, error=invalid event name: cannot contain whitespace}
I'm curious as to why Parse has done this change and if there's anything we can do so that I'm not forced to create a new event.

Regions/Locales and Pulling DateTimes( From Strings) from a Database

I've been having several problems lately with clients that are using a different Windows Region setting than I am. I cannot seem to find a way to fix it. The error is as follows:
The type initializer for 'InventoryDataTable' threw an exception. ---> System.TypeInitializationException: The type initializer for 'InventoryDataTable' threw an exception. ---> System.FormatException: String was not recognized as a valid DateTime.
The error occurs when users load the application and their region settings do not match my own. The application loads up a dataset and attempts to receive a small amount of data before allowing the user to log in. When this is removed, the problem occurs immediately after the user logs in to the app.
I cannot seem to find the proper settings to force the user to use either my Region, or to allow the application to figure it out on it's own...
Exact error:
System.InvalidOperationException: An error occurred creating the form. See Exception.InnerException for details. The error is: The type initializer for 'InventoryDataTable' threw an exception. ---> System.TypeInitializationException: The type initializer for 'InventoryDataTable' threw an exception. ---> System.FormatException: String was not recognized as a valid DateTime.
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
at System.DateTime.Parse(String s)
at Invasion_3042_v2.INVDataSet.InventoryDataTable..cctor() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INVDataSet.Designer.vb:line 7588
--- End of inner exception stack trace ---
at Invasion_3042_v2.INVDataSet.InventoryDataTable..ctor()
at Invasion_3042_v2.INVDataSet.InitClass() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INVDataSet.Designer.vb:line 4296
at Invasion_3042_v2.INVDataSet..ctor() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INVDataSet.Designer.vb:line 447
at Invasion_3042_v2.INV3042LOGIN.InitializeComponent() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INV3042LOGIN.Designer.vb:line 39
at Invasion_3042_v2.INV3042LOGIN..ctor() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\INV3042LOGIN.vb:line 100
--- End of inner exception stack trace ---
at Invasion_3042_v2.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at Invasion_3042_v2.My.MyProject.MyForms.get_INV3042LOGIN()
at Invasion_3042_v2.My.MyApplication.OnCreateMainForm() in C:\Users\Tdata\Desktop\I2.original\Invasion 3042 v2\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
Posting the actual code causing the issue would have helped, but I can put forth a pretty good guess at what's going on.
Could it be that the date format being stored into your centralized database is always of a given format (maybe US?). If so, what is very likely happening is the following:
A date like 1/14/2012 is returned from a query to your database. The code running on your problem clients are parsing the date using perhaps European date regional settings. (In the EU and most other countries in the world 14-Jan-2012 is expressed as 14/01/2012 aka dd/MM/yyyy, not MM/dd/yyyy.
Try either specifying that you want to always use a known, base regional setting in your config file like this:
<globalization requestEncoding="utf-8" responseEncoding="utf-8" culture="en-US" />
...or parse your dates using a specified culture setting like this to avoid defaulting to the local system setting that does not match your server-side expectations.
DateTime.Parse("1/14/2012", new CultureInfo("en-US")); // or whatever culture your server database expects...