question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ENUM EventLogType changes should be reporting as breaking changes

See original GitHub issue

Description of bug

It’s not a bug. IMO a change in standard publicly exposed ENUM regularly used in module development should be reported as breaking change. Typically we target the minimum version of DNN we want to support and reference the appropriate assemblies in our project. A change between 9.2 and 9.6.2+ (probably more-so related to dependency injection change in… 9.5 or so?) introduced a change in the EventType for the logging controller.

Possibly discussion related to #4242

An often used log type would be ADMIN_ALERT.

e.g. EventLogController.Instance.AddLog("hello", "world", portalSettings, userID, EventLogController.EventLogType.ADMIN_ALERT)

What I found is that after upgrading a DNN instance from 9.2.1 to 9.6.2 logging ceased. This is because the ADMIN_ALERT in 9.2.1 lined up in sequence (order) with APPLICATION_SHUTTING_DOWN in 9.6.2. and therefore was never logging.

Steps to reproduce

List the precise steps to reproduce the bug:

  1. Reference Dotnetnuke.dll v9.2.1 (or earlier)
  2. Attempt to write an ADMIN_ALERT to the event log in a site on v9.6.2+

Current behavior

Doesn’t log

Expected behavior

Should log an admin alert to the event viewer.

Affected version

9.6.2+

Workaround

For developers that do not want to create additional configurations/builds for their module, you can safely get the proper LogType by

var adminAlert = (EventLogController.EventLogType)Enum.Parse(typeof(EventLogController.EventLogType), "ADMIN_ALERT");
EventLogController.Instance.AddLog("hello", "world", portalSettings, userID, adminAlert)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
SkyeHoeflingcommented, Nov 11, 2020

For what it is worth this is something that has been worked on in the new DotNetNuke.Abstractions project. If you look at the new EventLogType it is using numbered enums

https://github.com/dnnsoftware/Dnn.Platform/blob/d5d6d2b1c9072e80228e1352de855ab6194aa128/DNN Platform/DotNetNuke.Abstractions/Logging/EventLogType.cs#L9-L19

0reactions
stale[bot]commented, Mar 19, 2021

This issue has been closed automatically due to inactivity (as mentioned 14 days ago). Feel free to re-open the issue if you believe it is still relevant.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is changing the number of an enum a breaking change?
It depends. It's a non-breaking change only if you can verify that noone depends on its value being 5 or the same as...
Read more >
Enum property addition to teamworkDevice resource in ...
In a teamworkDevice record, we have added a new supported value called sipAnalog for the field deviceType. This value can be used for...
Read more >
[Solved] Is adding an enum variant a breaking change?
Yes, it means that adding a new error variant requires bumping the major version of the library, but I think this is to...
Read more >
Enum with `str` or `int` Mixin Breaking Change in Python 3.11
It works consistently with all the examples posted and I suspect will not be broken by 3.11's fixes. Upvote 17
Read more >
Solved: Enum in an Event Structure - NI Community
Solved: When I try to change an enum on my front panel with an event structure my labVIEW code locks up. I have...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found