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.

Null exception in CacheBase

See original GitHub issue

Hi when i run my unit test as a batch the first unit-test works but the second one fail at the following line : response.Results = certificates.MapTo<List<PostResult>>();

with the following stack trace :

at Abp.Runtime.Caching.CacheBase.<GetAsync>d__19.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Runtime\Caching\CacheBase.cs:line 98 — End of stack trace from previous location where exception was thrown — at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Runtime.Caching.CacheExtensions.<GetAsync>d__52.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Runtime\Caching\CacheExtensions.cs:line 38 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Configuration.SettingManager.<GetUserSettingsFromCache>d__40.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Configuration\SettingManager.cs:line 430 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Configuration.SettingManager.<GetReadOnlyUserSettings>d__38.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Configuration\SettingManager.cs:line 403 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Configuration.SettingManager.<GetSettingValueForUserOrNullAsync>d__35.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Configuration\SettingManager.cs:line 373 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Abp.Configuration.SettingManager.<GetSettingValueInternalAsync>d__31.MoveNext() in D:\Github\aspnetboilerplate\src\Abp\Configuration\SettingManager.cs:line 235 --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task1 task) at System.Threading.Tasks.ContinuationResultTaskFromResultTask2.InnerInvoke() at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot) --- End of stack trace from previous location where exception was thrown --- at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Nito.AsyncEx.Synchronous.TaskExtensions.WaitAndUnwrapException[TResult](Task1 task) at Nito.AsyncEx.AsyncContext.Run[TResult](Func1 action) at Abp.AutoMapper.AutoMapExtensions.<>c__DisplayClass2_04.<CreateMultiLingualMap>b__0(TMultiLingualEntity source, TDestination destination, ResolutionContext context) in D:\Github\aspnetboilerplate\src\Abp.AutoMapper\AutoMapper\AutoMapExtensions.cs:line 54 at lambda_method(Closure , List1 , List1 , ResolutionContext )

I think it’s from the line : var defaultLanguage = multiLingualMapContext.SettingManager .GetSettingValue(LocalizationSettingNames.DefaultLanguage);

In the Automaper Extension file

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:17 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
FrancisGroleaucommented, Jul 30, 2018

I found out where my NullRef came from. In the AutoMaperExtension in the method CreateMultilingualMap in the BeforeMap there is a call to SettingManager.GetSettingValue() which end’s up calling the CacheBase GetAsync Method. And the method throw an error and it trys to log it but the Logger was null. :

            try
            {
                item = await GetOrDefaultAsync(key);
            }
            catch (Exception ex)
            {
                Logger.Error(ex.ToString(), ex);
            }

I’ve added this line to my Preinitialize method of my test module :

this.Configuration.ReplaceService<ILogger, NullLogger>(DependencyLifeStyle.Transient);

Read more comments on GitHub >

github_iconTop Results From Across the Web

InsertAsync throw NullReferenceException - .NET SDK
I have a NullReferenceException throw when I InsertAsync in my transaction, do you see something wrong ? using (var transaction = Transactions.
Read more >
c# - NullReferenceException inside Couchbase client 3.0 ...
I am working on migration from .NET SDK 2.7 to .NET SDK 3.0. Couchbase server 6.0. This code throws NullReferenceException . I can't...
Read more >
NullReferenceException Class (System)
The exception that is thrown when there is an attempt to dereference a null object reference.
Read more >
Null Pointer Exceptions during cache initializa...
Hi, I have created a test to demonstrate infinispan behavior when a new node joins an existing one, and we start using the...
Read more >
Null value Exception when Inserting to Cache
Hi Team,. I'm getting Object reference error when inserting to Cache. Though I'm setting InvoiceCust value , exception is thrown stating ...
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