private void ShowMefComposeError() { IConfigurationService service1 = this.Services.GetService <IConfigurationService>(); IMessageDisplayService service2 = this.Services.GetService <IMessageDisplayService>(); IMessageLoggingService service3 = this.Services.GetService <IMessageLoggingService>(); IExpressionMefHostingService service4 = this.Services.GetService <IExpressionMefHostingService>(); if (this.mefExceptionToShow == null && Enumerable.Count <Exception>(service4.CompositionExceptions) <= 0) { return; } bool doNotAskAgain = service1 != null && (bool)service1["MEFHosting"].GetProperty("DoNotWarnAboutMefCompositionException", (object)false); if (!doNotAskAgain && service3 != null && (service4 != null && Enumerable.Count <Exception>(service4.CompositionExceptions) > 0)) { foreach (Exception exception in service4.CompositionExceptions) { service3.WriteLine(exception.Message); } } service4.ClearCompositionExceptions(); if (!doNotAskAgain && service3 != null && (this.mefExceptionToShow != null && !string.IsNullOrEmpty(this.mefExceptionToShow.Message))) { service3.WriteLine(this.mefExceptionToShow.Message); } this.mefExceptionToShow = (Exception)null; if (doNotAskAgain || service2 == null) { return; } string str = Path.Combine(Path.GetDirectoryName(this.GetType().Module.FullyQualifiedName), "extensions"); MessageBoxArgs args = new MessageBoxArgs() { Message = string.Format((IFormatProvider)CultureInfo.CurrentCulture, StringTable.MefCompositionException, new object[1] { (object)str }), Button = MessageBoxButton.OK, Image = MessageBoxImage.Exclamation }; int num = (int)service2.ShowMessage(args, out doNotAskAgain); if (!doNotAskAgain || service1 == null) { return; } service1["MEFHosting"].SetProperty("DoNotWarnAboutMefCompositionException", (object)true); }
public static Type GetCategoryEditorType(EditorAttribute attribute, IMessageLoggingService exceptionLogger) { try { Type type = Type.GetType(attribute.EditorTypeName); if (type != (Type)null) { if (typeof(CategoryEditor).IsAssignableFrom(type)) { return(type); } } } catch (Exception ex) { if (exceptionLogger != null) { exceptionLogger.WriteLine(string.Format((IFormatProvider)CultureInfo.CurrentCulture, ExceptionStringTable.CategoryEditorTypeLoadFailed, new object[1] { (object)ExtensibilityMetadataHelper.GetExceptionMessage(ex) })); } } return((Type)null); }
private void ProcessAsyncBuildRequest() { if (BuildManager.asyncBuildRequestQueue.CountIsLessThan <BuildManager.BuildRequest>(1) || BuildManager.building) { return; } BuildManager.BuildRequest buildRequest = BuildManager.asyncBuildRequestQueue.Peek(); this.StartBuildCore(buildRequest); HostLogger hostLogger = null; if (buildRequest.DisplayOutput) { this.serviceProvider.MessageLoggingService().Clear(); IMessageLoggingService messageLoggingService = this.serviceProvider.MessageLoggingService(); CultureInfo currentCulture = CultureInfo.CurrentCulture; string projectBuildStartedMessage = StringTable.ProjectBuildStartedMessage; object[] displayName = new object[] { buildRequest.BuildContext.DisplayName, string.Join("; ", buildRequest.Targets) }; messageLoggingService.WriteLine(string.Format(currentCulture, projectBuildStartedMessage, displayName)); hostLogger = new HostLogger(buildRequest.BuildContext, this.serviceProvider) { Verbosity = (Keyboard.IsKeyDown(Key.RightCtrl) ? LoggerVerbosity.Diagnostic : LoggerVerbosity.Minimal) }; } BuildManager.ProjectBuilder projectBuilder = new BuildManager.ProjectBuilder(this, buildRequest, hostLogger, buildRequest.DisplayOutput, false); Thread thread = new Thread(new ThreadStart(projectBuilder.Build)); thread.SetApartmentState(ApartmentState.STA); thread.Start(); BuildManager.currentBuildThread = thread; projectBuilder.PollBuildThread(thread); }
internal void LogTemplateLoadError(string vsTemplatePath, string message) { IMessageLoggingService messageLoggingService = this.Services.MessageLoggingService(); CultureInfo currentCulture = CultureInfo.CurrentCulture; string errorLoadingTemplate = StringTable.ErrorLoadingTemplate; object[] objArray = new object[] { vsTemplatePath, message }; messageLoggingService.WriteLine(string.Format(currentCulture, errorLoadingTemplate, objArray)); }
public bool LogMessage(string message) { if (this.sceneViewModel != null) { IMessageLoggingService messageLoggingService = this.sceneViewModel.DesignerContext.MessageLoggingService; if (messageLoggingService != null) { messageLoggingService.WriteLine(message); return(true); } } return(false); }
public static IDictionary <Type, IList <NewItemFactory> > GetNewItemFactoriesFromAttributes(IList <NewItemTypesAttribute> attributes, IMessageLoggingService exceptionLogger) { Dictionary <Type, IList <NewItemFactory> > dictionary = new Dictionary <Type, IList <NewItemFactory> >(); using (IEnumerator <NewItemTypesAttribute> enumerator = ((IEnumerable <NewItemTypesAttribute>)attributes).GetEnumerator()) { while (((IEnumerator)enumerator).MoveNext()) { NewItemTypesAttribute current = enumerator.Current; try { NewItemFactory newItemFactory = (NewItemFactory)Activator.CreateInstance(current.get_FactoryType()); if (newItemFactory != null) { foreach (Type key in current.get_Types()) { IList <NewItemFactory> list; if (!dictionary.TryGetValue(key, out list)) { list = (IList <NewItemFactory>) new List <NewItemFactory>(); dictionary.Add(key, list); } ((ICollection <NewItemFactory>)list).Add(newItemFactory); } } } catch (Exception ex) { if (exceptionLogger != null) { exceptionLogger.WriteLine(string.Format((IFormatProvider)CultureInfo.CurrentCulture, ExceptionStringTable.CollectionItemFactoryInstantiateFailed, new object[1] { (object)ExtensibilityMetadataHelper.GetExceptionMessage(ex) })); } } } } return((IDictionary <Type, IList <NewItemFactory> >)dictionary); }
public static PropertyValueEditor GetValueEditor(IEnumerable attributes, IMessageLoggingService exceptionLogger) { PropertyValueEditor propertyValueEditor = (PropertyValueEditor)null; if (attributes != null) { foreach (Attribute attribute in attributes) { EditorAttribute editorAttribute = attribute as EditorAttribute; if (editorAttribute != null) { try { Type type = Type.GetType(editorAttribute.EditorTypeName); if (type != (Type)null) { if (typeof(PropertyValueEditor).IsAssignableFrom(type)) { propertyValueEditor = (PropertyValueEditor)Activator.CreateInstance(type); break; } } } catch (Exception ex) { if (exceptionLogger != null) { exceptionLogger.WriteLine(string.Format((IFormatProvider)CultureInfo.CurrentCulture, ExceptionStringTable.ValueEditorLoadFailed, new object[1] { (object)ExtensibilityMetadataHelper.GetExceptionMessage(ex) })); } } } } } return(propertyValueEditor); }
public void LogMessage(string message) { IMessageLoggingService loggingService = this.LoggingService; if (loggingService == null) { return; } UIThreadDispatcher.Instance.BeginInvoke(DispatcherPriority.Normal, (Action)(() => loggingService.WriteLine(message.TrimStart('\r', '\n')))); }