You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When calling /snmp/print with a ExecuteScalarOrDefault method and the /snmp location value is empty string, the API throws an exception.
System.InvalidOperationException: Sequence contains no matching element
at System.Linq.Enumerable.Single[TSource](IEnumerable`1 source, Func`2 predicate)
at tik4net.Api.ApiCommand.ExecuteScalarInternal(String target, Boolean allowReturnDefault, String defaultValue)
at tik4net.Api.ApiCommand.ExecuteScalarOrDefault()
at ...
According to the stacktrace, it looks like it is happening in one of the .Single calls in:
It probably means that the code isn't checking for empty string output correctly and or should be using SingleOrDefault instead of Single when allowReturnDefault is true.
When calling
/snmp/print
with aExecuteScalarOrDefault
method and the/snmp location
value is empty string, the API throws an exception.According to the stacktrace, it looks like it is happening in one of the
.Single
calls in:tik4net/tik4net/Api/ApiCommand.cs
Line 305 in e286e11
It probably means that the code isn't checking for empty string output correctly and or should be using
SingleOrDefault
instead ofSingle
whenallowReturnDefault
is true.RouterOS version: 7.9.2
MikroTik config:
Example code:
The text was updated successfully, but these errors were encountered: