To showcase the security attributes, we've modified the sample source code to evaluate the method triggering the error in order to show it's security attributes:
Type type = new Microsoft.Ink.Recognizers().GetType();
//get the MethodInfo object of the current method
MethodInfo m = type.GetMethods().FirstOrDefault
(method => method.Name == "GetDefaultRecognizer"
&& method.GetParameters().Count() == 0); ;
//show if the current method is Critical, Transparent or SafeCritical
Console.WriteLine("Method GetDefaultRecognizer IsSecurityCritical: {0} \n", m.IsSecurityCritical);
Console.WriteLine("Method GetDefaultRecognizer IsSecuritySafeCritical: {0} \n", m.IsSecuritySafeCritical);
Console.WriteLine("Method GetDefaultRecognizer IsSecurityTransparent: {0} \n", m.IsSecurityTransparent);
That code generates this output:
Method GetDefaultRecognizer IsSecurityCritical: False
Method GetDefaultRecognizer IsSecuritySafeCritical: False
Method GetDefaultRecognizer IsSecurityTransparent: True
Because the method in the Microsoft.Ink library is processed as SecurityTransparent, and errors are arising, it needs to be tagged as either SecurityCritical or SecuritySafeCritical.
Is there anything we can do at our code level?