Hangfire icon indicating copy to clipboard operation
Hangfire copied to clipboard

why the .net core version dashboard not support cronDescription

Open witskeeper opened this issue 6 years ago • 2 comments

i saw the code in https://github.com/HangfireIO/Hangfire/blob/master/src/Hangfire.Core/Dashboard/Pages/RecurringJobsPage.cshtml

<td class="min-width">
                                        @* ReSharper disable once EmptyGeneralCatchClause *@
                                        @{
                                            string cronDescription = null;
#if NETFULL
                                            try
                                            {
                                                cronDescription = string.IsNullOrEmpty(job.Cron) ? null : CronExpressionDescriptor.ExpressionDescriptor.GetDescription(job.Cron);
                                            }
                                            catch (FormatException)
                                            {
                                            }
#endif
                                        }

                                        @if (cronDescription != null)
                                        {
                                            <code title="@cronDescription">@job.Cron</code>
                                        }
                                        else
                                        {
                                            <code>@job.Cron</code>
                                        }
                                    </td>

why we need add #if NETFULL ?

witskeeper avatar Aug 07 '18 09:08 witskeeper

the code block will work fine in .net core. Can I create a PR to remove this condition?

zhiyuanzhang-unai avatar Oct 19 '18 18:10 zhiyuanzhang-unai

Resurrecting this issue. I was looking into creating a PR for this but found some things it would be good to get some background on the reasoning for.

The GetDescription method in Cron.cs is marked obsolete, presumably because the CronExpressionDescriptor package is only referenced for net framework builds.

The version of CronExpressionDescriptor referenced is 1.12.0 which didn't support netstandard or later. However the latest version appears to do so.

Do the maintainers agree a fix for this would be to update the CronExpressionDescriptor package, remove the feature pre-processor and obsolete attributes to allow the cron description to work on net core?

Steve887 avatar Jan 11 '24 06:01 Steve887