You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a package that execute some code when i add the Attribute to a function, it work normally when i execute the project normally, but in the tests i am getting the error:
Outcome: Failed
Error Message:
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at MyProject.DataAnnotations.ExecuteBeforeAttribute.Advise(MethodAsyncAdviceContext context)
at ArxOne.MrAdvice.Utility.ExceptionExtensions.Rethrow(Exception exception)
at ArxOne.MrAdvice.Invocation.GetResult(Task advisedTask, AdviceValues adviceValues)
at ArxOne.MrAdvice.Invocation.<>c__DisplayClass4_0.b__0(Task t)
at ArxOne.MrAdvice.Threading.TaskContinuer1.<>c__DisplayClass0_01.b__0(Task t)
at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
My class in the package
using System;
using System.Diagnostics;
using System.Reflection;
using System.Threading.Tasks;
using ArxOne.MrAdvice.Advice;
using Microsoft.Extensions.Logging;
namespace MyProject.DataAnnotations;
[AttributeUsage(AttributeTargets.Method, Inherited = true, AllowMultiple = false)]
public class ExecuteBeforeAttribute(string? description = null) : Attribute, IMethodAsyncAdvice
{
public string? Description { get; set; } = description;
public async Task Advise(MethodAsyncAdviceContext context)
{
//Execute my operations
await context.ProceedAsync();
}
}
The text was updated successfully, but these errors were encountered:
I changed the function, it still works normally when i run the app, but when my class with the attribute is called from the tests thats the error im getting
Identity.Infrastructure.Services.Tests.ServiceTests.CreateUser_DeveRetornarResponseComErro_QuandoFalhar:
Outcome: Failed
Error Message:
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at MyProject.DataAnnotations.WithActivitynewAttribute.Advise(MethodAsyncAdviceContext context) in /home/krummris/Documents/github/MyProject-sdk-develop/MyProject/DataAnnotations/WithActivityAttribute.cs:line 23
at ArxOne.MrAdvice.Advice.MethodAsyncAdviceContext.Invoke()
at ArxOne.MrAdvice.Invocation.ProceedAdvice2(Object target, Object[] parameters, RuntimeMethodHandle methodHandle, RuntimeMethodHandle innerMethodHandle, RuntimeMethodHandle delegatableMethodHandle, RuntimeTypeHandle typeHandle, Boolean abstractedTarget, Type[] genericArguments)
at ArxOne.MrAdvice.⚡Invocation.ProceedAspect(Object[], RuntimeMethodHandle, RuntimeMethodHandle, RuntimeMethodHandle)
at Identity.Infraestructure.Services.Service.CreateUser(User user)
at Identity.Infrastructure.Services.Tests.ServiceTests.CreateUser_DeveRetornarResponseComErro_QuandoFalhar() in /home/krummris/Documents/github/identity-sdk/Identity.UnitTests/Infraestructure/Services/ServiceTests.cs:line 63
--- End of stack trace from previous location ---
I have a package that execute some code when i add the Attribute to a function, it work normally when i execute the project normally, but in the tests i am getting the error:
Outcome: Failed
Error Message:
System.NullReferenceException : Object reference not set to an instance of an object.
Stack Trace:
at MyProject.DataAnnotations.ExecuteBeforeAttribute.Advise(MethodAsyncAdviceContext context)
at ArxOne.MrAdvice.Utility.ExceptionExtensions.Rethrow(Exception exception)
at ArxOne.MrAdvice.Invocation.GetResult(Task advisedTask, AdviceValues adviceValues)
at ArxOne.MrAdvice.Invocation.<>c__DisplayClass4_0.b__0(Task t)
at ArxOne.MrAdvice.Threading.TaskContinuer
1.<>c__DisplayClass0_0
1.b__0(Task t)at System.Threading.Tasks.ContinuationResultTaskFromTask`1.InnerInvoke()
at System.Threading.ExecutionContext.RunFromThreadPoolDispatchLoop(Thread threadPoolThread, ExecutionContext executionContext, ContextCallback callback, Object state)
My class in the package
The text was updated successfully, but these errors were encountered: