public static void EnsureRunning(int timeoutInMilliseconds) { if (EmulatorProcessController.IsRunning()) { EmulatorProcessController.InternalWaitForStorageEmulator(timeoutInMilliseconds); throw new EmulatorException(EmulatorErrorCode.AlreadyRunning); } ProcessWrapper processWrapper = new ProcessWrapper("AzureStorageEmulator.exe", "start /InProcess"); if (timeoutInMilliseconds == 0) { processWrapper.EnsureStarted(); return; } bool flag = false; StringBuilder stringBuilder = new StringBuilder(); if (!CheckStoragePrerequisites.CheckPrerequisites((string msg) => stringBuilder.Append(msg), out flag)) { if (!flag) { string str = stringBuilder.ToString(); if (!string.IsNullOrEmpty(str)) { throw new EmulatorException(EmulatorErrorCode.StartFailed, str); } throw new EmulatorException(EmulatorErrorCode.StartFailed); } try { Initialization initialization = new Initialization(false, false, true, null, null, false, false); initialization.PerformEmulatorInitialization(); } catch (Exception exception) { throw new EmulatorException(EmulatorErrorCode.InitializationRequired, exception); } } processWrapper.EnsureStarted(); EmulatorProcessController.InternalWaitForStorageEmulator(timeoutInMilliseconds); }