Ejemplo n.º 1
0
        public override void OnException(MethodExecutionArgs args)
        {
            if (GlobalPackageSettings.ErrorReportingEnabled)
            {
                Raygun.LogException(args.Exception);
            }

            //rethrow the exception
            args.FlowBehavior = FlowBehavior.ThrowException;
        }
        private async void buttonExport_Click(object sender, EventArgs e)
        {
            //Create Export Paramaters
            bool             excludePrivates         = radCheckBoxExcludePrivate.Checked;
            bool             ignoreDynamicProperties = _settings.IgnoreDynamicallyAddedProperties;
            ExportType       exportType       = GetExportType();
            int              maxDepth         = (int)numericUpDownMaxDepth.Value;
            ExportParamaters exportParamaters = new ExportParamaters(excludePrivates, ignoreDynamicProperties, maxDepth, exportType);

            CancellationTokenSource cancellationTokenSource = new CancellationTokenSource();

            _waitingDialog = new ProgressDialog(cancellationTokenSource);

            List <ExpressionWithSource> expressions = GetAllExpressions();

            if (expressions.Any())
            {
                //Hide and Show Progress Bar
                this.Hide();
                _waitingDialog.Show(this);

                TypeRetriever retriever       = new TypeRetriever(_dte2);
                var           exportGenerator = new ExportGenerator(expressions, retriever, exportParamaters);

                try
                {
                    Dictionary <string, string> lookupGeneratedTexts = await exportGenerator.GenerateTextWithKey(cancellationTokenSource.Token);

                    //Setup event for when the form is shown to close the waiting dialog
                    FormDisplayGeneratedText formDisplayGeneratedText = new FormDisplayGeneratedText(lookupGeneratedTexts, exportType);
                    formDisplayGeneratedText.Shown += formDisplayGeneratedText_Shown;
                    formDisplayGeneratedText.ShowDialog(this);
                }
                catch (ThreadAbortException ex)
                {
                    _waitingDialog.Close();
                }
                catch (ObjectDisposedException ex)
                {
                    _waitingDialog.Close();
                }
                catch (Exception ex)
                {
                    _waitingDialog.Close();
                    Raygun.LogException(ex);
                    MessageBox.Show("Error when attempting to export objects. If error reporting has not been disabled," +
                                    " then your error has already been logged.");
                }
                finally
                {
                    this.Show();
                }
            }
        }
        private void LoadUnmanagedLibraries()
        {
            string assemblyPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            IntPtr pDll         = NativeMethods.LoadLibrary(Path.Combine(assemblyPath, "SciLexer.dll"));

            if (pDll == IntPtr.Zero)
            {
                Exception ex = new DllNotFoundException("Could not find SciLexer.dll - This is unmanaged assembly is required by ScintillaNet.dll");

                Raygun.LogException(ex);

                throw ex;
            }
        }