Base solution for your next web application
Open Closed

Create method on app service not working! #3370


User avatar
0
exlnt created

I have created a very basic create method for a new entity in my solution. It follows the same pattern as many of the other ones I have created. Yet it keeps failing with a validation error. I also cannot get the VS2017 debugger to hit or stop on the app service method. When I run the code in debug, you can clearly see that call to the app service is being executed, as the validation error comes back from the app service method.

Here is the chrome console showing the values being passed to the app service create method call. <a class="postlink" href="https://drive.google.com/file/d/0B5HAoiVVXzY7NTRYb1Y3UGhMZ0E/view?usp=sharing">https://drive.google.com/file/d/0B5HAoi ... sp=sharing</a>

Here is the chrome console showing the result of the app service call and validation error. <a class="postlink" href="https://drive.google.com/file/d/0B5HAoiVVXzY7MWFwdHFsMlpId1k/view?usp=sharing">https://drive.google.com/file/d/0B5HAoi ... sp=sharing</a>

As you can see the property listed in the validation message is clearly getting passed to the app service method. Yet it keeps reporting that field is missing?

Here is my CreateInput DTO. <a class="postlink" href="https://drive.google.com/file/d/0B5HAoiVVXzY7Z3NiTmsyTzc1RXM/view?usp=sharing">https://drive.google.com/file/d/0B5HAoi ... sp=sharing</a>

The log file in the application also shows the same error message. I have been debugging this for the past few days now and I, for the life of me, cannot figure out what I am missing here! Another really strange thing is how VS2017 debugger will not hit the breakpoints in the app service method. It acts as if the code is not even being executed. Yet the chrome console clearly shows the call is being made. One other note, I tested this app service method from the solution's swagger UI and it works perfectly from there!

WARN  2017-06-10 15:34:06,818 [7    ] nHandling.AbpApiExceptionFilterAttribute - Method arguments are not valid! See ValidationErrors for details.
Abp.Runtime.Validation.AbpValidationException: Method arguments are not valid! See ValidationErrors for details.
   at Abp.Runtime.Validation.Interception.MethodInvocationValidator.Validate() in D:\Github\aspnetboilerplate\src\Abp\Runtime\Validation\Interception\MethodInvocationValidator.cs:line 94
   at Abp.Runtime.Validation.Interception.ValidationInterceptor.Intercept(IInvocation invocation) in D:\Github\aspnetboilerplate\src\Abp\Runtime\Validation\Interception\ValidationInterceptor.cs:line 31
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.NurseHomeFundingComboAppServiceProxy.CreateNurseHomeFundingCombo(CreateNurseHomeFundingComboInput input)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at Abp.WebApi.Controllers.Dynamic.Interceptors.AbpDynamicApiControllerInterceptor`1.Intercept(IInvocation invocation) in D:\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Controllers\Dynamic\Interceptors\AbpDynamicApiControllerInterceptor.cs:line 44
   at Castle.DynamicProxy.AbstractInvocation.Proceed()
   at Castle.Proxies.DynamicApiController`1Proxy_7.CreateNurseHomeFundingCombo(CreateNurseHomeFundingComboInput input)
   at lambda_method(Closure , Object , Object[] )
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass12.<GetExecutor>b__8(Object instance, Object[] methodParameters)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.Execute(Object instance, Object[] arguments)
   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ApiControllerActionInvoker.&lt;InvokeActionAsyncCore&gt;d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.WebApi.Uow.AbpApiUowFilter.&lt;ExecuteActionFilterAsync&gt;d__5.MoveNext() in D:\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Uow\AbpApiUowFilter.cs:line 40
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.WebApi.Validation.AbpApiValidationFilter.&lt;ExecuteActionFilterAsync&gt;d__5.MoveNext() in D:\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Validation\AbpApiValidationFilter.cs:line 40
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.WebApi.Auditing.AbpApiAuditFilter.&lt;ExecuteActionFilterAsync&gt;d__4.MoveNext() in D:\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Auditing\AbpApiAuditFilter.cs:line 30
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ActionFilterResult.&lt;ExecuteAsync&gt;d__2.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.WebApi.Security.AntiForgery.AbpAntiForgeryApiFilter.&lt;ExecuteAuthorizationFilterAsync&gt;d__10.MoveNext() in D:\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Security\AntiForgery\AbpAntiForgeryApiFilter.cs:line 59
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at Abp.WebApi.Authorization.AbpApiAuthorizeFilter.&lt;ExecuteAuthorizationFilterAsync&gt;d__7.MoveNext() in D:\Github\aspnetboilerplate\src\Abp.Web.Api\WebApi\Authorization\AbpApiAuthorizeFilter.cs:line 63
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.AuthenticationFilterResult.&lt;ExecuteAsync&gt;d__0.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Web.Http.Controllers.ExceptionFilterResult.&lt;ExecuteAsync&gt;d__0.MoveNext()
WARN  2017-06-10 15:34:06,826 [7    ] nHandling.AbpApiExceptionFilterAttribute - There are 1 validation errors:
WARN  2017-06-10 15:34:06,826 [7    ] nHandling.AbpApiExceptionFilterAttribute - The FundingComboName field is required. (FundingComboName)

3 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @exlnt,

    If there is a model validation error, your app service method is not called, that is why debugger will not hit the breakpoint. You can try to call your service like this.

    _comboService.createNurseHomeFundingCombo(fsc)
    

    or

    _comboService.createNurseHomeFundingCombo(fsc.fsc)
    

    If those does not work, please share your app service method definition as well.

    Thanks.

  • User Avatar
    0
    exlnt created

    Amazing, that simple change worked!!

    function CreateFundingSourceCombo(fsc, FSCAdd) {    
        var _comboService = abp.services.app.nurseHomeFundingCombo;
        _comboService.createNurseHomeFundingCombo(fsc)
            .done(function (result) {
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Great :).