Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.

If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!

ProGet - Exception: An error occurred in the web application: Nullable object must have a value.



  • Version 2024.11 (Build 10)

    A new exception is created navigating on the web UI or just pressing F5.

    An error occurred in the web application: Nullable object must have a value.
    
    URL: https://192.168.x.x/0x44/ProGet.WebApplication/Inedo.ProGet.WebApplication.Controls.Layout.NotificationBar/GetNotifications
    Referrer: https://192.168.x.x/administration/logs
    User: xxxxxxxxxx
    User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
    Stack trace: at System.Nullable`1.get_Value()
    at Inedo.ProGet.WebApplication.Controls.Layout.NotificationBar.GetNotificationsInternal(AhHttpContext context)
    at Inedo.ProGet.WebApplication.Controls.Layout.NotificationBar.GetNotifications(AhHttpContext context)
    at Inedo.Web.AhWebMiddleware.InvokeAsync(HttpContext context)
    

  • inedo-engineer

    Hi @jw ,

    Can you try restarting the web application (Admin > Manage Service)? Hopefully it will be resolved after that.

    Thanks,
    Steve



  • Hi Steve,

    I tried restarting via Manage Service, restarted both Windows services manually and rebooted the whole VM.

    The issue does not seem to go away.


  • inedo-engineer

    Hi @jw,

    I'm afraid I'm at at a loss then...

    It seems to be related to one of the following settings / issues:

    • Admin Banner Message that was configured on Admin section
    • When logged in as Admin...
      • New ProGet Version Detected
      • License Violation (i.e. using ProGet Free connectors)
      • License Problem/Expiry (your license key)
      • Extenison Load Error
    • NuGet v2 queries

    Based on the stack trace, I can't pinpoint which one it is, but I'll share the code - and maybe you'll see something.

    I would first try to pinpoint which it is by trying as Admin vs Non-Admin, and then see which of those issues it could be.

    private static List<Notification> GetNotificationsInternal(AhHttpContext context)
    {
        var notifications = new List<Notification>();
    
        if(!string.IsNullOrWhiteSpace(ProGetConfig.Web.AdminBannerMessage) && (ProGetConfig.Web.AdminBannerExpiry == null || DateTime.UtcNow < ProGetConfig.Web.AdminBannerExpiry))
        {
            notifications.Add(new Notification(
                NotificationType.warning,
                ProGetConfig.Web.AdminBannerMessage
            ));
        }
    
        if (WebUserContext.IsAuthorizedForTask(ProGetSecuredTask.Admin_ConfigureProGet))
        {
            if (ShowUpdateNotification(context))
            {
                notifications.Add(new Notification(
                    NotificationType.update,
                    InfoBlock.Success(
                        new A(Localization.Global.UpdatesAvailable) { Href = UpdatesOverviewPage.BuildUrl(returnUrl: AhHttpContext.Current.Request.Url.PathAndQuery) }
                    )
                ));
            }
    
            if (ShowLicenseViolationNotification(context, out var violationUrl))
            {
                notifications.Add(new Notification(NotificationType.error,
                    new A(Localization.Global.LicenseViolation)
                    { Href = violationUrl }
                ));
            }
    
            var expiresDate = Licensing.LicensingInformation.Current.LicenseKey?.ExpiresDate;
            if (expiresDate != null && expiresDate <= DateTime.Now)
            {
                notifications.Add(new Notification(NotificationType.error,
                    new A(Localization.Global.KeyExpired)
                    { Href = LicensingOverviewPage.BuildUrl() }
                ));
            }
            else if (Licensing.LicensingInformation.Current?.LicenseKey?.LicenseType == ProGetLicenseType.Trial)
            {
                var days = (int)expiresDate.Value.Subtract(DateTime.Now).TotalDays;
                notifications.Add(new Notification(NotificationType.warning,
                        new A(Localization.Global.TrialWillExpire(ProGetConfig.Licensing.EnterpriseTrial ? "Enterprise" : "Basic", days))
                        { Href = LicensingOverviewPage.BuildUrl() }
                    ));
            }                    
            else if (expiresDate != null && expiresDate.Value.Subtract(DateTime.Now).TotalDays <= 45)
            {
                var days = (int)expiresDate.Value.Subtract(DateTime.Now).TotalDays;
                notifications.Add(new Notification(NotificationType.warning,
                    new A(Localization.Global.KeyWillExpire(days))
                    { Href = LicensingOverviewPage.BuildUrl() }
                ));
            }
            
    
            var extensions = ExtensionsManager.GetExtensions();
    
            if (!extensions.Any() || extensions.All(e => !e.LoadResult.Loaded))
            {
                notifications.Add(new Notification(
                    NotificationType.error,
                    InfoBlock.Error(
                        new A(Localization.Global.ExtensionLoadError) { Href = Pages.Administration.Extensions.ExtensionsOverviewPage.BuildUrl() }
                    )
                ));
            }
    
            if (WUtil.ShowDockerRestartMessage)
            {
                notifications.Add(
                    new Notification(
                        NotificationType.warning,
                        InfoBlock.Warning(Localization.Global.ContainerRestartNeeded)
                    )
                );
            }
        }
       
        var v2Notifications = ShowV2DeprecatedQueriesUsedWarning(context);
        if (v2Notifications.Any())
        {
            notifications.AddRange(v2Notifications.Select(f => new Notification(
                NotificationType.warning,
                InfoBlock.Warning(new A(ManageFeedPropertiesPage.BuildUrl(f.Feed_Id), $"{f.Feed_Name} is using deprecated ODATA (V2) Queries."))
            )));
        }
    
        return notifications;
    }
    


  • Hi @stevedennis

    Let's continue this thread here: EDO-10681


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation