cq-panda / Vue.NetCore

(已支持sqlsugar).NetCore、.Net6、Vue2、Vue3、Vite、TypeScript、Element plus+uniapp前后端分离,全自动生成代码;支持移动端(ios/android/h5/微信小程序。http://www.volcore.xyz/
MIT License
3.89k stars 1.27k forks source link

优化后的代码生成器del出现错误 #38

Open ajw333 opened 4 years ago

ajw333 commented 4 years ago

使用优化后的代码生成器 del 时 出现Exception has been thrown by the target of an invocation.System.NullReferenceException: Object reference not set to an instance of an object.↵ at VOL.Core.BaseProvider.ServiceBase2.Del(Object[] keys, Boolean delList) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/BaseProvider/ServiceBase.cs:line 896 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)↵ at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)↵ at VOL.Core.Controllers.Basic.BaseController1.InvokeService(String methodName, Object[] parameters) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Controllers/Basic/BaseController.cs:line 170↵ at VOL.Core.Controllers.Basic.BaseController1.<>c__DisplayClass19_0.<Del>b__0() in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Controllers/Basic/BaseController.cs:line 136↵ at System.Threading.Tasks.Task1.InnerInvoke()↵ at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)↵--- End of stack trace from previous location where exception was thrown ---↵ at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)↵--- End of stack trace from previous location where exception was thrown ---↵ at VOL.Core.Controllers.Basic.BaseController1.Del(Object[] keys) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Controllers/Basic/BaseController.cs:line 136↵ at VOL.Core.Controllers.Basic.ApiBaseController1.Del(Object[] keys) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Controllers/Basic/ApiBaseController.cs:line 110↵ at lambda_method(Closure , Object )↵ at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()↵ at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)↵ at System.Threading.Tasks.ValueTask`1.get_Result()↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()↵ at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)↵ at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)↵ at VOL.Core.Middleware.ExceptionHandlerMiddleWare.Invoke(HttpContext context) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Middleware/ExceptionHandlerMiddleWare.cs:line 26

cq-panda commented 4 years ago

获取下最新代码,还是异常的话,麻烦提供下是具体哪个页面的功能,谢谢

------------------ 原始邮件 ------------------ 发件人: "ajw333"<notifications@github.com>; 发送时间: 2019年11月21日(星期四) 下午5:55 收件人: "cq-panda/Vue.NetCore"<Vue.NetCore@noreply.github.com>; 抄送: "Subscribed"<subscribed@noreply.github.com>; 主题: [cq-panda/Vue.NetCore] 优化后的代码生成器del出现错误 (#38)

使用优化后的代码生成器 del 时 出现Exception has been thrown by the target of an invocation.System.NullReferenceException: Object reference not set to an instance of an object.↵ at VOL.Core.BaseProvider.ServiceBase2.Del(Object[] keys, Boolean delList) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/BaseProvider/ServiceBase.cs:line 896 at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)↵ at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)↵ at VOL.Core.Controllers.Basic.BaseController1.InvokeService(String methodName, Object[] parameters) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Controllers/Basic/BaseController.cs:line 170↵ at VOL.Core.Controllers.Basic.BaseController1.<>c__DisplayClass19_0.<Del>b__0() in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Controllers/Basic/BaseController.cs:line 136↵ at System.Threading.Tasks.Task1.InnerInvoke()↵ at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)↵--- End of stack trace from previous location where exception was thrown ---↵ at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot)↵--- End of stack trace from previous location where exception was thrown ---↵ at VOL.Core.Controllers.Basic.BaseController1.Del(Object[] keys) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Controllers/Basic/BaseController.cs:line 136↵ at VOL.Core.Controllers.Basic.ApiBaseController1.Del(Object[] keys) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Controllers/Basic/ApiBaseController.cs:line 110↵ at lambda_method(Closure , Object )↵ at Microsoft.Extensions.Internal.ObjectMethodExecutorAwaitable.Awaiter.GetResult()↵ at Microsoft.AspNetCore.Mvc.Internal.ActionMethodExecutor.TaskOfActionResultExecutor.Execute(IActionResultTypeMapper mapper, ObjectMethodExecutor executor, Object controller, Object[] arguments)↵ at System.Threading.Tasks.ValueTask`1.get_Result()↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeActionMethodAsync()↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeNextActionFilterAsync()↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Rethrow(ActionExecutedContext context)↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)↵ at Microsoft.AspNetCore.Mvc.Internal.ControllerActionInvoker.InvokeInnerFilterAsync()↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeNextResourceFilter()↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Rethrow(ResourceExecutedContext context)↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.Next(State& next, Scope& scope, Object& state, Boolean& isCompleted)↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeFilterPipelineAsync()↵ at Microsoft.AspNetCore.Mvc.Internal.ResourceInvoker.InvokeAsync()↵ at Microsoft.AspNetCore.Builder.RouterMiddleware.Invoke(HttpContext httpContext)↵ at Microsoft.AspNetCore.Cors.Infrastructure.CorsMiddleware.InvokeCore(HttpContext context)↵ at VOL.Core.Middleware.ExceptionHandlerMiddleWare.Invoke(HttpContext context) in /Users/admin/Documents/Vue.NetCore/Vue.Net2.23/VOL.Core/Middleware/ExceptionHandlerMiddleWare.cs:line 26

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

ajw333 commented 4 years ago

已经使用最新的代码了,具体是用代码生成器生成的一个含有导入,保存 ,新建,删除功能的页面,保存和新建,导入,导出的功能都能正常使用,就删除功能出现上面的错误

ajw333 commented 4 years ago

代码生成器未优化前,生成的代码以上功能都正常

cq-panda commented 4 years ago

你在ServiceBase.cs 中调试下方法Del看下具体是哪个值为null,谢谢

ajw333 commented 4 years ago

调试这句Type detailType = entityType.GetCustomAttribute().DetailTable?[0];时,时间长,获取不了信息。

cq-panda commented 4 years ago

你使用的是主从关系吗?是的话把主表的model截下图我看下,谢谢

ajw333 commented 4 years ago

不是

ajw333 commented 4 years ago

就一个表

ajw333 commented 4 years ago

直接跨过这一句调试就出现了上面的错误

cq-panda commented 4 years ago

非常感谢,获取下后台代码,点下生成model(不生成也行)

ajw333 commented 4 years ago

好的

ajw333 commented 4 years ago

以上问题解决 ,现在就是点击生成业务类代码第一次点击时出现xhr.js:172 OPTIONS http://127.0.0.1:9991/api/builder/CreateServices?tableName=Sys_Nr&nameSpace=VOL.System&foldername=Zhengming net::ERR_CONNECTION_REFUSED coder:1 Uncaught (in promise) 网络好像出了点问题~~ 的错误,第二次点击或者多点击又正常了

cq-panda commented 4 years ago

image 这个代码生成页面上有介绍这个,常见问题也有描述

ajw333 commented 4 years ago