Exemplo n.º 1
0
        public async Task SaveFileStreamAsync(Stream fs, IFileListEntry fileInfo)
        {
            string filePath = contentRootPath + @"\FileUploads" + $@"\{fileInfo.Name}";

            if (File.Exists(filePath))
            {
                var ex = new Exception($"File Exists Already: {fileInfo.Name}");
                _logger.LogError("File exists", ex);
                throw ex;
            }
            var    debugDir = Path.GetDirectoryName(filePath).Split(Path.DirectorySeparatorChar);
            string testing  = debugDir[debugDir.Length - 1];

            if (testing != "FileUploads")
            {
                var ex = new AccessViolationException($"Attempting to write outside of File Upload folder; Path = {filePath}, provided file name = {fileInfo.Name}; directory path read as {testing}");
                _logger.LogError("File AccessViolation", ex);
                throw ex;
            }

            using (FileStream newFile = File.Create(filePath))
            {
                _logger.LogDebug($"copying in progress, btw fs size is: {fs.Length.ToString()}");
                await fs.CopyToAsync(newFile);

                await newFile.FlushAsync();
            }
            //  newFile.SetLength(fs.Length);
            //   await fs.DisposeAsync();
            return;
        }
Exemplo n.º 2
0
        public static void BasicHandling()
        {
            var t = Task.Factory.StartNew(() =>
            {
                throw new InvalidOperationException("Can't do this!")
                {
                    Source = "t"
                };
            });

            var t2 = Task.Factory.StartNew(() =>
            {
                var e    = new AccessViolationException("Can't access this!");
                e.Source = "t2";
                throw e;
            });

            try
            {
                Task.WaitAll(t, t2);
            }
            catch (AggregateException ae)
            {
                foreach (Exception e in ae.InnerExceptions)
                {
                    Console.WriteLine($"Exception {e.GetType()} from {e.Source}.");
                }
            }
        }
Exemplo n.º 3
0
    protected void ddlExceptionType_SelectedIndexChanged(object sender, EventArgs e)
    {
        string exType = ddlExceptionType.SelectedValue;

        switch (exType)
        {
        case "InvalidOperationException":
            InvalidOperationException ioe = new InvalidOperationException("This is a test.");
            throw ioe;

        case "ArgumentException":
            ArgumentException ae = new ArgumentException("This is a test.");
            throw ae;

        case "NullReferenceException":
            NullReferenceException ne = new NullReferenceException("This is a test.");
            throw ne;

        case "AccessViolationException":
            AccessViolationException ave = new AccessViolationException("This is a test.");
            throw ave;

        case "IndexOutOfRangeException":
            IndexOutOfRangeException iore = new IndexOutOfRangeException("This is a test.");
            throw iore;

        case "StackOverflowException":
            StackOverflowException soe = new StackOverflowException("This is a test.");
            throw soe;

        default:
            throw new Exception("This is a test.");
        }
    }
Exemplo n.º 4
0
        public void FatalityTest()
        {
            var nonfatal1 = new ApplicationException("exception1");
            var nonfatal2 = new InsufficientMemoryException("Oops");
            var fatal1    = new OutOfMemoryException("Oops");
            var fatal2    = new DataException();
            var fatal3    = new AccessViolationException("Oops");
            var fatal4    = new SEHException("Oops");
            var fatal5    = new TypeInitializationException("fulltypename", fatal1);
            var fatal6    = new TargetInvocationException(fatal1);
            var fatal7    = new AggregateException("Oops", new Exception[] { fatal1, fatal2 });
            var fatal8    = new AggregateException("Oops", fatal7);

            Assert.IsFalse(((Exception)null).IsFatal(), "Null should be non fatal");
            Assert.IsFalse(nonfatal1.IsFatal(), "Non fatal 1 expected");
            Assert.IsFalse(nonfatal2.IsFatal(), "Non fatal 2 expected");
            Assert.IsTrue(fatal1.IsFatal(), "Fatal 1 expected");
            Assert.IsTrue(fatal2.IsFatal(), "Fatal 2 expected");
            Assert.IsTrue(fatal3.IsFatal(), "Fatal 3 expected");
            Assert.IsTrue(fatal4.IsFatal(), "Fatal 4 expected");
            Assert.IsTrue(fatal5.IsFatal(), "Fatal 5 expected");
            Assert.IsTrue(fatal6.IsFatal(), "Fatal 6 expected");
            Assert.IsTrue(fatal7.IsFatal(), "Fatal 7 expected");
            Assert.IsTrue(fatal8.IsFatal(), "Fatal 8 expected");
        }
        public static void Ctor_Empty()
        {
            var exception = new AccessViolationException();

            Assert.NotNull(exception);
            Assert.NotEmpty(exception.Message);
            Assert.Equal(COR_E_ACCESSVIOLATION, exception.HResult);
        }
        public static void Ctor_String()
        {
            string message   = "Created AccessViolationException";
            var    exception = new AccessViolationException(message);

            Assert.Equal(message, exception.Message);
            Assert.Equal(COR_E_ACCESSVIOLATION, exception.HResult);
        }
Exemplo n.º 7
0
        public void Ok_DerivedExcetion()
        {
            var exception = new AccessViolationException();
            Result <int, AccessViolationException> result = new Failure <int, AccessViolationException>(exception);

            var exc = Assert.Throws <AccessViolationException>(() => result.UnwrapOrThrow());

            Assert.AreEqual(exc, exception);
        }
Exemplo n.º 8
0
 private static void TraceAccessViolationException(AccessViolationException ex)
 {
     System.Diagnostics.Trace.WriteLine("*****************************************");
     System.Diagnostics.Trace.WriteLine("**  A AccessViolationException occure  **");
     System.Diagnostics.Trace.Write("**  ");
     System.Diagnostics.Trace.WriteLine(ex.Message);
     System.Diagnostics.Trace.WriteLine(ex.StackTrace);
     System.Diagnostics.Trace.WriteLine("*****************************************");
 }
        public static void Ctor_String_Exception()
        {
            string message        = "Created AccessViolationException";
            var    innerException = new Exception("Created inner exception");
            var    exception      = new AccessViolationException(message, innerException);

            Assert.Equal(message, exception.Message);
            Assert.Equal(COR_E_ACCESSVIOLATION, exception.HResult);
            Assert.Equal(innerException, exception.InnerException);
            Assert.Equal(innerException.HResult, exception.InnerException.HResult);
        }
Exemplo n.º 10
0
        public void TestExceptionGood()
        {
            BuildRequest request = CreateNewBuildRequest(1, new string[0]);
            BuildResult  result  = new BuildResult(request);

            Assert.Null(result.Exception);
            AccessViolationException e = new AccessViolationException();

            result = new BuildResult(request, e);

            Assert.Equal(e, result.Exception);
        }
Exemplo n.º 11
0
        public void TestExceptionGood()
        {
            BuildRequest request = CreateNewBuildRequest(1, new string[0]);
            BuildResult  result  = new BuildResult(request);

            Assert.Null(result.Exception);
#if FEATURE_VARIOUS_EXCEPTIONS
            AccessViolationException e = new AccessViolationException();
            result = new BuildResult(request, e);

            Assert.Equal(e, result.Exception);
#endif
        }
Exemplo n.º 12
0
        protected void CheckIntegrity()
        {
            T protectedValue = GetValue();

            if (!IsValueValid())
            {
                observers.ForEach(observer =>
                {
                    Exception ex = new AccessViolationException();
                    ex.Data.Add("InjectedValue", _value);
                    ex.Data.Add("OriginalValue", protectedValue);
                    observer.OnError(ex);
                });
            }
        }
Exemplo n.º 13
0
 public static void DisplayException()
 {
     try
     {
         InvalidOperationException exception3 =
             new InvalidOperationException("Third level exception.");
         AccessViolationException exception2 =
             new AccessViolationException("Second level exception.", exception3);
         throw new ApplicationException("Top level exception.", exception2);
     }
     catch (Exception xcp)
     {
         ConsoleDisplayHelper.ShowException(1, xcp);
     }
 }
Exemplo n.º 14
0
        public void GetLoadExceptionDetailsShouldLogUniqueExceptionsOnly()
        {
            var loaderException = new AccessViolationException("DummyLoaderExceptionMessage2");
            var exceptions      = new ReflectionTypeLoadException(null, new Exception[] { loaderException, loaderException });

            Assert.AreEqual(
                string.Concat(
                    string.Format(
                        CultureInfo.CurrentCulture,
                        Resource.EnumeratorLoadTypeErrorFormat,
                        loaderException.GetType(),
                        loaderException.Message),
                    "\r\n"),
                this.assemblyEnumerator.GetLoadExceptionDetails(exceptions));
        }
        public void PluginRuntimeHandler_Run_WhenHasError_ExpectErrors()
        {
            //------------Setup for test--------------------------

            var type = typeof(Human);
            var svc  = CreatePluginService(new List <IDev2MethodInfo> {
                new Dev2MethodInfo {
                    Method = "set_Name", Parameters = new List <IMethodParameter>()
                    {
                        new ConstructorParameter()
                        {
                            Name = "value", Value = "Micky", TypeName = typeof(string).FullName, IsRequired = true
                        }
                    }
                }
            }, type, new ServiceConstructor());
            //------------Execute Test---------------------------
            var      mock = new Mock <IAssemblyLoader>();
            Assembly loadedAssembly;

            var handler = new PluginRuntimeHandler(mock.Object);

            var pluginInvokeArgs = new PluginInvokeArgs
            {
                MethodsToRun      = svc.MethodsToRun,
                PluginConstructor = new PluginConstructor
                {
                    ConstructorName = svc.Constructor.Name,
                    Inputs          = new List <IConstructorParameter>(),
                },
                AssemblyLocation = type.Assembly.Location,
                AssemblyName     = type.Assembly.FullName,
                Fullname         = type.FullName,
            };
            var pluginExecutionDto = new PluginExecutionDto(string.Empty)
            {
                Args = pluginInvokeArgs
            };
            //var instance = handler.CreateInstance(pluginInvokeArgs);
            var exception = new AccessViolationException("err");

            mock.Setup(loader => loader.TryLoadAssembly(It.IsAny <string>(), It.IsAny <string>(), out loadedAssembly))
            .Throws(exception);

            var    dev2MethodInfo = pluginInvokeArgs.MethodsToRun.First();
            string stringOBj;
            var    run = handler.Run(dev2MethodInfo, pluginExecutionDto, out stringOBj);
        }
Exemplo n.º 16
0
        private void injectMemory(int procId, byte[] buffer, out IntPtr hndProc, out IntPtr lpAddress)
        {
            // open process and get handle
            // hndProc = NativeMethods.OpenProcess(ProcessAccessFlags.All, true, procId);
            hndProc = NativeMethods.OpenProcess(NativeMethods.ProcessAccessFlags.All, true, procId);

            if (hndProc == (IntPtr)0)
            {
                AccessViolationException ex = new AccessViolationException("Unable to attach to process with an id " + procId);
                ThrowTerminatingError(new ErrorRecord(ex, "AccessDenined", ErrorCategory.SecurityError, null));
            }

            // allocate memory for object to be injected
            lpAddress = NativeMethods.VirtualAllocEx(hndProc, (IntPtr)null, (uint)buffer.Length,
                                                     // AllocationType.Commit | AllocationType.Reserve, MemoryProtection.ExecuteReadWrite);
                                                     NativeMethods.AllocationType.Commit | NativeMethods.AllocationType.Reserve, NativeMethods.MemoryProtection.ExecuteReadWrite);

            if (lpAddress == (IntPtr)0)
            {
                AccessViolationException ex = new AccessViolationException("Unable to allocate memory to proces with an id " + procId);
                ThrowTerminatingError(new ErrorRecord(ex, "AccessDenined", ErrorCategory.SecurityError, null));
            }

            // write data to process
            const uint wrotelen = 0;

            // uint wrotelen = 0;
            NativeMethods.WriteProcessMemory(hndProc, lpAddress, buffer, (uint)buffer.Length, (UIntPtr)wrotelen);

            if (Marshal.GetLastWin32Error() == 0)
            {
                return;
            }
            AccessViolationException ex2 = new AccessViolationException("Unable to write memory to process with an id " + procId);

            ThrowTerminatingError(new ErrorRecord(ex2, "AccessDenined", ErrorCategory.SecurityError, null));

            /*
             * if (Marshal.GetLastWin32Error() != 0)
             * {
             *  AccessViolationException ex = new AccessViolationException("Unable to write memory to process with an id " + procId);
             *  ThrowTerminatingError(new ErrorRecord(ex, "AccessDenined", ErrorCategory.SecurityError, null));
             * }
             */
        }
Exemplo n.º 17
0
        public void GetLoadExceptionDetailsShouldReturnLoaderExceptionMessagesForMoreThanOneException()
        {
            var loaderException1 = new ArgumentNullException("DummyLoaderExceptionMessage1", (Exception)null);
            var loaderException2 = new AccessViolationException("DummyLoaderExceptionMessage2");
            var exceptions       = new ReflectionTypeLoadException(
                null,
                new Exception[] { loaderException1, loaderException2 });
            StringBuilder errorDetails = new StringBuilder();

            errorDetails.AppendFormat(
                CultureInfo.CurrentCulture,
                Resource.EnumeratorLoadTypeErrorFormat,
                loaderException1.GetType(),
                loaderException1.Message).AppendLine();
            errorDetails.AppendFormat(
                CultureInfo.CurrentCulture,
                Resource.EnumeratorLoadTypeErrorFormat,
                loaderException2.GetType(),
                loaderException2.Message).AppendLine();

            Assert.AreEqual(errorDetails.ToString(), this.assemblyEnumerator.GetLoadExceptionDetails(exceptions));
        }
Exemplo n.º 18
0
        public void Constructor_CallStackIsRecordedIfStackTraceNotPresent(bool?isRunningFlag)
        {
            // Arrange
            var noTraceException = new AccessViolationException("Manually Created, no trace");

            // Act
            Event actEvent = null;

            if (isRunningFlag.HasValue)
            {
                actEvent = new Event(noTraceException, isRunningFlag.Value);
            }
            else
            {
                actEvent = new Event(noTraceException);
            }

            // Assert
            Assert.NotNull(actEvent.CallTrace);
#if DEBUG
            // We can only be certain of this frame when in Debug mode. Optimisers are enabled in Release mode
            Assert.Equal("Constructor_CallStackIsRecordedIfStackTraceNotPresent", actEvent.CallTrace.GetFrame(0).GetMethod().Name);
#endif
        }
Exemplo n.º 19
0
        public void DeviceExceptionDialog(int state, SharpDXException ex, SharpDXException ex2, AccessViolationException ex3 = null)
        {
            String error      = "No Error. OH-NO!";
            String error2     = "";
            String errorCode  = "404 (No Error Code Given)";
            String errorCode2 = "404 (No Secondary Error Code Given)";

            if (ex != null)
            {
                error     = ex.ToString();
                errorCode = ex.ResultCode.ToString();
            }
            else if (ex3 != null)
            {
                error     = ex3.ToString();
                errorCode = ex3.HResult.ToString();
            }
            if (ex2 != null)
            {
                error2     = ex2.ToString();
                errorCode2 = ex2.ResultCode.ToString();
            }

            if (state == 0)
            {
                using (var deviceLostBox = new DeviceLostBox(error, error2, errorCode, errorCode2))
                {
                    deviceLostBox.ShowDialog();
                    deviceExceptionResult = deviceLostBox.DialogResult;
                }
                if (deviceExceptionResult == DialogResult.Yes)     //Yes and Exit
                {
                    Editor.Instance.backupSceneBeforeCrash();
                    Environment.Exit(1);
                }
                else if (deviceExceptionResult == DialogResult.No)     //No and try to Restart
                {
                    DisposeDeviceResources();
                    Init(Editor.Instance);
                }
                else if (deviceExceptionResult == DialogResult.Retry)     //Yes and try to Restart
                {
                    Editor.Instance.backupSceneBeforeCrash();
                    DisposeDeviceResources();
                    Init(Editor.Instance);
                }
                else if (deviceExceptionResult == DialogResult.Ignore)     //No and Exit
                {
                    Environment.Exit(1);
                }
            }
            else if (state == 1)
            {
                using (var deviceLostBox = new DeviceLostBox(error, error2, errorCode, errorCode2, 1))
                {
                    deviceLostBox.ShowDialog();
                    deviceExceptionResult = deviceLostBox.DialogResult;
                }
                if (deviceExceptionResult == DialogResult.Yes) //Yes and Exit
                {
                    Editor.Instance.backupSceneBeforeCrash();
                    Environment.Exit(1);
                }
                else if (deviceExceptionResult == DialogResult.No) //No and try to Restart
                {
                    DisposeDeviceResources();
                    Init(Editor.Instance);
                }
                else if (deviceExceptionResult == DialogResult.Retry) //Yes and try to Restart
                {
                    Editor.Instance.backupSceneBeforeCrash();
                    DisposeDeviceResources();
                    Init(Editor.Instance);
                }
                else if (deviceExceptionResult == DialogResult.Ignore) //No and Exit
                {
                    Environment.Exit(1);
                }
            }
        }
Exemplo n.º 20
0
 /// <summary>
 /// Errors the message for access violations
 /// </summary>
 /// <param name="functionName">Name of the function.</param>
 /// <param name="e">The e.</param>
 /// <returns>System.String.</returns>
 private static string ErrorMessage(string functionName, AccessViolationException e) => $"{ClassLocation}.{functionName} - {e.Message}";
Exemplo n.º 21
0
            public void ShouldPassWhenComparingWithJustForReferenceType()
            {
                var accessViolationException = new AccessViolationException();

                accessViolationException.Just().Should().BeJust(accessViolationException);
            }
Exemplo n.º 22
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";

            var uploads = new List <UploadFileInfo>();

            var basePath = HttpContext.Current.Request.Form["path"];

            if (!basePath.StartsWith(SiteSettings.Instance.FilePath))
            {
                var exception = new AccessViolationException(string.Format("Wrong path for uploads! {0}", basePath));
                Logger.Write(exception, Logger.Severity.Major);
                throw exception;
            }

            basePath = HttpContext.Current.Server.MapPath(basePath);

            foreach (string file in context.Request.Files)
            {
                var    postedFile = context.Request.Files[file];
                string fileName;

                if (postedFile.ContentLength == 0)
                {
                    continue;
                }

                if (postedFile.FileName.Contains("\\"))
                {
                    string[] parts = postedFile.FileName.Split(new[] { '\\' });
                    fileName = parts[parts.Length - 1];
                }
                else
                {
                    fileName = postedFile.FileName;
                }

                if (IsFileExtensionBlocked(fileName))
                {
                    Logger.Write(string.Format("Upload of {0} blocked since file type is not allowed.", fileName), Logger.Severity.Major);
                    uploads.Add(new UploadFileInfo {
                        name  = Path.GetFileName(fileName),
                        size  = postedFile.ContentLength,
                        type  = postedFile.ContentType,
                        error = "Filetype not allowed!"
                    });
                    continue;
                }

                var savedFileName = GetUniqueFileName(basePath, fileName);
                postedFile.SaveAs(savedFileName);

                uploads.Add(new UploadFileInfo {
                    name = Path.GetFileName(savedFileName),
                    size = postedFile.ContentLength,
                    type = postedFile.ContentType
                });
            }

            var uploadResult         = new UploadResult(uploads);
            var serializedUploadInfo = Serialization.JsonSerialization.SerializeJson(uploadResult);

            context.Response.Write(serializedUploadInfo);
        }
Exemplo n.º 23
0
        public override void RunCommand(object sender)
        {
            var engine           = (AutomationEngineInstance)sender;
            var exceptionMessage = v_ExceptionMessage.ConvertUserVariableToString(engine);

            Exception ex;

            switch (v_ExceptionType)
            {
            case "AccessViolationException":
                ex = new AccessViolationException(exceptionMessage);
                break;

            case "ArgumentException":
                ex = new ArgumentException(exceptionMessage);
                break;

            case "ArgumentNullException":
                ex = new ArgumentNullException(exceptionMessage);
                break;

            case "ArgumentOutOfRangeException":
                ex = new ArgumentOutOfRangeException(exceptionMessage);
                break;

            case "DivideByZeroException":
                ex = new DivideByZeroException(exceptionMessage);
                break;

            case "Exception":
                ex = new Exception(exceptionMessage);
                break;

            case "FileNotFoundException":
                ex = new FileNotFoundException(exceptionMessage);
                break;

            case "FormatException":
                ex = new FormatException(exceptionMessage);
                break;

            case "IndexOutOfRangeException":
                ex = new IndexOutOfRangeException(exceptionMessage);
                break;

            case "InvalidDataException":
                ex = new InvalidDataException(exceptionMessage);
                break;

            case "InvalidOperationException":
                ex = new InvalidOperationException(exceptionMessage);
                break;

            case "KeyNotFoundException":
                ex = new KeyNotFoundException(exceptionMessage);
                break;

            case "NotSupportedException":
                ex = new NotSupportedException(exceptionMessage);
                break;

            case "NullReferenceException":
                ex = new NullReferenceException(exceptionMessage);
                break;

            case "OverflowException":
                ex = new OverflowException(exceptionMessage);
                break;

            case "TimeoutException":
                ex = new TimeoutException(exceptionMessage);
                break;

            default:
                throw new NotImplementedException("Selected exception type " + v_ExceptionType + " is not implemented.");
            }
            throw ex;
        }
Exemplo n.º 24
0
        public override void Send()
        {
            string          str;
            string          str1;
            string          str2;
            string          message;
            string          str3;
            string          str4;
            string          str5;
            FormatException formatException;
            object          obj    = new object();
            object          obj1   = new object();
            object          obj2   = new object();
            object          obj3   = new object();
            object          obj4   = new object();
            object          obj5   = new object();
            object          obj6   = new object();
            short           num    = 0;
            short           num1   = 0;
            string          empty  = string.Empty;
            string          empty1 = string.Empty;
            string          empty2 = string.Empty;
            int             num2   = 0;
            int             num3   = 0;

            this.m_lSendErrorCount = (long)0;
            try
            {
                base.GetLink().TablePOST_Send(this.m_hndPOST, ref obj, ref obj1);
                goto Label0;
            }
            catch (NullReferenceException nullReferenceException1)
            {
                NullReferenceException nullReferenceException = nullReferenceException1;
                str     = (nullReferenceException.Data == null ? "" : nullReferenceException.Data.ToString());
                str1    = (nullReferenceException.HelpLink == null ? "" : nullReferenceException.HelpLink.ToString());
                str2    = (nullReferenceException.InnerException == null ? "" : nullReferenceException.InnerException.ToString());
                message = nullReferenceException.Message;
                str3    = (nullReferenceException.Source == null ? "" : nullReferenceException.Source.ToString());
                str4    = (nullReferenceException.StackTrace == null ? "" : nullReferenceException.StackTrace.ToString());
                str5    = (nullReferenceException.TargetSite == null ? "" : nullReferenceException.TargetSite.ToString());
                base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients, Null Ref Execption: ", message));
                base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST);
                base.GetLink().TablePOST_Reset(this.m_hndPOST);
            }
            catch (AccessViolationException accessViolationException1)
            {
                AccessViolationException accessViolationException = accessViolationException1;
                str     = (accessViolationException.Data == null ? "" : accessViolationException.Data.ToString());
                str1    = (accessViolationException.HelpLink == null ? "" : accessViolationException.HelpLink.ToString());
                str2    = (accessViolationException.InnerException == null ? "" : accessViolationException.InnerException.ToString());
                message = accessViolationException.Message;
                str3    = (accessViolationException.Source == null ? "" : accessViolationException.Source.ToString());
                str4    = (accessViolationException.StackTrace == null ? "" : accessViolationException.StackTrace.ToString());
                str5    = (accessViolationException.TargetSite == null ? "" : accessViolationException.TargetSite.ToString());
                base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients, Access Violation Execption: ", message));
                base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST);
                base.GetLink().TablePOST_Reset(this.m_hndPOST);
            }
            catch (FormatException formatException1)
            {
                formatException = formatException1;
                str             = (formatException.Data == null ? "" : formatException.Data.ToString());
                str1            = (formatException.HelpLink == null ? "" : formatException.HelpLink.ToString());
                str2            = (formatException.InnerException == null ? "" : formatException.InnerException.ToString());
                message         = formatException.Message;
                str3            = (formatException.Source == null ? "" : formatException.Source.ToString());
                str4            = (formatException.StackTrace == null ? "" : formatException.StackTrace.ToString());
                str5            = (formatException.TargetSite == null ? "" : formatException.TargetSite.ToString());
                base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients, Format Execption: ", message));
                base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST);
                base.GetLink().TablePOST_Reset(this.m_hndPOST);
            }
            catch (Exception exception1)
            {
                Exception exception = exception1;
                str     = (exception.Data == null ? "" : exception.Data.ToString());
                str1    = (exception.HelpLink == null ? "" : exception.HelpLink.ToString());
                str2    = (exception.InnerException == null ? "" : exception.InnerException.ToString());
                message = exception.Message;
                str3    = (exception.Source == null ? "" : exception.Source.ToString());
                str4    = (exception.StackTrace == null ? "" : exception.StackTrace.ToString());
                str5    = (exception.TargetSite == null ? "" : exception.TargetSite.ToString());
                base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients, Catch All Execption: ", message));
                base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST);
                base.GetLink().TablePOST_Reset(this.m_hndPOST);
                this.m_lCounter = 0;
            }
            return;

Label0:
            try
            {
                num  = Convert.ToInt16(obj);
                num1 = Convert.ToInt16(obj1);
                PLXMLData.m_lErrorCount = PLXMLData.m_lErrorCount + (long)num1;
                if ((num1 > 0 ? true : this.m_lCounter != num))
                {
                    base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST);
                    PLClient mLSendErrorCount = this;
                    mLSendErrorCount.m_lSendErrorCount = mLSendErrorCount.m_lSendErrorCount + (long)1;
                }
                while (base.GetLink().TablePOST_GetNextResult(this.m_hndPOST, ref obj2, ref obj3, ref obj4, ref obj5) == 0)
                {
                    if (Convert.ToInt32(obj3) <= 0)
                    {
                        num3 = Convert.ToInt32(obj2);
                        base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_NickName.sLinkName, empty, ref obj6);
                        empty1 = obj6.ToString();
                        PLClient.AddMapIDtoNN(num3, empty1);
                        PLClient.AddMapNNtoID(empty1, num3);
                        base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_ExternalID_1.sLinkName, empty, ref obj6);
                        if (!obj6.ToString().Equals(""))
                        {
                            PLClient.AddMapExtID1toPLID(obj6.ToString(), num3);
                        }
                        base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, this.m_ExternalID_2.sLinkName, empty, ref obj6);
                        if (!obj6.ToString().Equals(""))
                        {
                            PLClient.AddMapExtID2toPLID(obj6.ToString(), num3);
                        }
                        base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, "NameKey", empty, ref obj6);
                        if (!obj6.ToString().Equals(""))
                        {
                            PLClient.AddMapNameKeytoPLID(obj6.ToString(), num3);
                        }
                        base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, "ClientPersonContactID", empty, ref obj6);
                        if (StringManip.IsNumeric(obj6.ToString()))
                        {
                            num2 = StringManip.NullToInt(obj6);
                            if (num2 != 0)
                            {
                                PLClient.AddMapNNtoContactID(empty1, num2);
                                PLClient.AddMapClientIDtoContactID(num3, num2);
                                PLClient.AddMapContactIDtoClientID(num2, num3);
                            }
                        }
                        base.GetLink().TablePOST_ResultDataField_String(this.m_hndPOST, "ClientQuickBooksID", empty, ref obj6);
                        empty2 = obj6.ToString().ToUpper().Trim();
                        if (!empty2.Equals(""))
                        {
                            PLClient.AddMapPLIDtoQBID(num3, empty2);
                        }
                    }
                }
                base.GetLink().TablePOST_Reset(this.m_hndPOST);
                this.m_lCounter = 0;
                base.GetLink().SubField_CloseHandle(this.m_hndSubFld);
                this.m_hndSubFld = 0;
            }
            catch (FormatException formatException2)
            {
                formatException = formatException2;
                str             = (formatException.Data == null ? "" : formatException.Data.ToString());
                str1            = (formatException.HelpLink == null ? "" : formatException.HelpLink.ToString());
                str2            = (formatException.InnerException == null ? "" : formatException.InnerException.ToString());
                message         = formatException.Message;
                str3            = (formatException.Source == null ? "" : formatException.Source.ToString());
                str4            = (formatException.StackTrace == null ? "" : formatException.StackTrace.ToString());
                str5            = (formatException.TargetSite == null ? "" : formatException.TargetSite.ToString());
                base.GetLink().LinkLog_AddLinkLogMessage(string.Concat("Clients Reading posted items, Catch All Execption: ", message));
                base.GetLink().TablePOST_DumpExceptionsToLinkLog(this.m_hndPOST);
                this.m_lCounter = 0;
                return;
            }
        }