[IronPython] Accessing assembly names from Silverlight
dinov at microsoft.com
Mon Apr 26 22:40:29 CEST 2010
> Hello all,
> The following code dies in Silverlight:
> import clr
> "System.Xml" in [assembly.GetName().Name for assembly in clr.References]
> SystemError: Security transparent method
> System.Reflection.Assebly.GetName() cannot access
> Microsoft.Scripting.Actions... using reflection.
> This is making it less useful to port the IronPython dotnet integration
> tutorial to Try Python. :-)
> Repeated calls throw a slightly different error in the end (still a
> system error - but a different message).
This is actually just a limitation inside of Silverlight. For some reason
Assembly.GetName() is a security critical method and cannot be called. It
also fails in a simple C# Hello world app with:
Attempt by security transparent method 'SilverlightApplication1.MainPage..ctor()' to access security critical method 'System.Reflection.Assembly.GetName()' failed.
I have no clue why this limitation exists (maybe some information disclosure
issue?) but I think you could do:
More information about the Ironpython-users