Forum Discussion

gagneet's avatar
gagneet
New Contributor
14 years ago

File Dialog UserInitiated Security Issue

I have a Silverlight application, which has got button to initiate a browse for file dialog box in Windows.

On recording any test, when I click on that button, I get the following error:



System.Security.SecurityException: [FileDialog_UserInitiated]

Arguments:

Debugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version=4.0.60531.0&File=System.Windows.dll&Key=FileDialog_UserInitiated

   at System.Windows.Controls.OpenFileDialog.ShowDialog()

   at Content.Byldr.Application.ViewModel.ImageSetContentEditorViewModel.<.ctor>b__c()

   at GalaSoft.MvvmLight.Command.RelayCommand.Execute(Object parameter)

   at System.Windows.Controls.Primitives.ButtonBase.ExecuteCommand()

   at System.Windows.Controls.Primitives.ButtonBase.OnClick()

   at System.Windows.Controls.Button.OnClick()

   at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)

   at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)

   at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, Int32 actualArgsTypeIndex, String eventName)





I tried looking it up at the MSDN link, but it says: "The definition of the resource ID could not be found."



Also, when I checked with the application developers, they said: "Its a security law that any access of the users HDD must be user initiated - you'll have to figure out a way to fool them into thinking it is user initiated."



Any ideas on how to get this done and if there is a workaround for the same?



I have my XAP file processed by the tcAgUtility executable and it am using TestComplete 8.5 (Enterprise version)

1 Reply


  • Hi Gagneet,



    The exception is thrown if the time period between the actual mouse click and passing it to a Silverlight application takes more than a second, approximately. TestComplete's logic of exposing applications is executed within this period of time. In your case, it takes more than one second, thus causing the exception.



    I'll forward this information to our tech writers.



    The only way to overcome the issue from TestComplete is to reduce the period of time. You can try using the advice from the "Automated Test Performance Tips" article to do this.