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

Bugfix: Can't update EventLog's Source property #1548

Merged
merged 3 commits into from
Jul 23, 2016
Merged

Conversation

s-sreenath
Copy link
Contributor

@s-sreenath s-sreenath commented Jul 20, 2016

fixes #1542

EventLog Source not updated - Fix
@@ -349,7 +349,9 @@ internal string GetFixedSource()
/// <returns></returns>
private EventLog GetEventLog(LogEventInfo logEvent)
{
return eventLogInstance ?? (eventLogInstance = new EventLog(this.Log, this.MachineName, this.Source.Render(logEvent)));
if (eventLogInstance?.Source == this.Source.Render(logEvent))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In worst case we're rendering the source two times?

Also there is an (implicit) two times check on null and we need to check also log and machine?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean something like this?

if (eventLogInstance?.Source == this.Source.Render(logEvent) && eventLogInstance?.Log == this.Log && eventLogInstance?.MachineName == this.MachineName)
                return eventLogInstance ?? (eventLogInstance = new EventLog(this.Log, this.MachineName, this.Source.Render(logEvent)));
            return eventLogInstance = new EventLog(this.Log, this.MachineName, this.Source.Render(logEvent));

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think it fixes the issue (hard to read on mobile) but Its still double checking null (?. and ==), which is a bit sloppy

@304NotModified
Copy link
Member

Thanks! Added a note. Not sure why appveyor complains, looks unrelated

@codecov-io
Copy link

codecov-io commented Jul 21, 2016

Current coverage is 76% (diff: 75%)

Merging #1548 into master will increase coverage by <1%

@@             master      #1548   diff @@
==========================================
  Files           269        269          
  Lines         16266      16288    +22   
  Methods        2605       2607     +2   
  Messages          0          0          
  Branches       1769       1776     +7   
==========================================
+ Hits          12367      12386    +19   
- Misses         3487       3491     +4   
+ Partials        412        411     -1   

Sunburst

Powered by Codecov. Last update 698ca65...8b5590d

@304NotModified 304NotModified changed the title EventLog Source not updated - Fix Bugfix: Can't update EventLog's Source property Jul 23, 2016
@304NotModified 304NotModified added bug Bug report / Bug fix has unittests labels Jul 23, 2016
@304NotModified 304NotModified added this to the 4.3.6 milestone Jul 23, 2016
@304NotModified 304NotModified merged commit ba06724 into master Jul 23, 2016
@304NotModified 304NotModified deleted the EventLog-1542 branch July 26, 2016 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug report / Bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants