Exemplo n.º 1
0
			public void OnDiagnostic(IDiagnostic d)
			{
				if (d is LoadedFromClassIndex)
				{
					Assert.Fail("Query should not be loaded from class index");
				}
			}
 public virtual void OnDiagnostic(IDiagnostic d)
 {
     if (d is DeletionFailed)
     {
         Assert.Fail("No deletion failed diagnostic message expected.");
     }
 }
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is DeletionFailed)
     {
         _diagnosticListenerCalled = true;
     }
 }
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is DeletionFailed)
     {
         throw new Db4oException();
     }
 }
Exemplo n.º 5
0
 public void OnDiagnostic(IDiagnostic d)
 {
     if ((d is NativeQueryNotOptimized) || (d is NativeQueryOptimizerNotLoaded))
     {
         _optimized = false;
     }
 }
Exemplo n.º 6
0
        public static void TraceDiagnostic([NotNull] this ITraceService trace, [NotNull] IDiagnostic diagnostic, Severity severity, bool treatWarningsAsErrors)
        {
            switch (severity)
            {
            case Severity.Error:
                trace.TraceError(diagnostic.Msg, diagnostic.Text, diagnostic.FileName, diagnostic.Span);
                break;

            case Severity.Warning:
                if (treatWarningsAsErrors)
                {
                    trace.TraceError(diagnostic.Msg, diagnostic.Text, diagnostic.FileName, diagnostic.Span);
                }
                else
                {
                    trace.TraceWarning(diagnostic.Msg, diagnostic.Text, diagnostic.FileName, diagnostic.Span);
                }

                break;

            case Severity.Information:
                trace.TraceInformation(diagnostic.Msg, diagnostic.Text, diagnostic.FileName, diagnostic.Span);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
Exemplo n.º 7
0
 public void OnDiagnostic(IDiagnostic d)
 {
     if (!(d is NotTransparentActivationEnabled))
     {
         Assert.Fail("no diagnostic message expected but was " + d);
     }
 }
Exemplo n.º 8
0
			public void OnDiagnostic(IDiagnostic d)
			{
				if (d is DeletionFailed)
				{
					throw new Db4oException();
				}
			}
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is DeletionFailed)
     {
         _diagnosticListenerCalled = true;
     }
 }
			public virtual void OnDiagnostic(IDiagnostic d)
			{
				if (d is DeletionFailed)
				{
					_called = true;
				}
			}
Exemplo n.º 11
0
		public void OnDiagnostic(IDiagnostic d)
		{
			if ((d is NativeQueryNotOptimized) || (d is NativeQueryOptimizerNotLoaded))
			{
				_optimized = false;
			}
		}
Exemplo n.º 12
0
 public virtual void OnDiagnostic(IDiagnostic d)
 {
     if (d is DeletionFailed)
     {
         Assert.Fail("No deletion failed diagnostic message expected.");
     }
 }
Exemplo n.º 13
0
 public ConvertEntities(ModelRepository parent, IDiagnostic diagnostic, FileModel fullPath)
 {
     this._referenceSchema = fullPath.Schema;
     this._parent          = parent;
     this._file            = fullPath;
     this._diagnostic      = diagnostic;
 }
Exemplo n.º 14
0
			public void OnDiagnostic(IDiagnostic d)
			{
				if (d is LoadedFromClassIndex)
				{
					this._enclosing.loadedFromClassIndex = true;
				}
			}
Exemplo n.º 15
0
 public void OnDiagnostic(IDiagnostic d)
 {
     if (typeof(T) == d.GetType())
     {
         _diagnostics.Add(d);
     }
 }
 public virtual void OnDiagnostic(IDiagnostic d)
 {
     if (d is DeletionFailed)
     {
         _called = true;
     }
 }
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is MissingClass)
     {
         classesNotFound.Add(((MissingClass)d).Reason());
     }
 }
Exemplo n.º 18
0
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is LoadedFromClassIndex)
     {
         this._enclosing._diagnosticsCalled = true;
     }
 }
Exemplo n.º 19
0
 public void OnDiagnostic(IDiagnostic d)
 {
     if ((d is NativeQueryNotOptimized) || (d is NativeQueryOptimizerNotLoaded))
     {
         MessageBox.Show(d.GetType() + "\r\n" + d, "Info");
     }
 }
Exemplo n.º 20
0
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is LoadedFromClassIndex)
     {
         Assert.Fail("Query should not be loaded from class index");
     }
 }
Exemplo n.º 21
0
			public void OnDiagnostic(IDiagnostic d)
			{
				if (!(d is NotTransparentActivationEnabled))
				{
					Assert.Fail("no diagnostic message expected but was " + d);
				}
			}
Exemplo n.º 22
0
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d.GetType() == typeof(NativeQueryNotOptimized))
     {
         //							_reason = ((NativeQueryNotOptimized) d).reason();
         this._enclosing._failed = true;
     }
 }
Exemplo n.º 23
0
 public void OnDiagnostic(IDiagnostic diagnostic)
 {
     Type type = diagnostic.GetType();
     if (filterFor.Contains(type))
     {
         target.OnDiagnostic(diagnostic);
     }
 }
Exemplo n.º 24
0
 public void OnDiagnostic(IDiagnostic diagnostic)
 {
     if(diagnostic is NativeQueryNotOptimized){
         Console.WriteLine("Query not optimized"+diagnostic);
     } else if(diagnostic is NativeQueryOptimizerNotLoaded){
         Console.WriteLine("Missing native query optimisation assemblies" + diagnostic);
     }
 }
			public void OnDiagnostic(IDiagnostic d)
			{
				if (d.GetType() == typeof(NativeQueryNotOptimized))
				{
					//							_reason = ((NativeQueryNotOptimized) d).reason();
					this._enclosing._failed = true;
				}
			}
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is DeletionFailed)
     {
         // Can't assert directly here, db4o eats the exception. :/
         this._enclosing._failed = true;
     }
 }
			public void OnDiagnostic(IDiagnostic d)
			{
				if (d is DeletionFailed)
				{
					// Can't assert directly here, db4o eats the exception. :/
					this._enclosing._failed = true;
				}
			}
Exemplo n.º 28
0
 public void OnDiagnostic(IDiagnostic diagnostic)
 {
     if (diagnostic is LoadedFromClassIndex)
     {
         Console.WriteLine("This query couldn't use field indexes " +
                           ((LoadedFromClassIndex)diagnostic).Reason());
         Console.WriteLine(diagnostic);
     }
 }
Exemplo n.º 29
0
 private async Task ExecuteTestAsync(DiagnosticTest test)
 {
     IDiagnostic diagnostic = test.Type switch
     {
         DiagnosticType.Paging => _serviceProvider.GetRequiredService <PagingDiagnostic>(),
         _ => throw new NotSupportedException($"Test type {test.Type} is not supported."),
     };
     await diagnostic.ExecuteAsync(test).ConfigureAwait(false);
 }
Exemplo n.º 30
0
 public void OnDiagnostic(IDiagnostic diagnostic)
 {
     if (diagnostic is LoadedFromClassIndex)
     {
         Console.WriteLine("This query couldn't use field indexes " +
                           ((LoadedFromClassIndex) diagnostic).Reason());
         Console.WriteLine(diagnostic);
     }
 }
Exemplo n.º 31
0
            public void OnDiagnostic(IDiagnostic diagnostic)
            {
                Type type = diagnostic.GetType();

                if (filterFor.Contains(type))
                {
                    target.OnDiagnostic(diagnostic);
                }
            }
			public void OnDiagnostic(IDiagnostic d)
			{
				if (d is ObjectFieldDoesNotExist)
				{
					ObjectFieldDoesNotExist message = (ObjectFieldDoesNotExist)d;
					Assert.AreEqual(ObjectFieldDoesNotExistTestCase.BogusFieldName, message._fieldName
						);
					this._enclosing._diagnosticCalled = true;
				}
			}
 public HomeController(
     IDiagnostic _trace,
     IEndUser _endUser,
     IService _service
     )
 {
     trace   = _trace;
     endUser = _endUser;
     service = _service;
 }
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is ObjectFieldDoesNotExist)
     {
         ObjectFieldDoesNotExist message = (ObjectFieldDoesNotExist)d;
         Assert.AreEqual(ObjectFieldDoesNotExistTestCase.BogusFieldName, message._fieldName
                         );
         this._enclosing._diagnosticCalled = true;
     }
 }
Exemplo n.º 35
0
 public void OnDiagnostic(IDiagnostic diagnostic)
 {
     if (diagnostic is NativeQueryNotOptimized)
     {
         Console.WriteLine("Query not optimized" + diagnostic);
     }
     else if (diagnostic is NativeQueryOptimizerNotLoaded)
     {
         Console.WriteLine("Missing native query optimisation assemblies" + diagnostic);
     }
 }
            public void OnDiagnostic(IDiagnostic d)
            {
                LoadedFromClassIndex classIndexScan = d as LoadedFromClassIndex;

                if (classIndexScan == null)
                {
                    return;
                }

                _classIndexScansPerSec.Increment();
            }
			public void OnDiagnostic(IDiagnostic diagnostic)
			{
				if (!(diagnostic is NotTransparentActivationEnabled))
				{
					return;
				}
				NotTransparentActivationEnabled taDiagnostic = (NotTransparentActivationEnabled)diagnostic;
				Assert.AreEqual(CrossPlatformServices.FullyQualifiedName(typeof(TransparentActivationDiagnosticsTestCase.NotTAAwareData
					)), ((ClassMetadata)taDiagnostic.Reason()).GetName());
				this._enclosing._registered._registeredCount++;
			}
Exemplo n.º 38
0
 public ModelRepository(string folder, IDiagnostic diagnostic)
 {
     this._loader         = new Loader(this);
     this.SchemaManager   = new SchemaManager(this);
     this.SchemaValidator = new SchemaValidator(this);
     this._loader.LoadConfig(new DirectoryInfo(folder));
     this.Files        = new FileRepository(folder, diagnostic, this);
     this.Diagnostic   = diagnostic;
     this._definitions = new Dictionary <Type, Dictionary <string, IBase> >();
     this._entities    = new Dictionary <Type, TypesIndex>();
 }
            public void OnDiagnostic(IDiagnostic diagnostic)
            {
                if (!(diagnostic is NotTransparentActivationEnabled))
                {
                    return;
                }
                var taDiagnostic = (NotTransparentActivationEnabled)diagnostic;

                Assert.AreEqual(CrossPlatformServices.FullyQualifiedName(typeof(NotTAAwareData
                                                                                )), ((ClassMetadata)taDiagnostic.Reason()).GetName());
                _enclosing._registered._registeredCount++;
            }
Exemplo n.º 40
0
        public static IDiagnostic AsTransparent(this IDiagnostic self)
        {
            switch (self.Severity)
            {
            case DiagnosticSeverity.Hint: return(HintTransparent);

            case DiagnosticSeverity.Warning: return(WarningTransparent);

            case DiagnosticSeverity.Error: return(ErrorTransparent);

            default: return(None);
            }
        }
Exemplo n.º 41
0
        public void LogDiagnostic(Uri fileUri, IDiagnostic diagnostic, ImmutableArray <int> lineStarts)
        {
            (int line, int character) = TextCoordinateConverter.GetPosition(lineStarts, diagnostic.Span.Position);

            // build a a code description link if the Uri is assigned
            var codeDescription = diagnostic.Uri == null ? string.Empty : $" [{diagnostic.Uri.AbsoluteUri}]";

            var message = $"{fileUri.LocalPath}({line + 1},{character + 1}) : {diagnostic.Level} {diagnostic.Code}: {diagnostic.Message}{codeDescription}";

            this.logger.Log(ToLogLevel(diagnostic.Level), message);

            this.HasLoggedErrors |= diagnostic.Level == DiagnosticLevel.Error;
        }
Exemplo n.º 42
0
        public virtual void OnDiagnostic(IDiagnostic d)
        {
            if (_listeners == null)
            {
                return;
            }
            IEnumerator i = _listeners.GetEnumerator();

            while (i.MoveNext())
            {
                ((IDiagnosticListener)i.Current).OnDiagnostic(d);
            }
        }
Exemplo n.º 43
0
        private static void ApplyFix(IDiagnostic diagnostic)
        {
            var fix = PrefabsFixes.Fixes(diagnostic).FirstOrDefault();

            if (fix == null)
            {
                return;
            }

            var context = diagnostic.Context();

            Debug.Log("Applying fix with description: " + fix.Describe(context));
            fix.Execute(context);
        }
        public static IEnumerable <IFix> Fixes(IDiagnostic diagnostic)
        {
            if (diagnostic == null)
            {
                return(Enumerable.Empty <IFix>());
            }

            IFix[] fixes;
            if (!FixesByDiagnostic.TryGetValue(diagnostic.Id, out fixes))
            {
                return(Enumerable.Empty <IFix>());
            }

            return(fixes);
        }
Exemplo n.º 45
0
        private static object ToMonacoDiagnostic(IDiagnostic diagnostic, IReadOnlyList <int> lineStarts)
        {
            var(startLine, startChar) = TextCoordinateConverter.GetPosition(lineStarts, diagnostic.Span.Position);
            var(endLine, endChar)     = TextCoordinateConverter.GetPosition(lineStarts, diagnostic.GetEndPosition());

            return(new {
                code = diagnostic.Code,
                message = diagnostic.Message,
                severity = ToMonacoSeverity(diagnostic.Level),
                startLineNumber = startLine + 1,
                startColumn = startChar + 1,
                endLineNumber = endLine + 1,
                endColumn = endChar + 1,
            });
        }
		public void OnDiagnostic(IDiagnostic d) {
			//Log.DebugFormat("db4o Diagnostic Event {0}", d.GetType().Name);
			var message = d as DiagnosticBase;
			if (message == null) return;

			Level level = DefaultLevel;

			if (d is DeletionFailed)
				level = Level.Error;
			else if (d is DescendIntoTranslator)
				level = Level.Warn;
			else if (d is DefragmentRecommendation ||
					 d is NativeQueryNotOptimized ||
					 d is NativeQueryOptimizerNotLoaded)
				level = Level.Info;

			Log.Log(level, message.Problem());
			if (OutputReason)
				Log.LogFormat(level, "Reason: {0}", message.Reason());
			if (OutputSolution)
				Log.LogFormat(level, "Solution: {0}", message.Solution());
		}
			public void OnDiagnostic(IDiagnostic d)
			{
				if (d is MissingClass)
				{
					classesNotFound.Add(((MissingClass)d).Reason());
				}
			}
		/// <summary>redirects Diagnostic messages to the Console.</summary>
		/// <remarks>redirects Diagnostic messages to the Console.</remarks>
		public virtual void OnDiagnostic(IDiagnostic d)
		{
			Sharpen.Runtime.Out.WriteLine(d.ToString());
		}
Exemplo n.º 49
0
			public void OnDiagnostic (IDiagnostic d)
			{
				Console.WriteLine("---> " +  d);
			}
Exemplo n.º 50
0
		public void OnDiagnostic(IDiagnostic d)
		{
			if ( (d is NativeQueryNotOptimized) || (d is NativeQueryOptimizerNotLoaded))
			{
				MessageBox.Show(d.GetType() + "\r\n"+  d, "Info");
			}
		}
Exemplo n.º 51
0
 public virtual void OnDiagnostic(IDiagnostic d)
 {
     _diagnostics.Add(d);
 }
Exemplo n.º 52
0
		public virtual void OnDiagnostic(IDiagnostic d)
		{
			if (_listeners == null)
			{
				return;
			}
			IEnumerator i = _listeners.GetEnumerator();
			while (i.MoveNext())
			{
				((IDiagnosticListener)i.Current).OnDiagnostic(d);
			}
		}
Exemplo n.º 53
0
			public void OnDiagnostic(IDiagnostic d)
			{
				LoadedFromClassIndex classIndexScan = d as LoadedFromClassIndex;
				if (classIndexScan == null)
					return;

				_classIndexScansPerSec.Increment();
			}
		public virtual void OnDiagnostic(IDiagnostic d)
		{
			Assert.IsFalse(d is LoadedFromClassIndex);
		}
Exemplo n.º 55
0
 public void OnDiagnostic(IDiagnostic d)
 {
     if (d is LoadedFromClassIndex)
     {
         _enclosing._diagnosticsCalled = true;
     }
 }
Exemplo n.º 56
0
        /// <summary>redirects Diagnostic messages to System.Diagnostics.Trace</summary>
        /// <remarks>redirects Diagnostic messages to the Console.</remarks>
        public virtual void OnDiagnostic(IDiagnostic d)
        {
#if !SILVERLIGHT
            Trace.WriteLine(d.ToString());
#endif
        }