Closed Lao-Tuo closed 3 years ago
Hi @Lao-Tuo,
I'm having difficulty reproducing this issue; are you able to advise if this error also occurs on the channels from sensor ID 1001 (which should be the System Health sensor on the core probe, and therefore a sensor we both have that I can test with). I also notice it appears you've actually specified multiple channels to SetChannelProperty
; are you able to advise if this issue also occurs if you pass only a single channel to SetChannelProperty
?
Finally, are you potentially able to provide a full minimal example of how to reproduce the issue; i.e. does the following cause any issue?
var client = new PrtgClient(<redacted>);
var channel = client.GetChannel(1001, 0);
client.SetChannelProperty(channel, ChannelProperty.ShowInTable, false);
Hi,
yes, it also happens on single Channels. The minimal sample also throws an exception - this time that false is not a color value?!?
PrtgAPI.PrtgRequestException: PRTG was unable to complete the request. The server responded with the following error: The validation of the data you entered has failed. Color (#rrggbb): False is not a valid color value. Please use #rrggbb only, as in HTML/CSS notation! The object has not been changed.
at PrtgAPI.Request.RequestEngine.ValidateHttpResponse(HttpResponseMessage responseMessage, PrtgResponse response)
at PrtgAPI.Request.RequestEngine.ExecuteRequest(PrtgRequestMessage request, CancellationToken token, Func`2 responseParser)
at PrtgAPI.Request.RequestEngine.ExecuteRequest(IHtmlParameters parameters, Func`2 responseParser, CancellationToken token)
at PrtgAPI.PrtgClient.SetObjectProperty[T](BaseSetObjectPropertyParameters`1 parameters, Int32 numObjectIds, CancellationToken token)
at PrtgAPI.Request.VersionClient.SetChannelProperty(ICollection`1 channels, ChannelParameter[] params, CancellationToken token)
at PrtgAPI.PrtgClient.SetChannelPropertyInternal(IEnumerable`1 channels, Int32[] sensorIds, Nullable`1 channelId, ChannelParameter[] parameters, CancellationToken token)
at PrtgAPI.PrtgClient.SetChannelProperty(IEnumerable`1 channels, ChannelParameter[] parameters, CancellationToken token)
at PrtgAPI.PrtgClient.SetChannelProperty(IEnumerable`1 channels, ChannelProperty property, Object value, CancellationToken token)
at PrtgAPI.PrtgClient.SetChannelProperty(Channel channel, ChannelProperty property, Object value, CancellationToken token)
Something is very weird. I also did a fresh git clone and a fresh app for this and got the same result.
Hi @Lao-Tuo,
It seems to me like its interpreting ChannelProperty.ShowInTable
as ChannelProperty.LineColor
or something for some reason. ChannelProperty.LineColor
is 2 properties after ChannelProperty.ShowInTable
in ChannelProperty.cs
Are you able to advise how you installed PrtgAPI? e.g. did you install it from NuGet, download the latest manual release or did you download and compile it yourself?
git clone & compile myself (Microsoft Visual Studio Community 2019, Version 16.10.4)
Will try the manual build and come back in a minute.
Man, I need that weekend. PrtgAPI is all fine. my own build and the manual. It's been a very very stupid Layer-8 error that I just noticed. (I am too ashamed to give details)
Hi @Lao-Tuo,
So it was something in your code? Or you changed the source before you compiled it? (it's important for me that people are able to easily compile PrtgAPI should they want to)
no code change. PrtgAPI solution compiles fine. :)
my dev machine != target machine, for some reason the background copy task of release folder failed to copy the dll to the target, so new exe old dll. Manual copy solved the problem.
Describe the bug When trying to set the property of a channel, the correct Value of the property will raise an exception.
Steps to reproduce prtgClient.SetChannelProperty(channel, ChannelProperty.ShowInGraph, false); prtgClient.SetChannelProperty(channel, ChannelProperty.ShowInTable, false);
this will also fail: prtgClient.SetChannelProperty(channel, ChannelProperty.ShowInGraph, "0"); prtgClient.SetChannelProperty(channel, ChannelProperty.ShowInTable, "0");
What is the output of
Get-PrtgClient -Diagnostic
?I don't use the PowerShell module, however:
Additional context Anything else I should know to help solve the issue?