Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Color.FromArgb(...); security message

I am defining a Color from argb , ex

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

In visual studio 2012 , winRT application it says that this is tagged with [security critical] . Are there any reasons why? I tried searching, no results. And no idea why this relates to security.

Update:

Now I notice, not only does FromArgb(...); methods gives this [SECURITY CRITICAL] warning. any of these:

c.A = 255;
c.R = 255;
c.G = 0;
c.B = 0;

Also does.

like image 488
wtsang02 Avatar asked Oct 20 '12 22:10

wtsang02


2 Answers

System.Drawing is a wrapper around unmanaged GDI+ code. From my understanding, WinRT does not support GDI+:

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

Native rendering code will need to be done with Direct2D.

like image 68
Michael Stum Avatar answered Sep 27 '22 22:09

Michael Stum


Your message is not a Warning, is information about method signature attribute.

SECURITY CRITICAL is a code Attribute wich real class name is SecurityCriticalAttribute. This attribute must be given to methods thats need full trust to execute code ( usually native code calls, unsafe code, graphics resources (wich usually needs unmanaged code etc.) ).

If methods are not granted full trust the Security Critical method raise an exception.

more info: http://msdn.microsoft.com/en-us/library/system.security.securitycriticalattribute.aspx

like image 30
JuanK Avatar answered Sep 27 '22 22:09

JuanK