Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC

Activities of "manojreddy"

yes, Test Project has appsettings.json has the license code.

Did you check my post?, I have mentioned it in my reply.

Please check the post first.

I think appsettings.json, because in the following line >configuration["AbpZeroLicenseCode"] returns null.

Configuration.Modules.AspNetZero().LicenseCode = configuration["AbpZeroLicenseCode"];

In the same testproject folder

Hi, I have found out the root cause of this issue.

Actually, I'm trying to read two appsettings.json(one is named as appsettings.json and other is named as testingappsettings.json) in my Test Module and its reading only one at a time. So, my question is how to read from two appsettings.json file. I cannot use only one, I must use two JSON files.

Please find my code below.

using System;
using Abp.AutoMapper;
using Abp.Configuration.Startup;
using Abp.Dependency;
using Abp.Domain.Repositories;
using Abp.Modules;
using Abp.Net.Mail;
using Abp.TestBase;
using Abp.Zero.Configuration;
using Castle.MicroKernel.Registration;
using MyCompany.MyProject.Articles;
using MyCompany.MyProject.Business.DAL;
using MyCompany.MyProject.Business.Dto.Articles;
using MyCompany.MyProject.Business.Dto.Classifications;
using MyCompany.MyProject.Business.Dto.Common;
using MyCompany.MyProject.Business.Dto.Currency;
using MyCompany.MyProject.Business.Dto.Deposit;
using MyCompany.MyProject.Business.Dto.PromoPack;
using MyCompany.MyProject.Business.Dto.Property;
using MyCompany.MyProject.Business.Dto.Suppliers;
using MyCompany.MyProject.Business.Dto.Taxes;
using MyCompany.MyProject.Business.Dto.TenderTypes;
using MyCompany.MyProject.Business.Model.Articles;
using MyCompany.MyProject.Business.Model.Common;
using MyCompany.MyProject.Business.Model.Stores;
using MyCompany.MyProject.Business.Model.Suppliers;
using MyCompany.MyProject.Business.Model.Taxes;
using MyCompany.MyProject.Business.Repositories.Interfaces;
using MyCompany.MyProject.Business.Repositories.Repositories;
using MyCompany.MyProject.Common;
using MyCompany.MyProject.EntityFrameworkCore;
using MyCompany.MyProject.PromoPack;
using MyCompany.MyProject.Security.Recaptcha;
using MyCompany.MyProject.Tests.DependencyInjection;
using MyCompany.MyProject.Tests.Url;
using MyCompany.MyProject.Tests.Web;
using MyCompany.MyProject.Url;
using NSubstitute;
using MyCompany.MyProject.Business.Dto.Stores;
using MyCompany.MyProject.Business.Services.Articles;
using MyCompany.MyProject.Configuration;
using MyCompany.MyProject.Processors.Core;
using Abp.AspNetZeroCore;
using Microsoft.Extensions.Configuration;
using System.IO;

namespace MyCompany.MyProject.Tests
{
    [DependsOn(
        typeof(MyProjectServicesModule),
        typeof(MyProjectEntityFrameworkCoreModule),
        typeof(MyProjectRepositoryModule),
        typeof(AbpTestBaseModule))]
    public class MyProjectTestModule : AbpModule
    {
        public MyProjectTestModule(MyProjectEntityFrameworkCoreModule abpZeroTemplateEntityFrameworkCoreModule)
        {
            abpZeroTemplateEntityFrameworkCoreModule.SkipDbContextRegistration = true;
        }

        public override void PreInitialize()
        {
            var configuration = GetConfiguration();

            Configuration.UnitOfWork.Timeout = TimeSpan.FromMinutes(30);
            Configuration.UnitOfWork.IsTransactional = false;

            //Disable static mapper usage since it breaks unit tests (see https://github.com/aspnetboilerplate/aspnetboilerplate/issues/2052)
            Configuration.Modules.AbpAutoMapper().UseStaticMapper = false;

            //Use database for language management
            Configuration.Modules.Zero().LanguageManagement.EnableDbLocalization();

            RegisterFakeService<AbpZeroDbMigrator>();

            IocManager.Register<IAppUrlService, FakeAppUrlService>();
            IocManager.Register<IWebUrlService, FakeWebUrlService>();
            IocManager.Register<IRecaptchaValidator, FakeRecaptchaValidator>();
            IocManager.Register<IJobLeaseManager, BlobStorageJobLeaseManager>();
            IocManager.Register<IJobQueueManager, JobQueueManager>();

            Configuration.ReplaceService<IAppConfigurationAccessor, TestAppConfigurationAccessor>();
            Configuration.ReplaceService<IEmailSender, NullEmailSender>(DependencyLifeStyle.Transient);

            Configuration.Modules.AspNetZero().LicenseCode = configuration["AbpZeroLicenseCode"];

        }

        public override void Initialize()
        {
            ServiceCollectionRegistrar.Register(IocManager);
        }

        private void RegisterFakeService<TService>()
            where TService : class
        {
            IocManager.IocContainer.Register(
                Component.For<TService>()
                    .UsingFactoryMethod(() => Substitute.For<TService>())
                    .LifestyleSingleton()
            );
        }

        private static IConfigurationRoot GetConfiguration()
        {
            return AppConfigurations.Get(Directory.GetCurrentDirectory(), addUserSecrets: true);
        }
    }
}

I have overwritten the TestAppConfigurationAccessor file like this.

using Abp.Dependency;
using Microsoft.Extensions.Configuration;
using MyCompany.MyProject.Configuration;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;

namespace MyCompany.MyProject.Tests
{
    public class TestAppConfigurationAccessor : IAppConfigurationAccessor, ISingletonDependency
    {
        public IConfigurationRoot Configuration { get; }

        public TestAppConfigurationAccessor()
        {
            Configuration = BuildConfig();
        }

        private IConfigurationRoot BuildConfig()
        {
            var currentPath = Directory.GetCurrentDirectory();

            var config = new ConfigurationBuilder()
                .AddJsonFile(Path.Combine(currentPath, "..", "..", "..", "..", "..", "src", "MyCompany.MyProject.Web.Host", $"appsettings.json"), false);

            config.AddJsonFile(Path.Combine(currentPath, $"testingappsettings.json"), false);

            return config.Build();
        }
    }
}

AppConfigurations file:

using System.Collections.Concurrent;
using Abp.Extensions;
using Abp.Reflection.Extensions;
using Microsoft.Extensions.Configuration;

namespace MyCompany.MyProject.Configuration
{
    public static class AppConfigurations
    {
        private static readonly ConcurrentDictionary<string, IConfigurationRoot> ConfigurationCache;

        static AppConfigurations()
        {
            ConfigurationCache = new ConcurrentDictionary<string, IConfigurationRoot>();
        }

        public static IConfigurationRoot Get(string path, string environmentName = null, bool addUserSecrets = false)
        {
            var cacheKey = path + "#" + environmentName + "#" + addUserSecrets;
            return ConfigurationCache.GetOrAdd(
                cacheKey,
                _ => BuildConfiguration(path, environmentName, addUserSecrets)
            );
        }

        private static IConfigurationRoot BuildConfiguration(string path, string environmentName = null, bool addUserSecrets = false)
        {
            var builder = new ConfigurationBuilder()
                .SetBasePath(path)
                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: true);

            if (!environmentName.IsNullOrWhiteSpace())
            {
                builder = builder.AddJsonFile($"appsettings.{environmentName}.json", optional: true);
            }

            builder = builder.AddEnvironmentVariables();

            if (addUserSecrets)
            {
                builder.AddUserSecrets(typeof(AppConfigurations).GetAssembly());
            }

            return builder.Build();
        }
    }
}

testingappsettings.json:

{
  "MasterDataFiles": {
    "TestingEntity1": {
      "UseStaging": "true"
    },
    "TestingEntity2": {
      "UseStaging": "false"
    }
  }
}

appsettings.json:

{
"AbpZeroLicenseCode": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

Getting the same error while running Debug Test

[12/21/2017 2:11:55 PM Informational] ------ Run test started ------ [12/21/2017 2:12:31 PM Informational] [xUnit.net 00:00:21.4148917] Starting: MyCompany.MyProject.Tests [12/21/2017 2:13:00 PM Error] [xUnit.net 00:00:49.7006988] MyCompany.MyProject.Tests.MyEntity.MyEntityAppService_Test.Should_Create_MyEntity_With_Valid_Arguments [FAIL] [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7027177] AutoMapper.AutoMapperConfigurationException : Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters

[12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7030122] MyEntityInput -> MyEntity (Destination member list) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7030618] MyCompany.MyProject.Business.Dto.MyEntitys.MyEntityInput -> MyCompany.MyProject.Business.Model.MyEntitys.MyEntity (Destination member list) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7031223]
[12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7032049] Unmapped properties: [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7032437] IsDeleted [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7032663] DeleterUserId [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7032896] DeletionTime [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7033098] LastModificationTime [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7033324] LastModifierUserId [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7033574] CreationTime [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7033838] CreatorUserId [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7034054]
[12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7044987] Stack Trace: [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7055490] at lambda_method(Closure , MyEntityInput , MyEntity , ResolutionContext ) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7056192] at lambda_method(Closure , Object , Object , ResolutionContext ) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7057142] C:\Users\MyName\source\repos\MyProject\aspnet-core\src\MyCompany.MyProject.Business.Data\Repositories\MyEntityRepository.cs(429,0): at MyCompany.MyProject.Business.Repositories.Repositories.MyEntityRepository.<CreateMyEntityLevelCategory>d__25.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7057588] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7057947] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7058296] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7058716] C:\Users\MyName\source\repos\MyProject\aspnet-core\src\MyCompany.MyProject.Business.Data\Repositories\MyEntityRepository.cs(373,0): at MyCompany.MyProject.Business.Repositories.Repositories.MyEntityRepository.<CreateMyEntityManually>d__23.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7059062] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7059344] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7059778] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7060600] C:\Users\MyName\source\repos\MyProject\aspnet-core\src\MyCompany.MyProject.Business.Data\Repositories\MyEntityRepository.cs(70,0): at MyCompany.MyProject.Business.Repositories.Repositories.MyEntityRepository.<CreateMyEntity>d__12.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7061071] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7061451] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7061823] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7062201] D:\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs(40,0): at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7062522] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7062819] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7063145] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7063465] at MyCompany.MyProject.Business.Services.MyEntitys.MyEntityAppService.<CreateMyEntity>d__4.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7063732] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7064009] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7064478] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7065476] D:\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs(40,0): at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7065989] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7066320] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7066669] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7067054] D:\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs(20,0): at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithFinally>d__0.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7067377] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7067694] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7068003] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7068393] C:\Users\MyName\source\repos\MyProject\aspnet-core\test\MyCompany.MyProject.Tests\MyEntity\MyEntityappservice_test.cs(20,0): at MyCompany.MyProject.Tests.MyEntity.MyEntityAppService_Test.<Should_Create_MyEntity_With_Valid_Arguments>d__1.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7068687] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7068970] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7069297] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7069548] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7069837] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7070170] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7070408] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7070764] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7071072] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7272042] Finished: MyCompany.MyProject.Tests [12/21/2017 2:13:00 PM Informational] ========== Run test finished: 1 run (0:01:04.7057513) ==========

Getting the following error while running Debug Test.

[12/21/2017 2:11:55 PM Informational] ------ Run test started ------ [12/21/2017 2:12:31 PM Informational] [xUnit.net 00:00:21.4148917] Starting: MyCompany.MyProject.Tests [12/21/2017 2:13:00 PM Error] [xUnit.net 00:00:49.7006988] MyCompany.MyProject.Tests.MyEntity.MyEntityAppService_Test.Should_Create_MyEntity_With_Valid_Arguments [FAIL] [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7027177] AutoMapper.AutoMapperConfigurationException : Unmapped members were found. Review the types and members below. Add a custom mapping expression, ignore, add a custom resolver, or modify the source/destination type For no matching constructor, add a no-arg ctor, add optional arguments, or map all of the constructor parameters

[12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7030122] MyEntityInput -> MyEntity (Destination member list) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7030618] MyCompany.MyProject.Business.Dto.MyEntitys.MyEntityInput -> MyCompany.MyProject.Business.Model.MyEntitys.MyEntity (Destination member list) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7031223]
[12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7032049] Unmapped properties: [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7032437] IsDeleted [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7032663] DeleterUserId [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7032896] DeletionTime [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7033098] LastModificationTime [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7033324] LastModifierUserId [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7033574] CreationTime [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7033838] CreatorUserId [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7034054]
[12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7044987] Stack Trace: [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7055490] at lambda_method(Closure , MyEntityInput , MyEntity , ResolutionContext ) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7056192] at lambda_method(Closure , Object , Object , ResolutionContext ) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7057142] C:\Users\MyName\source\repos\MyProject\aspnet-core\src\MyCompany.MyProject.Business.Data\Repositories\MyEntityRepository.cs(429,0): at MyCompany.MyProject.Business.Repositories.Repositories.MyEntityRepository.<CreateMyEntityLevelCategory>d__25.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7057588] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7057947] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7058296] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7058716] C:\Users\MyName\source\repos\MyProject\aspnet-core\src\MyCompany.MyProject.Business.Data\Repositories\MyEntityRepository.cs(373,0): at MyCompany.MyProject.Business.Repositories.Repositories.MyEntityRepository.<CreateMyEntityManually>d__23.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7059062] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7059344] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7059778] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7060600] C:\Users\MyName\source\repos\MyProject\aspnet-core\src\MyCompany.MyProject.Business.Data\Repositories\MyEntityRepository.cs(70,0): at MyCompany.MyProject.Business.Repositories.Repositories.MyEntityRepository.<CreateMyEntity>d__12.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7061071] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7061451] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7061823] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7062201] D:\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs(40,0): at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7062522] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7062819] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7063145] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7063465] at MyCompany.MyProject.Business.Services.MyEntitys.MyEntityAppService.<CreateMyEntity>d__4.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7063732] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7064009] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7064478] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7065476] D:\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs(40,0): at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithPostActionAndFinally>d__1.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7065989] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7066320] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7066669] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7067054] D:\Github\aspnetboilerplate\src\Abp\Threading\InternalAsyncHelper.cs(20,0): at Abp.Threading.InternalAsyncHelper.<AwaitTaskWithFinally>d__0.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7067377] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7067694] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7068003] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7068393] C:\Users\MyName\source\repos\MyProject\aspnet-core\test\MyCompany.MyProject.Tests\MyEntity\MyEntityappservice_test.cs(20,0): at MyCompany.MyProject.Tests.MyEntity.MyEntityAppService_Test.<Should_Create_MyEntity_With_Valid_Arguments>d__1.MoveNext() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7068687] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7068970] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7069297] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7069548] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7069837] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7070170] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7070408] --- End of stack trace from previous location where exception was thrown --- [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7070764] at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7071072] at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) [12/21/2017 2:13:00 PM Informational] [xUnit.net 00:00:49.7272042] Finished: MyCompany.MyProject.Tests [12/21/2017 2:13:00 PM Informational] ========== Run test finished: 1 run (0:01:04.7057513) ==========

I directly set Configuration.Modules.AspNetZero().LicenseCode to my licence key, and then its working fine. So main issue is with configuration["AbpZeroLicenseCode"], configuration["AbpZeroLicenseCode"] return null.

I observed that configuration["AbpZeroLicenseCode"] returns null in MyProjectTestModule file.

So, I tried with temp variable.

var temp = configuration["AbpZeroLicenseCode"];
Configuration.Modules.AspNetZero().LicenseCode = temp;

I already have AbpZeroLicenseCode in appsettings.json file.

{
  "AbpZeroLicenseCode": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}

Yes, Issue comes back once undo the changes.

Please help

Hi @aaron,

I uninstalled Abp.AspNetZeroCore.dll from MyCompany.MyProject.Core Project and removed dependancy typeof(AbpAspNetZeroCoreModule) from MyProjectCoreModule.

Made the below change as well.

public override void PostInitialize()
        {
            IocManager.RegisterIfNot<IChatCommunicator, NullChatCommunicator>();

            IocManager.Resolve<ChatUserStateWatcher>().Initialize();
            IocManager.Resolve<MyCompany.MyProject.TimingAppTimes>().StartupTime = Clock.Now;
        }

Its working fine for me.

So please let me know is this right approach? Does it break anything else in the application? Or do I need to make changes in other places?

Showing 101 to 110 of 199 entries