Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

NullExceptionError on v5.0.1 MVC Core Angular #4222


User avatar
0
buddhit created

Hello,

We recently purchased a key to the boilerplate and once we downloaded and installed all of the files whenever we go to load the API up we encounter a NullExceptionError being passed into

var subscriptionExpiredTenants

I believe this is where the subscriptions information is passed in from the tenant information and as it's factory settings I'm not sure why it's occurring, for the meantime we can get around it by commenting out as shown below but this is not ideal. Any ideas guys?

protected override void DoWork()
        {
            var utcNow = Clock.Now.ToUniversalTime();
            var failedTenancyNames = new List<string>();
            /*
            var subscriptionExpiredTenants = _tenantRepository.GetAllList(
                tenant => tenant.SubscriptionEndDateUtc != null &&
                          tenant.SubscriptionEndDateUtc <= utcNow &&
                          tenant.IsActive &&
                          tenant.EditionId != null
            );

            foreach (var tenant in subscriptionExpiredTenants)
            {
                Debug.Assert(tenant.EditionId.HasValue);

                try
                {

                    var edition = _editionRepository.Get(tenant.EditionId.Value);

                    Debug.Assert(tenant.SubscriptionEndDateUtc != null, "tenant.SubscriptionEndDateUtc != null");

                    if (tenant.SubscriptionEndDateUtc.Value.AddDays(edition.WaitingDayAfterExpire ?? 0) >= utcNow)
                    {
                        //Tenant is in waiting days after expire TODO: It's better to filter such entities while querying from repository!
                        continue;
                    }

                    var endSubscriptionResult = AsyncHelper.RunSync(() => _tenantManager.EndSubscriptionAsync(tenant, edition, utcNow));

                    if (endSubscriptionResult == EndSubscriptionResult.TenantSetInActive)
                    {
                        _userEmailer.TryToSendSubscriptionExpireEmail(tenant.Id, utcNow);
                    }
                    else if (endSubscriptionResult == EndSubscriptionResult.AssignedToAnotherEdition)
                    {
                        AsyncHelper.RunSync(() => _userEmailer.TryToSendSubscriptionAssignedToAnotherEmail(tenant.Id, utcNow, edition.ExpiringEditionId.Value));
                    }
                }
                catch (Exception exception)
                {
                    failedTenancyNames.Add(tenant.TenancyName);
                    Logger.Error($"Subscription of tenant {tenant.TenancyName} has been expired but tenant couldn't be made passive !");
                    Logger.Error(exception.Message, exception);
                }
            } */

            if (!failedTenancyNames.Any())
            {
                return;
            }

            _userEmailer.TryToSendFailedSubscriptionTerminationsEmail(failedTenancyNames, utcNow);
        }
    }
}

6 Answer(s)
  • User Avatar
    0
    poolman created

    I have the same issue, but unclear if it actually has any impact. I usually just hit F5 to continue, and it seems to load the site with out any issues.

    -Chris

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    It is fixed in v5.0.2 and this issue is related to EntityFramework, see <a class="postlink" href="https://github.com/aspnet/EntityFrameworkCore/issues/10407">https://github.com/aspnet/EntityFramewo ... sues/10407</a>.

  • User Avatar
    0
    buddhit created

    Yes it is all good after downloading V5.0.2 Thank you guys

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @buddhit,

    We recently released v5.0.4 with some fixes. If you haven't started your project, please go with 5.0.4.

    Thanks.

  • User Avatar
    0
    buddhit created

    Hi there

    thank you for that, however, we have already started our project, How can we apply changes you have made without losing our work?

    Regards Buddhi

  • User Avatar
    0
    aaron created
    Support Team