Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement]: Reduce non-critical errors logged at startup #5711

Closed
3 of 4 tasks
bdukes opened this issue Jun 28, 2023 · 0 comments · Fixed by #5712
Closed
3 of 4 tasks

[Enhancement]: Reduce non-critical errors logged at startup #5711

bdukes opened this issue Jun 28, 2023 · 0 comments · Fixed by #5712
Assignees

Comments

@bdukes
Copy link
Contributor

bdukes commented Jun 28, 2023

Is there an existing issue for this?

  • I have searched the existing issues

Description of problem

#4455 added logging during startup when Dependency Injection is scanning for types. This is helpful for debugging issues, but also often includes logging of assemblies where there is no issue. Because these are exceptions logged with an Error log level, it can appear that there are problems with the DNN site, when they are fine to be ignored. I've noticed many people being misled by these errors in the log.

Description of solution

I'm suggesting two changes. First, these issues scanning types should be logged at the Warn log level. This would mean that they do not show up at all in an installation that has not modified the logging. Looking for feedback if this change would be too drastic and negate the benefits of #4455.

The second change is to adjust the logging of errors scanning types, so that they are combined into a single log that is clearer to read. Ideally, this would also include wording indicating that these failures do not necessarily represent issues with the DNN site.

Description of alternatives considered

No response

Anything else?

An example of the current logging in DNN 9.12.0
2023-06-28 11:51:15.024-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.DependencyInjectionInitialize - Unable to configure services for DotNetNuke.Modules.Reports, Version=6.1.0.0, Culture=neutral, PublicKeyToken=null, see exception for details 
- LoaderException: Could not load file or assembly 'nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The system cannot find the file specified.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:17.045-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.Extensions.StartupExtensions - Unable to configure services for DotNetNuke.Modules.Reports, Version=6.1.0.0, Culture=neutral, PublicKeyToken=null, see exception for details 
- LoaderException: Could not load file or assembly 'nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The system cannot find the file specified.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:17.580-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.Extensions.StartupExtensions - Unable to configure services for JSPool, Version=2.0.1.0, Culture=neutral, PublicKeyToken=2fc7775f73072640, see exception for details 
- LoaderException: Method 'get_SupportsScriptPrecompilation' in type 'JSPool.JsEngineWithOwnThread' from assembly 'JSPool, Version=2.0.1.0, Culture=neutral, PublicKeyToken=2fc7775f73072640' does not have an implementation.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:17.880-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.Extensions.StartupExtensions - Unable to configure services for Microsoft.AspNetCore.Mvc.Razor.Host, Version=1.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, see exception for details 
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Chunks.Generators.SpanChunkGenerator' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Chunks.Chunk' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.CodeVisitor`1' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.CSharpCodeGenerator' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.CSharpDesignTimeCodeVisitor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.CSharpCodeParser' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.RazorEngineHost' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.RazorParser' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.TagHelperAttributeValueCodeRenderer' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.TagHelpers.TagHelperDirectiveSpanVisitor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Compilation.TagHelpers.TagHelperDescriptor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:17.894-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.Extensions.StartupExtensions - Unable to configure services for Microsoft.AspNetCore.Mvc.RazorPages, Version=2.1.11.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, see exception for details 
- LoaderException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IParameterInfoParameterDescriptor' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IPropertyInfoParameterDescriptor' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:19.517-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.Mvc.Extensions.StartupExtensions - Unable to configure services for DotNetNuke.Modules.Reports, Version=6.1.0.0, Culture=neutral, PublicKeyToken=null, see exception for details 
- LoaderException: Could not load file or assembly 'nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77' or one of its dependencies. The system cannot find the file specified.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:19.521-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.Mvc.Extensions.StartupExtensions - Unable to configure services for JSPool, Version=2.0.1.0, Culture=neutral, PublicKeyToken=2fc7775f73072640, see exception for details 
- LoaderException: Method 'get_SupportsScriptPrecompilation' in type 'JSPool.JsEngineWithOwnThread' from assembly 'JSPool, Version=2.0.1.0, Culture=neutral, PublicKeyToken=2fc7775f73072640' does not have an implementation.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:19.527-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.Mvc.Extensions.StartupExtensions - Unable to configure services for Microsoft.AspNetCore.Mvc.Razor.Host, Version=1.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, see exception for details 
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Chunks.Generators.SpanChunkGenerator' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Chunks.Chunk' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.CodeVisitor`1' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.CSharpCodeGenerator' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.CSharpDesignTimeCodeVisitor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.CSharpCodeParser' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.RazorEngineHost' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.RazorParser' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.TagHelperAttributeValueCodeRenderer' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.TagHelpers.TagHelperDirectiveSpanVisitor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Compilation.TagHelpers.TagHelperDescriptor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:19.530-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.Mvc.Extensions.StartupExtensions - Unable to configure services for Microsoft.AspNetCore.Mvc.RazorPages, Version=2.1.11.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, see exception for details 
- LoaderException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IParameterInfoParameterDescriptor' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IPropertyInfoParameterDescriptor' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:20.208-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.DependencyInjectionInitialize - Unable to configure services for JSPool, Version=2.0.1.0, Culture=neutral, PublicKeyToken=2fc7775f73072640, see exception for details 
- LoaderException: Method 'get_SupportsScriptPrecompilation' in type 'JSPool.JsEngineWithOwnThread' from assembly 'JSPool, Version=2.0.1.0, Culture=neutral, PublicKeyToken=2fc7775f73072640' does not have an implementation.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:20.244-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.DependencyInjectionInitialize - Unable to configure services for Microsoft.AspNetCore.Mvc.Razor.Host, Version=1.1.6.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, see exception for details 
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Chunks.Generators.SpanChunkGenerator' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Chunks.Chunk' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.CodeVisitor`1' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.CSharpCodeGenerator' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.Visitors.CSharpDesignTimeCodeVisitor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.CSharpCodeParser' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.RazorEngineHost' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.RazorParser' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.CodeGenerators.TagHelperAttributeValueCodeRenderer' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Parser.TagHelpers.TagHelperDirectiveSpanVisitor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Razor.Compilation.TagHelpers.TagHelperDescriptor' from assembly 'Microsoft.AspNetCore.Razor, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51
2023-06-28 11:51:20.247-05:00 [dev33][D:2][T:1][ERROR] DotNetNuke.Web.DependencyInjectionInitialize - Unable to configure services for Microsoft.AspNetCore.Mvc.RazorPages, Version=2.1.11.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, see exception for details 
- LoaderException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IParameterInfoParameterDescriptor' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
- LoaderException: Could not load type 'Microsoft.AspNetCore.Mvc.Internal.IPropertyInfoParameterDescriptor' from assembly 'Microsoft.AspNetCore.Mvc.Core, Version=2.2.5.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'.
System.Reflection.ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
   at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
   at System.Reflection.RuntimeModule.GetTypes()
   at System.Reflection.Assembly.GetTypes()
   at DotNetNuke.DependencyInjection.Extensions.TypeExtensions.SafeGetTypes(Assembly assembly, ILog logger) in /_/DNN Platform/DotNetNuke.DependencyInjection/Extensions/TypeExtensions.cs:line 51

Do you be plan to contribute code for this enhancement?

  • Yes

Would you be interested in sponsoring this enhancement?

  • Yes

Code of Conduct

  • I agree to follow this project's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant