WPF Application-System.Security.SecurityException: Request failed.

Ranorex Spy, Recorder, and Studio.
sunilbgp
Posts: 1
Joined: Fri Aug 31, 2018 9:16 am

WPF Application-System.Security.SecurityException: Request failed.

Post by sunilbgp » Fri Aug 31, 2018 9:21 am

Hi Team,

I am evauating Ranorex for one of the application developed in WPF and trying to identify one of the Grid. But Ranorex is not identifying Grid element and in stead giving the warning mentioned below. Appreciate if you could help to identify the reason -

Regards,
Sunil Pandey

Warning Message displayed by Ranorex tool as below -

Failed to instrument WPF process. UI element identification capabilities for this window are limited.

Exception while initializing WPF proxy: System.Runtime.Serialization.SerializationException: Because of security restrictions, the type Ranorex.Plugin.Wpf.TreeBuildConfiguration cannot be accessed. ---> System.Security.SecurityException: Request failed.
at System.Runtime.Serialization.FormatterServices.nativeGetSafeUninitializedObject(RuntimeType type)
at System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type type)
--- End of inner exception stack trace ---

Server stack trace:
at System.Runtime.Serialization.FormatterServices.GetSafeUninitializedObject(Type type)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.ParseObject(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Parse(ParseRecord pr)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryObjectWithMapTyped record)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.ReadObjectWithMapTyped(BinaryHeaderEnum binaryHeaderEnum)
at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run()
at System.Runtime.Serialization.Formatters.Binary.ObjectReader.Deserialize(HeaderHandler handler, __BinaryParser serParser, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Deserialize(Stream serializationStream, HeaderHandler handler, Boolean fCheck, Boolean isCrossAppDomain, IMethodCallMessage methodCallMessage)
at System.Runtime.Remoting.Channels.CoreChannel.DeserializeBinaryRequestMessage(String objectUri, Stream inputStream, Boolean bStrictBinding, TypeFilterLevel securityLevel)
at System.Runtime.Remoting.Channels.BinaryServerFormatterSink.ProcessMessage(IServerChannelSinkStack sinkStack, IMessage requestMsg, ITransportHeaders requestHeaders, Stream requestStream, IMessage& responseMsg, ITransportHeaders& responseHeaders, Stream& responseStream)

Exception rethrown at [0]:
at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
at Ranorex.Plugin.Wpf.IWpfAutomation.SetTreeBuildConfiguration(Int32 threadId, TreeBuildConfiguration configuration)
at Ranorex.Plugin.WpfAutomationWrapper.get_TreeBuildConfiguration()
at Ranorex.Plugin.WpfAutomationWrapper.set_TreeBuildConfiguration(TreeBuildConfiguration value)
at Ranorex.Plugin.WpfFlavor.<>c.<InjectWpfAutomation>b__52_1(WpfAutomationWrapper x)
at Ranorex.Common.Extensions.EnumerableExtensions.<>c__DisplayClass24_0`1.<Poke>b__0(TValue x)
at System.Linq.Enumerable.<>c__DisplayClass7_0`3.<CombineSelectors>b__0(TSource x)
at System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Ranorex.Plugin.WpfFlavor.InjectWpfAutomation(ProcessInfo proc, IDotNetThingy dnproxy)
Process: 'RightNow.CX' (pid 12316)

qwertzu
Posts: 180
Joined: Wed Jan 25, 2017 11:08 am

Re: WPF Application-System.Security.SecurityException: Request failed.

Post by qwertzu » Mon Sep 03, 2018 1:13 pm

hi Sunil,

seems like security restrictions keep Ranorex from injecting into your application.
You could try to temporarily turn off anti virus software and your firewall and see if you are able to track your elements afterwards.
Furthermore, you could try running Ranorex and your application as Administrator in order to ensure you have enough privileges.

regards, qwertzu