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

InspectAll fails when Event has multiple DateTime fields #101

Description

@lamolley1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions