public void Max_of_one_with_call_count_3_allows_only_one_call_at_a_time_for_3_iterations()
        {
            Queue<TaskCompletionSource<bool>> pending = new Queue<TaskCompletionSource<bool>>();
            Func<Task> doAsync = delegate
            {
                TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
                pending.Enqueue(tcs);
                Assert.Equal(1, pending.Count);
                return tcs.Task;
            };

            OperationManager manager = new OperationManager(1, doAsync);
            Task task = manager.RunAsync(3);

            Assert.False(task.IsCompleted);
            Assert.Equal(1, pending.Count);

            TaskCompletionSource<bool> current = pending.Dequeue();
            current.SetResult(false);

            Assert.False(task.IsCompleted);
            Assert.Equal(1, pending.Count);

            current = pending.Dequeue();
            current.SetResult(false);

            Assert.False(task.IsCompleted);
            Assert.Equal(1, pending.Count);

            current = pending.Dequeue();
            current.SetResult(false);

            Assert.Equal(TaskStatus.RanToCompletion, task.Status);
            Assert.Equal(0, pending.Count);
        }
 public static OperationManager getInstance()
 {
     if (_instance == null)
     {
         _instance = new OperationManager();
     }
     return _instance;
 }
示例#3
0
        private void OnChanged(object sender, FileSystemEventArgs e, HttpContext context)
        {
            if (e.ChangeType == WatcherChangeTypes.Changed && MatchFilters(e.FullPath))
            {
                // reading the delta of file changed, retry if failed.
                IEnumerable <string> lines = null;
                OperationManager.Attempt(() =>
                {
                    lines = GetChanges(e);
                }, 3, 100);

                if (lines.Count() > 0)
                {
                    _lastTraceTime = DateTime.UtcNow;
                    stopwatch      = Stopwatch.StartNew();
                    NotifyClient(lines, context);
                }
            }
        }
示例#4
0
 protected void SafeLogToFile(string path, string content, bool isAppend = true)
 {
     try
     {
         // since we don't have proper lock on file, we are more forgiving in retry (10 times 250 ms interval).
         if (isAppend)
         {
             OperationManager.Attempt(() => FileSystemHelpers.AppendAllTextToFile(path, content), retries: 10);
         }
         else
         {
             OperationManager.Attempt(() => FileSystemHelpers.WriteAllTextToFile(path, content), retries: 10);
         }
     }
     catch (Exception ex)
     {
         Analytics.UnexpectedException(ex);
     }
 }
 protected IQueryable<T> GetAll<T>() where T : Model.ModelEntity
 {
     using (var om = new OperationManager())
     {
         try
         {
             var session = om.BeginOperation();
             var items = session.Query<T>();
             om.CommitOperation();
             return items;
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             logger.ErrorException("Error retrieving objects " + typeof(T).ToString(), ex);
             return null;
         }
     }
 }
示例#6
0
 private static void LogBeginRequest(HttpContext httpContext)
 {
     OperationManager.SafeExecute(() =>
     {
         var request   = httpContext.Request;
         var requestId = request.GetRequestId() ?? Guid.NewGuid().ToString();
         httpContext.Items[Constants.RequestIdHeader]    = requestId;
         httpContext.Items[Constants.RequestDateTimeUtc] = DateTime.UtcNow;
         KuduEventGenerator.Log().ApiEvent(
             ServerConfiguration.GetApplicationName(),
             "OnBeginRequest",
             GetRawUrl(request),
             request.Method,
             requestId,
             0,
             0,
             request.GetUserAgent());
     });
 }
示例#7
0
 protected void NotifyShutdownJob()
 {
     try
     {
         if (_shutdownNotificationFilePath != null)
         {
             OperationManager.Attempt(() =>
             {
                 FileSystemHelpers.EnsureDirectory(Path.GetDirectoryName(_shutdownNotificationFilePath));
                 FileSystemHelpers.WriteAllText(_shutdownNotificationFilePath, DateTime.UtcNow.ToString());
             });
         }
     }
     catch (Exception ex)
     {
         TraceFactory.GetTracer().TraceError(ex);
         _analytics.UnexpectedException(ex);
     }
 }
示例#8
0
        public static void Persist(string siteName, string kind, string requestId, string status, string details)
        {
            var info = new DeploymentCompletedInfo
            {
                TimeStamp = $"{DateTime.UtcNow:s}Z",
                SiteName  = siteName,
                Kind      = kind,
                RequestId = requestId,
                Status    = status,
                Details   = details ?? string.Empty
            };

            try
            {
                var path       = Path.Combine(System.Environment.ExpandEnvironmentVariables(@"%HOME%"), "site", "deployments");
                var file       = Path.Combine(path, $"{Constants.LatestDeployment}.json");
                var serializer = new JavaScriptSerializer();
                var content    = serializer.Serialize(info);
                FileSystemHelpers.EnsureDirectory(path);

                // write deployment info to %home%\site\deployments\LatestDeployment.json
                OperationManager.Attempt(() => FileSystemHelpers.Instance.File.WriteAllText(file, content));

                // write to etw
                KuduEventSource.Log.DeploymentCompleted(
                    info.SiteName,
                    info.Kind,
                    info.RequestId,
                    info.Status,
                    info.Details);
            }
            catch (Exception ex)
            {
                KuduEventSource.Log.KuduException(
                    info.SiteName,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    $"{ex}");
            }
        }
示例#9
0
        private static void TraceHeartbeat()
        {
            var now = DateTime.UtcNow;

            if (_nextHeartbeatDateTime < now)
            {
                _nextHeartbeatDateTime = now.AddHours(1);

                OperationManager.SafeExecute(() =>
                {
                    KuduEventSource.Log.GenericEvent(
                        ServerConfiguration.GetApplicationName(),
                        string.Format("Heartbeat pid:{0}, domain:{1}", Process.GetCurrentProcess().Id, AppDomain.CurrentDomain.Id),
                        string.Empty,
                        Environment.GetEnvironmentVariable(SettingsKeys.ScmType),
                        Environment.GetEnvironmentVariable(SettingsKeys.WebSiteSku),
                        _kuduVersion.Value);
                });
            }
        }
示例#10
0
 public Model.DynamicBoard GetById(int Id)
 {
     using (var om = new OperationManager())
     {
         try
         {
             var session = om.BeginOperation();
             var board   = dbr.GetById(Id);
             om.CommitOperation();
             return(board);
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             string msg = String.Format("Error {0}", null);
             logger.ErrorException(msg, ex);
             throw new Exception(msg, ex);
         }
     }
 }
示例#11
0
 public void Save(Flyer flyer)
 {
     using (var om = new OperationManager())
     {
         try
         {
             om.BeginOperation();
             base.update <Flyer>(flyer);
             om.CommitOperation();
             logger.Info("Dati del flyer {0} salvati con successo", flyer.Id);
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             string msg = "Errore nel salvataggio del flyer";
             logger.ErrorException(msg, ex);
             throw new Exception(msg, ex);
         }
     }
 }
示例#12
0
        static BaseTest()
        {
            User = new UserInfo {
                Login = "******", Wif = ConfigurationManager.AppSettings["GolosWif"]
            };
            Assert.IsFalse(string.IsNullOrEmpty(User.Wif));
            var jss = GetJsonSerializerSettings();

            Api = new OperationManager(new HttpManager(jss), jss);
            // Api = new OperationManager(new HttpManager(jss), jss);

            //Api.TryConnectTo(new List<string> { "https://golosd.steepshot.org" }, CancellationToken.None);
            //Api.TryConnectTo(new List<string> { "wss://golosd.steepshot.org" }, CancellationToken.None);

            Api.TryConnectTo(new List <string> {
                "https://public-ws.golos.io"
            }, CancellationToken.None);
            //Api.TryConnectTo(new List<string> { "wss://ws.golos.io" }, CancellationToken.None);
            //Api.TryConnectTo(new List<string> { "wss://ws.testnet.golos.io" });
        }
示例#13
0
 public IList <Viaggio> GetListaViaggiByAgenzia(Agenzia agenzia)
 {
     using (var om = new OperationManager())
     {
         try
         {
             var session = om.BeginOperation();
             var result  = GetViaggiVisibili(agenzia).ToList();
             om.CommitOperation();
             return(result);
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             string msg = String.Format("Errore durante il recupero dei viaggi dell'agenzia {0}", agenzia.ToString());
             logger.ErrorException(msg, ex);
             throw new Exception(msg, ex);
         }
     }
 }
示例#14
0
        public void GenerateSeedData()
        {
            using (FeatureManager featureManager = new FeatureManager())
                using (FeaturePermissionManager featurePermissionManager = new FeaturePermissionManager())
                    using (OperationManager operationManager = new OperationManager())
                    {
                        List <Feature> features = featureManager.FeatureRepository.Get().ToList();

                        Feature Search = features.FirstOrDefault(f => f.Name.Equals("Search"));
                        if (Search == null)
                        {
                            Search = featureManager.Create("Search", "Search");
                        }

                        if (!operationManager.Exists("MMM", "ShowMultimediaData", "*"))
                        {
                            operationManager.Create("MMM", "ShowMultimediaData", "*", Search);
                        }
                    }
        }
示例#15
0
 private static void LogEndRequest(HttpContext httpContext)
 {
     OperationManager.SafeExecute(() =>
     {
         var request               = httpContext.Request;
         var response              = httpContext.Response;
         var requestId             = (string)httpContext.Items[Constants.RequestIdHeader];
         var requestTime           = (DateTime)httpContext.Items[Constants.RequestDateTimeUtc];
         var latencyInMilliseconds = (long)(DateTime.UtcNow - requestTime).TotalMilliseconds;
         KuduEventGenerator.Log().ApiEvent(
             ServerConfiguration.GetApplicationName(),
             "OnEndRequest",
             GetRawUrl(request),
             request.Method,
             requestId,
             response.StatusCode,
             latencyInMilliseconds,
             request.GetUserAgent());
     });
 }
示例#16
0
 public IList <Viaggio> GetApproved()
 {
     using (var om = new OperationManager())
     {
         try
         {
             var session = om.BeginOperation();
             var result  = GetViaggiApprovati().ToList();
             om.CommitOperation();
             return(result);
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             string msg = String.Format("Errore durante il recupero dei viaggi approvati");
             logger.ErrorException(msg, ex);
             throw new Exception(msg, ex);
         }
     }
 }
示例#17
0
 private static void LogErrorRequest(HttpContext httpContext, Exception ex)
 {
     OperationManager.SafeExecute(() =>
     {
         var request               = httpContext.Request;
         var response              = httpContext.Response;
         var requestId             = (string)httpContext.Items[Constants.RequestIdHeader];
         var requestTime           = (DateTime)httpContext.Items[Constants.RequestDateTimeUtc];
         var latencyInMilliseconds = (long)(DateTime.UtcNow - requestTime).TotalMilliseconds;
         KuduEventSource.Log.ApiEvent(
             ServerConfiguration.GetApplicationName(),
             $"OnErrorRequest {ex}",
             request.RawUrl,
             request.HttpMethod,
             requestId,
             response.StatusCode,
             latencyInMilliseconds,
             request.GetUserAgent());
     });
 }
示例#18
0
        /// <summary>
        /// This method tries to send the deployment status update through frontend to be saved to db
        /// Since frontend throttling is in place, we retry 3 times with 5 sec gaps in between
        /// </summary>
        /// <param name="updateStatusObj">Obj containing status to save to DB</param>
        /// <returns></returns>
        private async Task SendDeployStatusUpdate(DeployStatusApiResult updateStatusObj)
        {
            int attemptCount = 0;

            try
            {
                await OperationManager.AttemptAsync(async() =>
                {
                    attemptCount++;

                    _tracer.Trace($" PostAsync - Trying to send {updateStatusObj.DeploymentStatus} deployment status to {Constants.UpdateDeployStatusPath}");
                    await PostDeploymentHelper.PostAsync(Constants.UpdateDeployStatusPath, _environment.RequestId, JsonConvert.SerializeObject(updateStatusObj));
                }, 3, 5 *1000);
            }
            catch (Exception ex)
            {
                _tracer.TraceError($"Failed to request a post deployment status. Number of attempts: {attemptCount}. Exception: {ex}");
                throw;
            }
        }
示例#19
0
        private void OnChanged(object sender, FileSystemEventArgs e)
        {
            if (e.ChangeType == WatcherChangeTypes.Changed && MatchFilters(e.FullPath))
            {
                // reading the delta of file changed, retry if failed.
                int    count = 0;
                byte[] bytes = null;
                OperationManager.Attempt(() =>
                {
                    bytes = GetChanges(e, out count);
                }, 3, 100);

                if (count > 0)
                {
                    lastTraceTime = DateTime.UtcNow;

                    NotifyClient(bytes, count);
                }
            }
        }
示例#20
0
 protected void LoadBook(ScoreBook book)
 {
     ScoreBook = book;
     OperationManager.Clear();
     NoteView.Initialize(book.Score);
     NoteViewScrollBar.Value       = NoteViewScrollBar.GetMaximumValue();
     NoteViewScrollBar.Minimum     = -Math.Max(NoteView.UnitBeatTick * 4 * 20, NoteView.Notes.GetLastTick());
     NoteViewScrollBar.SmallChange = NoteView.UnitBeatTick;
     UpdateThumbHeight();
     SetText(book.Path);
     LastExportData = null;
     if (!string.IsNullOrEmpty(book.Path))
     {
         SoundSettings.Default.ScoreSound.TryGetValue(book.Path, out CurrentMusicSource);
     }
     else
     {
         CurrentMusicSource = null;
     }
 }
示例#21
0
 public IList <Model.DynamicBoard> GetAll()
 {
     using (var om = new OperationManager())
     {
         try
         {
             var session   = om.BeginOperation();
             var boardList = dbr.GetAll().ToList();
             om.CommitOperation();
             return(boardList);
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             string msg = "Error retrieving the list of available boards";
             logger.ErrorException(msg, ex);
             throw new Exception(msg, ex);
         }
     }
 }
示例#22
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (RtbGBInfo.Text != null)
     {
         DialogResult dr = MessageBox.Show("确定录入?一旦录入后将无法修改及删除,或会影响员工的晋升!", "录入警告", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         if (dr == DialogResult.Yes)
         {
             WorkerGoodBad goodBad = new WorkerGoodBad();
             goodBad.WorkNo      = lblWorkerNo.Text;
             goodBad.GBType      = CboType.SelectedIndex;
             goodBad.GBInfo      = RtbGBInfo.Text;
             goodBad.GBOperation = AdminInfo.admingroup;
             goodBad.GBTime      = DtpDate.Value;
             int n = WorkerGoodBadManager.AddGoodBad(goodBad);
             if (n > 0)
             {
                 MessageBox.Show("新增成功!");
                 #region 获取添加操作日志所需的信息
                 Operation o = new Operation();
                 o.OperationTime    = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd,HH:mm:ss"));
                 o.Operationlog     = AdminInfo.admingroup + AdminInfo.adminType + "于" + DateTime.Now + "对员工:" + lblName.Text + "进行了奖罚情况录入!";
                 o.OperationAccount = AdminInfo.admingroup + AdminInfo.adminType;
                 #endregion
                 OperationManager.InsertOperationLog(o);
                 DgvGoodBadList.DataSource = WorkerGoodBadManager.SelectAllGoodBadByWorkNo(lblWorkerNo.Text);
             }
             else
             {
                 MessageBox.Show("或是服务器错误所致!");
             }
         }
         else
         {
             MessageBox.Show("取消录入操作!");
         }
     }
     else
     {
         MessageBox.Show("信息不能为空!");
     }
 }
示例#23
0
        protected override void OnKeyDownCore(MapViewKeyEventArgs k)
        {
            _msg.VerboseDebug("OnKeyDownCore");

            if (IsShiftKey(k.Key))
            {
                if (_intermittentSelectionPhase)
                {
                    // This is called repeatedly while keeping the shift key pressed
                    return;
                }

                if (!IsInSketchMode)
                {
                    return;
                }

                _intermittentSelectionPhase = true;

                // TODO: How can we not destroy the undo stack?

                OperationManager operationManager = ActiveMapView.Map.OperationManager;

                // It is technically possible to put back the operations by calling operationManager.AddUndoOperation().
                // But whether we can make them work when actually executed requires more tests.. and this is probably not the good way to do it!
                _sketchOperations =
                    operationManager.FindUndoOperations(operation =>
                                                        operation.Category ==
                                                        "SketchOperations");

                // By backing up and re-setting the edit sketch the individual operations that made up the
                // sketch are lost.
                _editSketchBackup = GetCurrentSketchAsync().Result;

                // TODO: Only clear the sketch and switch to selection phase if REALLY required
                // (i.e. because a rectangle sketch must be drawn on MouseMove)
                ClearSketchAsync();

                StartSelectionPhase();
            }
        }
示例#24
0
 protected int update <T>(T domainModelObject) where T : Model.ModelEntity
 {
     using (var om = new OperationManager())
     {
         try
         {
             var session = om.BeginOperation();
             session.SaveOrUpdate(domainModelObject);
             om.CommitOperation();
             logger.Info("Salvataggio dell'oggetto " + domainModelObject.GetType().ToString()
                         + " con id = " + domainModelObject.Id + " avvenuto con successo");
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             logger.ErrorException("Errore nel salvataggio dell'oggetto " + domainModelObject.GetType().ToString() + " con id = " + domainModelObject.Id, ex);
             throw;
         }
         return(domainModelObject.Id);
     }
 }
示例#25
0
 protected int countEntityOccurrences <T>() where T : Model.ModelEntity
 {
     using (var om = new OperationManager())
     {
         try
         {
             var session = om.BeginOperation();
             var result  = session.Query <T>().Count();
             om.CommitOperation();
             logger.Debug("Numero entità {0} presenti = {1}", typeof(T).ToString(), result);
             return(result);
         }
         catch (Exception ex)
         {
             om.RollbackOperation();
             string msg = "Errore nel conteggio delle entità " + typeof(T).ToString();
             logger.ErrorException(msg, ex);
             throw new Exception(msg, ex);
         }
     }
 }
示例#26
0
        public static TJobStatus ReadJobStatusFromFile <TJobStatus>(ITraceFactory traceFactory, string statusFilePath) where TJobStatus : class, IJobStatus
        {
            try
            {
                if (!FileSystemHelpers.FileExists(statusFilePath))
                {
                    return(null);
                }

                return(OperationManager.Attempt(() =>
                {
                    string content = FileSystemHelpers.ReadAllTextFromFile(statusFilePath).Trim();
                    return JsonConvert.DeserializeObject <TJobStatus>(content, JsonSerializerSettings);
                }));
            }
            catch (Exception ex)
            {
                traceFactory.GetTracer().TraceError(ex);
                return(null);
            }
        }
示例#27
0
        public string GetKuduUpTime()
        {
            const string pattern = @"<div class=""col-xs-2"">\s*<strong>Site up time</strong>\s*</div>\s*<div>([^<]*)</div>";

            string content = OperationManager.Attempt <string>(() =>
            {
                using (HttpClient client = HttpClientHelper.CreateClient(this.ServiceUrl, this.DeploymentManager.Credentials))
                {
                    using (HttpResponseMessage response = client.GetAsync(String.Empty).Result.EnsureSuccessStatusCode())
                    {
                        return(response.Content.ReadAsStringAsync().Result);
                    }
                }
            }, 3, 1000);

            MatchCollection matches = Regex.Matches(content, pattern);

            Debug.Assert(matches.Count == 1, "Could not find Up Time section!");
            Debug.Assert(matches[0].Groups.Count == 2, "Could not find Up Time value!");
            return(matches[0].Groups[1].Value);
        }
示例#28
0
        public void Init()
        {
            //specify how to parse json
            var jss = new JsonSerializerSettings
            {
                //DateFormatString = "yyyy'-'MM'-'dd'T'HH':'mm':'ss.fffffffK",
                Culture = CultureInfo.InvariantCulture
            };

            //specify how to connect to blockchain
            //var cm = new WebSocketManager(jss, 10000, 1000);
            var cm = new HttpManager(jss);

            _operationManager = new OperationManager(cm, jss);

            ConnectToNode();

            CheckAccountNameStatus();

            GeneratePassword();
        }
示例#29
0
 public DarcRemoteFactory(
     IConfiguration configuration,
     IGitHubTokenProvider gitHubTokenProvider,
     IAzureDevOpsTokenProvider azureDevOpsTokenProvider,
     DarcRemoteMemoryCache memoryCache,
     BuildAssetRegistryContext context,
     TemporaryFiles tempFiles,
     ILocalGit localGit,
     OperationManager operations,
     ExponentialRetry retry)
 {
     _tempFiles                = tempFiles;
     _localGit                 = localGit;
     _operations               = operations;
     _retry                    = retry;
     _configuration            = configuration;
     _gitHubTokenProvider      = gitHubTokenProvider;
     _azureDevOpsTokenProvider = azureDevOpsTokenProvider;
     _cache                    = memoryCache;
     _context                  = context;
 }
示例#30
0
        private DiagnosticsSettings ReadSettings()
        {
            if (FileSystemHelpers.FileExists(_path))
            {
                try
                {
                    string fileContent = null;
                    OperationManager.Attempt(() => fileContent = FileSystemHelpers.ReadAllTextFromFile(_path));
                    return(JsonConvert.DeserializeObject <DiagnosticsSettings>(fileContent));
                }
                catch (Exception ex)
                {
                    _tracer.TraceError(ex);

                    // there must be corrupted value, delete file to reset everything to default
                    FileSystemHelpers.DeleteFileSafe(_path);
                }
            }

            return(new DiagnosticsSettings());
        }
示例#31
0
 /// <summary>
 /// Gets all Agenzia where isTourOperator is false.
 /// </summary>
 /// <param name="maximumRows">The maximum rows.</param>
 /// <param name="startRowIndex">Start index of the row.</param>
 /// <returns></returns>
 public IList <Agenzia> GetAllAdV(int maximumRows, int startRowIndex)
 {
     using (var manager = new OperationManager())
     {
         try
         {
             var session = manager.BeginOperation();
             var res     = session.Query <Agenzia>()
                           .Where(c => !c.IsTourOperator).ToList();
             manager.CommitOperation();
             return(res);
         }
         catch (Exception ex)
         {
             manager.RollbackOperation();
             string message = String.Format("Impossibile recuperare la lista delle AdV");
             logger.ErrorException(message, ex);
             throw new Exception(message, ex);
         }
     }
 }
示例#32
0
 public Agenzia GetByEmail(string email)
 {
     using (var manager = new OperationManager())
     {
         try
         {
             var session = manager.BeginOperation();
             var res     = session.Query <Agenzia>()
                           .Where(u => u.Email.ToLower().Equals(email)).SingleOrDefault();
             manager.CommitOperation();
             return(res);
         }
         catch (Exception ex)
         {
             manager.RollbackOperation();
             string message = String.Format("Impossibile recuperare l'agenzia con email = {0}", email);
             logger.ErrorException(message, ex);
             throw new Exception(message, ex);
         }
     }
 }
        public void First_exception_fails_operation_without_executing_remaining_calls()
        {
            Queue<TaskCompletionSource<bool>> pending = new Queue<TaskCompletionSource<bool>>();
            Func<Task> doAsync = delegate
            {
                TaskCompletionSource<bool> tcs = new TaskCompletionSource<bool>();
                pending.Enqueue(tcs);
                return tcs.Task;
            };

            OperationManager manager = new OperationManager(1, doAsync);
            Task task = manager.RunAsync(3);

            Assert.False(task.IsCompleted);
            Assert.Equal(1, pending.Count);

            TaskCompletionSource<bool> current = pending.Dequeue();
            InvalidProgramException exception = new InvalidProgramException("expected");
            current.SetException(exception);

            Assert.False(task.IsCompleted);
            Assert.Equal(1, pending.Count);

            current = pending.Dequeue();
            current.SetResult(false);

            Assert.True(task.IsCompleted);
            Assert.True(task.IsFaulted);
            Assert.NotNull(task.Exception);
            AggregateException ae = Assert.IsType<AggregateException>(task.Exception).Flatten();
            Assert.Equal(1, ae.InnerExceptions.Count);
            Assert.Same(exception, ae.InnerExceptions[0]);
        }