Ejemplo n.º 1
0
            /// <summary>
            /// Test starting call
            /// </summary>
            public void DoTest()
            {
                try
                {
                    DoGetInsert();
                }
                catch (Exception e)
                {
                    if (e.Message != null && e.Message.Contains("The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing methods, and they can only be called from within the same thread. Validate that the cmdlet makes these calls correctly, or contact Microsoft Customer Support Services."))
                    {
                        _adapter.TerminateThreads = true;
                    }

                    else
                    {
                        _adapter.WriteObject("DoTest() Exception: " + e.ToString() + "\n");
                        _adapter.TerminateThreads = true;

                        //Nismah: Was causing powershell to crash. Will remove this after QA verification is done.
                        //if (_outputProvider != null)
                        //{
                        //    _outputProvider.WriteErrorLine("Press any key to exit.");
                        //}
                        //Console.ReadKey(true);
                        //System.Environment.Exit(0);
                    }
                }
            }
Ejemplo n.º 2
0
            /// <summary>
            /// Test starting call
            /// </summary>
            public void DoTest()
            {
                try
                {
                    DoGetInsert();
                }
                catch (Exception e)
                {
                    if (e.Message != null && e.Message.Contains("The WriteObject and WriteError methods cannot be called from outside the overrides of the BeginProcessing, ProcessRecord, and EndProcessing methods, and they can only be called from within the same thread. Validate that the cmdlet makes these calls correctly, or contact Microsoft Customer Support Services."))
                    {
                        _adapter.TerminateThreads = true;
                    }

                    else
                    {
                        _adapter.WriteObject("DoTest() Exception: " + e.ToString() + "\n");
                        _adapter.TerminateThreads = true;
                    }
                }
            }