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
When you call a command with wrong AggregateRootId (I mean doesn't exists in the EventSource database), an exception of System.Reflection.TargetException occures.
Here is the problem :
Stack trace at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Ncqrs.Commanding.CommandExecution.Mapping.Attributes.MapsToAggregateRootMethodAttributeHandler.<>c__DisplayClass3.b__0(AggregateRoot agg, ICommand cmd) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\Attributes\MapsToAggregateRootMethodAttributeHandler.cs:line 21
at Ncqrs.Commanding.CommandExecution.Mapping.UoWMappedCommandExecutor.UoWMappedCommandExecutorCallbacks.ExecuteActionOnExistingInstance(Func2 idCallback, Func2 typeCallback, Action2 action) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\UoWMappedCommandExecutor.cs:line 37 at Ncqrs.Commanding.CommandExecution.Mapping.Attributes.MapsToAggregateRootMethodAttributeHandler.<>c__DisplayClass3.<Map>b__2() in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\Attributes\MapsToAggregateRootMethodAttributeHandler.cs:line 24 at Ncqrs.Commanding.CommandExecution.Mapping.Attributes.MapsToAggregateRootMethodAttributeHandler.Map(MapsToAggregateRootMethodAttribute attribute, ICommand command, IMappedCommandExecutor executor) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\Attributes\MapsToAggregateRootMethodAttributeHandler.cs:line 33 at CallSite.Target(Closure , CallSite , Object , Object , ICommand , IMappedCommandExecutor ) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) at Ncqrs.Commanding.CommandExecution.Mapping.Attributes.AttributeBasedCommandMapper.Map(ICommand command, IMappedCommandExecutor executor) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\Attributes\AttributeBasedCommandMapper.cs:line 59 at Ncqrs.Commanding.CommandExecution.Mapping.UoWMappedCommandExecutor.ExecuteInContext(IUnitOfWorkContext context, ICommand command) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\UoWMappedCommandExecutor.cs:line 17 at Ncqrs.Commanding.CommandExecution.CommandExecutorBase1.Execute(TCommand command) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\CommandExecutorBase.cs:line 53
at Ncqrs.NServiceBus.NsbCommandService.b__0(ICommand x)
at Ncqrs.Commanding.ServiceModel.CommandService.Execute(ICommand command) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\ServiceModel\CommandService.cs:line 63
at Ncqrs.NServiceBus.NcqrsMessageHandler.Handle(CommandMessage message)
The problem begins in UoWMappedCommandExecutor class in the method (ExecuteActionOnExistingInstance)
in the following line: var aggRoot = _uow.GetById(type, id, _command.KnownVersion);
aggrRoot is null !! because the id passed value is wrong
so the next line : action(aggRoot, _command)
will fail.
it tooks me one hour to find out what the problem is.
The text was updated successfully, but these errors were encountered:
When you call a command with wrong AggregateRootId (I mean doesn't exists in the EventSource database), an exception of System.Reflection.TargetException occures.
Here is the problem :
Stack trace
at System.Reflection.RuntimeMethodInfo.CheckConsistency(Object target)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Ncqrs.Commanding.CommandExecution.Mapping.Attributes.MapsToAggregateRootMethodAttributeHandler.<>c__DisplayClass3.b__0(AggregateRoot agg, ICommand cmd) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\Attributes\MapsToAggregateRootMethodAttributeHandler.cs:line 21
at Ncqrs.Commanding.CommandExecution.Mapping.UoWMappedCommandExecutor.UoWMappedCommandExecutorCallbacks.ExecuteActionOnExistingInstance(Func
2 idCallback, Func
2 typeCallback, Action2 action) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\UoWMappedCommandExecutor.cs:line 37 at Ncqrs.Commanding.CommandExecution.Mapping.Attributes.MapsToAggregateRootMethodAttributeHandler.<>c__DisplayClass3.<Map>b__2() in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\Attributes\MapsToAggregateRootMethodAttributeHandler.cs:line 24 at Ncqrs.Commanding.CommandExecution.Mapping.Attributes.MapsToAggregateRootMethodAttributeHandler.Map(MapsToAggregateRootMethodAttribute attribute, ICommand command, IMappedCommandExecutor executor) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\Attributes\MapsToAggregateRootMethodAttributeHandler.cs:line 33 at CallSite.Target(Closure , CallSite , Object , Object , ICommand , IMappedCommandExecutor ) at System.Dynamic.UpdateDelegates.UpdateAndExecuteVoid4[T0,T1,T2,T3](CallSite site, T0 arg0, T1 arg1, T2 arg2, T3 arg3) at Ncqrs.Commanding.CommandExecution.Mapping.Attributes.AttributeBasedCommandMapper.Map(ICommand command, IMappedCommandExecutor executor) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\Attributes\AttributeBasedCommandMapper.cs:line 59 at Ncqrs.Commanding.CommandExecution.Mapping.UoWMappedCommandExecutor.ExecuteInContext(IUnitOfWorkContext context, ICommand command) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\Mapping\UoWMappedCommandExecutor.cs:line 17 at Ncqrs.Commanding.CommandExecution.CommandExecutorBase
1.Execute(TCommand command) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\CommandExecution\CommandExecutorBase.cs:line 53at Ncqrs.NServiceBus.NsbCommandService.b__0(ICommand x)
at Ncqrs.Commanding.ServiceModel.CommandService.Execute(ICommand command) in C:\Projects\ncqrs-ncqrs-ed26668\Framework\src\Ncqrs\Commanding\ServiceModel\CommandService.cs:line 63
at Ncqrs.NServiceBus.NcqrsMessageHandler.Handle(CommandMessage message)
The problem begins in UoWMappedCommandExecutor class in the method (ExecuteActionOnExistingInstance)
in the following line:
var aggRoot = _uow.GetById(type, id, _command.KnownVersion);
aggrRoot is null !! because the id passed value is wrong
so the next line :
action(aggRoot, _command)
will fail.
it tooks me one hour to find out what the problem is.
The text was updated successfully, but these errors were encountered: