Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

InspectAll fails when Event has multiple DateTime fields #101

Open
lamolley1 opened this issue Oct 31, 2018 · 0 comments
Open

InspectAll fails when Event has multiple DateTime fields #101

lamolley1 opened this issue Oct 31, 2018 · 0 comments

Comments

@lamolley1
Copy link

Example event:

        [Event(1, Level = EventLevel.Informational)]
        public void ExampleEvent(
            DateTime datetime1,
            DateTime datetime2)
        {
            this.WriteEvent(datetime1, datetime2);
        }

The analyzer throws:

System.FormatException: 1 is not a valid value for DateTime ---> System.FormatException: String was not recognized as a valid DateTime.

Result StackTrace:	
at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)
   at System.ComponentModel.DateTimeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
 --- End of inner exception stack trace ---
    at System.ComponentModel.DateTimeConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.TypeExtensions.NotDefault(Type type)
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.EventSourceAnalyzer.TryInvokeMethod(EventSchema eventSchema, EventSource source, ProbeEventListener listener, MethodInfo& method)
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.EventSourceAnalyzer.ProbeEvent(EventSchema eventSchema, EventSource source)
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.EventSourceAnalyzer.Inspect(EventSource eventSource)
   at Microsoft.Practices.EnterpriseLibrary.SemanticLogging.Utility.EventSourceAnalyzer.InspectAll(EventSource eventSource)
   at

When the second datetime is removed the test succeeds. Is this an eventsource limitation or a bug in the analyzer? I'm on the latest analyzer package version - 2.0.1406.1

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant