Color.FromArgb (...); safety message

I define color from argb, ex

Color.FromArgb(255,255,0,0); 

In visual studio 2012, the winRT application states that it is marked [critical]. Is there any reason? I tried the search, no results. And I don’t know why this relates to security.

Update:

Now I notice that not only FromArgb (...); methods give this [CRITICAL SECURITY] warning. any of them:

 cA = 255; cR = 255; cG = 0; cB = 0; 

Also does.

+6
source share
3 answers

System.Drawing - a wrapper around unmanaged GDI + code. In my opinion, WinRT does not support GDI +:

http://social.msdn.microsoft.com/Forums/en-NZ/winappswithnativecode/thread/0ba00fbd-183f-4df6-afa2-04d0ac14706a

In Direct2D, you must run your own rendering code.

+4
source

Your message is not a warning , this is information about the method signature attribute.

SECURITY CRITICAL is the Attribute with the name of the real class - SecurityCriticalAttribute. This attribute should be provided to methods that require complete trust in code execution (usually ordinary code calls, insecure code, graphic resources (usually requiring unmanaged code, etc.)).

If the methods are not fully trusted, the Security Critical method throws an exception.

Additional information: http://msdn.microsoft.com/en-us/library/system.security.securitycriticalattribute.aspx

+2
source

Instead, you should use Color from System.Windows.Media .

+2
source

Source: https://habr.com/ru/post/928205/


All Articles