I am using Config API client for getting camera details from milestone. Now I updated SDK to 22.3. I got the following warning,
Severity Code Description Project File Line Suppression State
Warning CS0618 ‘LoginSettings.NetworkCredential’ is obsolete: ‘From 2022 R1, this property may be null when the user is using OAuth 2.0 tokens. Try always to use the LoginSettings class and check the IsOAuthIdentity == false, before using the NetworkCredential’ ConfigAPIClient
I checked ConfigAPI Client sample code, there warning is disabled using following code
#pragma warning disable CS0618 // Type or member is obsolete
if (loginSettings != null)
{
if (basic)
{
channel.Credentials.UserName.UserName = "[BASIC]\\" + loginSettings.NetworkCredential.UserName;
channel.Credentials.UserName.Password = loginSettings.NetworkCredential.Password;
channel.Credentials.ServiceCertificate.SslCertificateAuthentication = new X509ServiceCertificateAuthentication()
{
CertificateValidationMode = X509CertificateValidationMode.None,
};
}
else
{
channel.Credentials.Windows.ClientCredential.UserName = loginSettings.NetworkCredential.UserName;
channel.Credentials.Windows.ClientCredential.Password = loginSettings.NetworkCredential.Password;
}
}
#pragma warning restore CS0618 // Type or member is obsolete
Why this is disabled? What is the fix for this warning?