I am working on an application which uses the Bloomberg API and to be used via its portal. This is a .NET4.0 app. It fails the security validation, throwing an exception like this:
System.Windows.Markup.XamlParseException occurred
Message='Set connectionId threw an exception.' Line number '6' and line position '14'.
Source=PresentationFramework
LineNumber=6
LinePosition=14
StackTrace:
at System.Windows.Markup.XamlReader.RewrapException(Exception e, IXamlLineInfo lineInfo, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.Load(XamlReader xamlReader, IXamlObjectWriterFactory writerFactory, Boolean skipJournaledProperties, Object rootObject, XamlObjectWriterSettings settings, Uri baseUri)
at System.Windows.Markup.WpfXamlLoader.LoadBaml(XamlReader xamlReader, Boolean skipJournaledProperties, Object rootObject, XamlAccessLevel accessLevel, Uri baseUri)
at System.Windows.Markup.XamlReader.LoadBaml(Stream stream, ParserContext parserContext, Object parent, Boolean closeStream)
at System.Windows.Application.LoadComponent(Object component, Uri resourceLocator)
at Application2.MainView.InitializeComponent()
at Application2.MainView..ctor()
InnerException: System.IO.FileLoadException
Message=Could not load file or assembly 'MyCustomDll, Version=1.5.4700.39806, Culture=neutral, PublicKeyToken=b55dd9efe817e823' or one of its dependencies. Failed to grant minimum permission requests. (Exception from HRESULT: 0x80131417)
Source=Application2
FileName=MyCustomDll, Version=1.5.4700.39806, Culture=neutral, PublicKeyToken=b55dd9efe817e823
StackTrace:
at Application2.MainView.System.Windows.Markup.IComponentConnector.Connect(Int32 connectionId, Object target)
at MS.Internal.Xaml.Runtime.ClrObjectRuntime.SetConnectionId(Object root, Int32 connectionId, Object instance)
InnerException: System.Security.Policy.PolicyException
Message=Required permissions cannot be acquired.
Source=mscorlib
StackTrace:
at System.Security.SecurityManager.ResolvePolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Boolean checkExecutionPermission)
at System.Security.SecurityManager.ResolveCasPolicy(Evidence evidence, PermissionSet reqdPset, PermissionSet optPset, PermissionSet denyPset, PermissionSet& denied, Int32& securitySpecialFlags, Boolean checkExecutionPermission)
In the Bloomberg documentation are extremely woolly guidelines to meet the security criteria, saying:
Allowed CAS permission for app portal apps:
1. IsolatedStorageFilePermission, Allowed="AssemblyIsolationByUser" UserQuota="2048000"
2. SecurityPermission, Flags="Execution, ControlThread, SerializationFormatter"
3. UIPermission, Unrestricted="true"
4. MediaPermission, Audio="NoAudio" Video="NoVideo" Image="SafeImage"
5. PrintingPermission, Level="DefaultPrinting"
The DLL which fails (we have the source for) has been renamed in the exception to "MyCustomDll.dll". This Dll does not use unsafe code or Platform Invoke, just .NET4.0 and WPF.
I wonder is there any way to test why this is failing by examining security permissions of the .NET assembly?
User contributions licensed under CC BY-SA 3.0