x


Security Sandbox on the webplayer 3.0

The official documentation ("Security Sandbox on the webplayer 3.0") says:

Inability to use reflection to change private fields / call private methods in types that you did not write yourself.

Shouldn't this imply I'm OK to use reflection to query public fields in types? Apparently no: I get MethodAccessException when running the following code in the web player:

string ass = Assembly.GetCallingAssembly().GetName().Name;

I need the name of the calling assembly to implement my custom diagnostic output (since the normal System.Diagnostic is not available from the web player).

Any workaround for that?

Thanks in advance!

more ▼

asked Dec 22 '10 at 10:47 AM

soonts gravatar image

soonts
41 4 4 8

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Well, not exactly the assembly name, but instead the calling type name, which is OK for my purpose, and works in the web player:

var sf = new System.Diagnostics.StackFrame( 1 );
string component = sf.GetMethod().DeclaringType.Name;
more ▼

answered Dec 22 '10 at 11:13 AM

soonts gravatar image

soonts
41 4 4 8

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x810
x138
x72

asked: Dec 22 '10 at 10:47 AM

Seen: 1091 times

Last Updated: Dec 22 '10 at 10:47 AM