Exemplo n.º 1
0
        // Token: 0x060074CF RID: 29903 RVA: 0x00216970 File Offset: 0x00214B70
        private void ProcessRequest(object o)
        {
            AsyncDataRequest asyncDataRequest = (AsyncDataRequest)o;

            try
            {
                asyncDataRequest.Complete(asyncDataRequest.DoWork());
            }
            catch (Exception ex)
            {
                if (CriticalExceptions.IsCriticalApplicationException(ex))
                {
                    throw;
                }
                asyncDataRequest.Fail(ex);
            }
            catch
            {
                asyncDataRequest.Fail(new InvalidOperationException(SR.Get("NonCLSException", new object[]
                {
                    "processing an async data request"
                })));
            }
            object syncRoot = this._list.SyncRoot;

            lock (syncRoot)
            {
                this._list.Remove(asyncDataRequest);
            }
        }
Exemplo n.º 2
0
        //------------------------------------------------------
        //
        //  Private methods
        //
        //------------------------------------------------------

        // Run a single request.  This method gets scheduled on a worker thread
        // from the process ThreadPool.
        void ProcessRequest(object o)
        {
            AsyncDataRequest request = (AsyncDataRequest)o;

            // PreSharp uses message numbers that the C# compiler doesn't know about.
            // Disable the C# complaints, per the PreSharp documentation.
#pragma warning disable 1634, 1691

            // PreSharp complains about catching NullReference (and other) exceptions.
            // In this case, these are precisely the ones we want to catch the most,
            // so that a failure on a worker thread doesn't affect the main thread.
#pragma warning disable 56500

            // run the request - this may take a while
            try
            {
                request.Complete(request.DoWork());
            }

            // Catch all exceptions.  There is no app code on the stack,
            // so the exception isn't actionable by the app.
            // Yet we don't want to crash the app.
            catch (Exception ex)
            {
                if (CriticalExceptions.IsCriticalApplicationException(ex))
                {
                    throw;
                }

                request.Fail(ex);
            }
            catch // non CLS compliant exception
            {
                request.Fail(new InvalidOperationException(SR.Get(SRID.NonCLSException, "processing an async data request")));
            }

#pragma warning restore 56500
#pragma warning restore 1634, 1691

            // remove the request from the list
            lock (_list.SyncRoot)
            {
                _list.Remove(request);
            }
        }