Beispiel #1
0
        private void UpdateExpanded()
        {
            if (_expanded)
            {
                _detailButton.Text         = Strings.CLessDetails;
                _exceptionMessage.WordWrap = false;
            }
            else
            {
                _detailButton.Text         = Strings.CMoreDetails;
                _exceptionMessage.WordWrap = true;
            }

            if (_exception != null)
            {
                if (_expanded)
                {
                    _exceptionMessage.Text = ExceptionUtility.DetailedDescription(_exception);
                }
                else
                {
                    _exceptionMessage.Text = ExceptionUtility.BriefDescription(_exception);
                }
            }
            else
            {
                _exceptionMessage.Text = String.Empty;
            }
            UpdateSize();
        }
Beispiel #2
0
        public static void RenderError(HtmlTextWriter writer, Exception exception)
        {
            if (!(exception is AbortException))
            {
                // Render hidden verbose error
                writer.AddAttribute(HtmlTextWriterAttribute.Style, "display: none;");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "error");
                writer.RenderBeginTag(HtmlTextWriterTag.Font);

                writer.RenderBeginTag(HtmlTextWriterTag.Pre);
                writer.Write(HttpUtility.HtmlEncode(ExceptionUtility.DetailedDescription(exception)));
                writer.RenderEndTag();

                writer.RenderEndTag();                 // FONT
                writer.RenderEndTag();                 // DIV

                // Render visible concise error
                writer.AddAttribute(HtmlTextWriterAttribute.Border, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellpadding, "0");
                writer.AddAttribute(HtmlTextWriterAttribute.Cellspacing, "0");
                writer.RenderBeginTag(HtmlTextWriterTag.Table);

                writer.RenderBeginTag(HtmlTextWriterTag.Tr);

                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "error");
                writer.RenderBeginTag(HtmlTextWriterTag.Font);

                writer.RenderBeginTag(HtmlTextWriterTag.Pre);
                writer.Write(HttpUtility.HtmlEncode(ExceptionUtility.BriefDescription(exception)));
                writer.RenderEndTag();

                writer.RenderEndTag();                  // FONT
                writer.RenderEndTag();                  // TD

                writer.RenderBeginTag(HtmlTextWriterTag.Td);

                writer.AddAttribute(HtmlTextWriterAttribute.Type, "button");
                writer.AddAttribute(HtmlTextWriterAttribute.Class, "button");
                writer.AddAttribute(HtmlTextWriterAttribute.Value, Strings.Get("ErrorDetailsButtonText"), true);
                writer.AddAttribute(HtmlTextWriterAttribute.Onclick, "ShowErrorDetail(GetParentTable(this))");
                writer.RenderBeginTag(HtmlTextWriterTag.Input);
                writer.RenderEndTag();

                writer.RenderEndTag();                  // TD
                writer.RenderEndTag();                  // TR
                writer.RenderEndTag();                  // TABLE
            }
        }
Beispiel #3
0
 private void FErrorListView_SelectedIndexChanged(object sender, System.EventArgs e)
 {
     if (_errorListView.SelectedItems.Count > 0)
     {
         ErrorItem item = (ErrorItem)_errorListView.SelectedItems[0].Tag;
         _errorDetailBox.Text = ExceptionUtility.DetailedDescription(item.Exception);
         if (item.Source != null)
         {
             item.Source.ErrorHighlighted(item.Exception);
         }
     }
     else
     {
         _errorDetailBox.Text = String.Empty;
     }
 }
Beispiel #4
0
        private static void LoadLibrary(Program program, string libraryName, bool isKnown)
        {
            lock (program.Catalog.Libraries)
            {
                try
                {
                    Schema.Library library        = program.Catalog.Libraries[libraryName];
                    VersionNumber  currentVersion = ((ServerCatalogDeviceSession)program.CatalogDeviceSession).GetCurrentLibraryVersion(libraryName);

                    if (program.Catalog.LoadedLibraries.Contains(library.Name))
                    {
                        throw new Schema.SchemaException(Schema.SchemaException.Codes.LibraryAlreadyLoaded, libraryName);
                    }

                    bool isLoaded = false;
                    bool areAssembliesRegistered       = false;
                    Schema.LoadedLibrary loadedLibrary = null;
                    try
                    {
                        loadedLibrary       = new Schema.LoadedLibrary(libraryName);
                        loadedLibrary.Owner = program.CatalogDeviceSession.ResolveUser(((ServerCatalogDeviceSession)program.CatalogDeviceSession).GetLibraryOwner(libraryName));

                        //	Ensure that each required library is loaded
                        foreach (Schema.LibraryReference reference in library.Libraries)
                        {
                            Schema.Library requiredLibrary = program.Catalog.Libraries[reference.Name];
                            if (!VersionNumber.Compatible(reference.Version, requiredLibrary.Version))
                            {
                                throw new Schema.SchemaException(Schema.SchemaException.Codes.LibraryVersionMismatch, reference.Name, reference.Version.ToString(), requiredLibrary.Version.ToString());
                            }

                            if (!program.Catalog.LoadedLibraries.Contains(reference.Name))
                            {
                                if (!requiredLibrary.IsSuspect)
                                {
                                    LoadLibrary(program, reference.Name, isKnown);
                                }
                                else
                                {
                                    throw new Schema.SchemaException(Schema.SchemaException.Codes.RequiredLibraryNotLoaded, libraryName, reference.Name);
                                }
                            }

                            loadedLibrary.RequiredLibraries.Add(program.CatalogDeviceSession.ResolveLoadedLibrary(reference.Name));
                            program.Catalog.OperatorResolutionCache.Clear(loadedLibrary.GetNameResolutionPath(program.ServerProcess.ServerSession.Server.SystemLibrary));
                            loadedLibrary.ClearNameResolutionPath();
                        }

                        program.ServerProcess.ServerSession.Server.DoLibraryLoading(library.Name);
                        try
                        {
                            // RegisterAssemblies
                            RegisterLibraryFiles(program, library, loadedLibrary);

                            areAssembliesRegistered = true;

                            program.CatalogDeviceSession.InsertLoadedLibrary(loadedLibrary);
                            loadedLibrary.AttachLibrary();
                            try
                            {
                                ((ServerCatalogDeviceSession)program.CatalogDeviceSession).SetLibraryOwner(loadedLibrary.Name, loadedLibrary.Owner.ID);
                            }
                            catch (Exception registerException)
                            {
                                loadedLibrary.DetachLibrary();
                                throw registerException;
                            }

                            isLoaded = true;                             // If we reach this point, a subsequent exception must unload the library
                            if (library.IsSuspect)
                            {
                                library.IsSuspect = false;
                                library.SaveInfoToFile(Path.Combine(library.GetInstanceLibraryDirectory(((Server.Server)program.ServerProcess.ServerSession.Server).InstanceDirectory), Schema.LibraryUtility.GetInfoFileName(library.Name)));
                            }
                        }
                        finally
                        {
                            program.ServerProcess.ServerSession.Server.DoLibraryLoaded(library.Name);
                        }
                    }
                    catch (Exception exception)
                    {
                        program.ServerProcess.ServerSession.Server.LogError(exception);
                        library.IsSuspect     = true;
                        library.SuspectReason = ExceptionUtility.DetailedDescription(exception);
                        library.SaveInfoToFile(Path.Combine(library.GetInstanceLibraryDirectory(((Server.Server)program.ServerProcess.ServerSession.Server).InstanceDirectory), Schema.LibraryUtility.GetInfoFileName(library.Name)));

                        if (isLoaded)
                        {
                            UnregisterLibrary(program, libraryName, false);
                        }
                        else if (areAssembliesRegistered)
                        {
                            UnregisterLibraryAssemblies(program, loadedLibrary);
                        }

                        throw;
                    }

                    ((ServerCatalogDeviceSession)program.CatalogDeviceSession).SetCurrentLibraryVersion(library.Name, currentVersion);                     // Once a library has loaded, record the version number

                    program.Catalog.Libraries.DoLibraryLoaded(program, library.Name);
                }
                catch
                {
                    if (program.ServerProcess.ServerSession.Server.State == ServerState.Started)
                    {
                        throw;
                    }
                }
            }
        }
Beispiel #5
0
 public void LogError(Exception exception)
 {
     LogMessage(LogEntryType.Error, ExceptionUtility.DetailedDescription(exception));
 }
Beispiel #6
0
 public static string FullDescription(System.Exception exception)
 {
     return(ExceptionUtility.DetailedDescription(exception));
 }