3

I have landed up in a problem that doesn't occur very frequently. I am trying to automate the UI testing using FlaUI and SpecFlow. I am trying to launch the app exe.The app runs for sometime and then throws the error. I am getting the error below.

System.ComponentModel.Win32Exception: 'Access is denied'

Code:

public void Start()
        {
            try
            {
                _logger.Info("Synergy TestHub starting up in memory");

                _testHub = new SynergyTestHub(locator =>
                {
                    locator.RegisterFeatureService(Substitute.For<ISynergyLogger>());
                    locator.RegisterFeatureService(Substitute.For<ISynergyClientConfigService>());
                }, Config.SynergyEnvironment);


                // Run the Synergy Test Hub In Memory
                AsyncBlockingDeadlockAvoidanceHack.SafeWait(
                    async () => await _testHub.RunUiApplicationAsync(
                        _pathBuilder.ShipTrackerExePath,
                        600,
                        false));

                _controlAction.WaitFor(new TimeSpan(0, 0, 0, 50)); // Average time for ref data to load

                var process = Process.GetProcessesByName(Config.ShipTrackerFileName)[0];
                process.WaitForInputIdle();
                Application = Application.Attach(process.Id);
                ShipTrackerWindow = GetMainWindow();
            }
            catch (Exception exception)
            {
                _logger.Error($"Error Starting up Synergy TestHub in Memory. {exception.Message}");
                _logger.Warning("Killing processes that could be hanging around .. please try to run the test again");
                _processTerminator.KillProcess(new List<string>
                {
                    Config.ShipTrackerFileName, Config.SynergyHubAppName

                });

                throw;
            }
        }

The StackTrace is

Stack Trace:

ProcessManager.OpenProcess(Int32 processId, Int32 access, Boolean throwIfExited)
Process.GetProcessHandle(Int32 access, Boolean throwIfExited)
Process.WaitForInputIdle(Int32 milliseconds)
Process.WaitForInputIdle()
ApplicationDriver.Start() line 79
Hooks.BeforeScenario() line 133
lambda_method(Closure , IContextManager )
BindingInvoker.InvokeBinding(IBinding binding, IContextManager contextManager, Object[] arguments, ITestTracer testTracer, TimeSpan& duration) line 69
TestExecutionEngine.InvokeHook(IBindingInvoker invoker, IHookBinding hookBinding, HookType hookType) line 351
TestExecutionEngine.FireEvents(HookType hookType) line 340
TestExecutionEngine.FireScenarioEvents(HookType bindingEvent) line 321
TestExecutionEngine.OnScenarioStart() line 198
TestRunner.OnScenarioStart() line 54
RefreshTheViewsFeature.ScenarioStart()
RefreshTheViewsFeature.AutomationOfRefreshInManualPublishMode() line 34

The line process.WaitForInputIdle(); throws the above mentioned error.

halfer
  • 19,824
  • 17
  • 99
  • 186
Apoorv
  • 2,023
  • 1
  • 19
  • 42

2 Answers2

1

You dont have permission to read all the process in your device, try to run as administrator mode

svladimirrc
  • 216
  • 1
  • 6
  • 1
    I was able to run other test cases. I am just reading the current app exe process and it was all working perfect a little while ago. This is a new bug that showed up – Apoorv Mar 02 '20 at 19:45
0

I was able to resolve this issue by having an active RDP session. In the github issues section, I saw that someone had the exact same issue when he was trying to click on an item. He was able to get around this problem by having an active local VNC session going.

I have also seen mentions of using .Invoke on a button instead of using the .Click/LeftMouseClick etc., but I have not been able to fully convert my program to only use InvokePatterns for controlling the UI.

CT4nk3r
  • 49
  • 5