示例#1
0
        public void Missing_assemblies_do_not_cause_sensor_discovery_to_fail()
        {
            // force loading of the problem assembly. this assembly has a dependency which is deliberately not included in the project so that unprotected MEF usage will trigger a TypeLoadException. sensor discovery is intended to ignore this issue and swallow the exception.
            var o = new ClassWithoutReferenceToMissingAssembly();

            DiagnosticSensor.Discover().Count().Should().BeGreaterThan(0);
        }
示例#2
0
        public void ReflectionTypeLoadException_due_to_missing_assembly_is_signalled_by_sensor_output()
        {
            // force loading of the problem assembly. this assembly has a dependency which is deliberately not included in the project so that unprotected MEF usage will trigger a TypeLoadException. sensor discovery is intended to ignore this issue and swallow the exception.
            var o = new ClassWithoutReferenceToMissingAssembly();

            dynamic reading = DiagnosticSensor.Discover()
                              .Values
                              .Select(s => s.Read())
                              .OfType <ReflectionTypeLoadException>()
                              .First();

            var loaderException = ((IEnumerable <Exception>)reading.LoaderExceptions).Single();

            loaderException.Message.Should().Contain("Could not load file or assembly 'MissingDependency, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e9ed0c9abcf549e2' or one of its dependencies. The system cannot find the file specified.");
        }
示例#3
0
        public void ReflectionTypeLoadException_due_to_missing_assembly_is_signalled_by_sensor_output()
        {
            // force loading of the problem assembly. this assembly has a dependency which is deliberately not included in the project so that unprotected MEF usage will trigger a TypeLoadException. sensor discovery is intended to ignore this issue and swallow the exception. 
            var o = new ClassWithoutReferenceToMissingAssembly();

            dynamic reading = DiagnosticSensor.Discover()
                                              .Values
                                              .Select(s => s.Read())
                                              .OfType<ReflectionTypeLoadException>()
                                              .First();

            var loaderException = ((IEnumerable<Exception>) reading.LoaderExceptions).Single();

            loaderException.Message.Should().Contain("Could not load file or assembly 'MissingDependency, Version=1.0.0.0, Culture=neutral, PublicKeyToken=e9ed0c9abcf549e2' or one of its dependencies. The system cannot find the file specified.");
        }
示例#4
0
        public void Missing_assemblies_do_not_cause_sensor_discovery_to_fail()
        {
            // force loading of the problem assembly. this assembly has a dependency which is deliberately not included in the project so that unprotected MEF usage will trigger a TypeLoadException. sensor discovery is intended to ignore this issue and swallow the exception. 
            var o = new ClassWithoutReferenceToMissingAssembly();

            DiagnosticSensor.Discover().Count().Should().BeGreaterThan(0);
        }