dimasfauzan300
New member
- Joined
- Sep 29, 2021
- Messages
- 4
- Programming Experience
- 1-3
Im using ASP .NET MVC4, i got some error when i access controller Error Encountered an Invalid value, but I can't locate that error, please help me, thank you
Controller Code
C#:
Server Error in '/' Application.
Encountered an invalid type for a default value.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Encountered an invalid type for a default value.
Source Error:
[TABLE]
[TR]
[TD]An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.[/TD]
[/TR]
[/TABLE]
[B]Stack Trace:[/B]
[TABLE]
[TR]
[TD]
[FormatException: Encountered an invalid type for a default value.]
System.Reflection.MdConstant.GetValue(MetadataImport scope, Int32 token, RuntimeTypeHandle fieldTypeHandle, Boolean raw) +12405251
System.Reflection.RuntimeParameterInfo.GetDefaultValueInternal(Boolean raw) +151
System.Reflection.RuntimeParameterInfo.GetDefaultValue(Boolean raw) +32
System.Reflection.RuntimeParameterInfo.get_DefaultValue() +12
System.Web.Mvc.ParameterInfoUtil.TryGetDefaultValue(ParameterInfo parameterInfo, Object& value) +18
System.Web.Mvc.ReflectedParameterDescriptor.get_DefaultValue() +17
System.Web.Mvc.ControllerActionInvoker.GetParameterValue(ControllerContext controllerContext, ParameterDescriptor parameterDescriptor) +347
System.Web.Mvc.ControllerActionInvoker.GetParameterValues(ControllerContext controllerContext, ActionDescriptor actionDescriptor) +105
System.Web.Mvc.Async.<>c__DisplayClass21.<BeginInvokeAction>b__19(AsyncCallback asyncCallback, Object asyncState) +743
System.Web.Mvc.Async.WrappedAsyncResult`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +14
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
System.Web.Mvc.Async.AsyncControllerActionInvoker.BeginInvokeAction(ControllerContext controllerContext, String actionName, AsyncCallback callback, Object state) +343
System.Web.Mvc.Controller.<BeginExecuteCore>b__1c(AsyncCallback asyncCallback, Object asyncState, ExecuteCoreState innerState) +25
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
System.Web.Mvc.Controller.BeginExecuteCore(AsyncCallback callback, Object state) +465
System.Web.Mvc.Controller.<BeginExecute>b__14(AsyncCallback asyncCallback, Object callbackState, Controller controller) +18
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +20
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
System.Web.Mvc.Controller.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +374
System.Web.Mvc.Controller.System.Web.Mvc.Async.IAsyncController.BeginExecute(RequestContext requestContext, AsyncCallback callback, Object state) +16
System.Web.Mvc.MvcHandler.<BeginProcessRequest>b__4(AsyncCallback asyncCallback, Object asyncState, ProcessRequestState innerState) +52
System.Web.Mvc.Async.WrappedAsyncVoid`1.CallBeginDelegate(AsyncCallback callback, Object callbackState) +30
System.Web.Mvc.Async.WrappedAsyncResultBase`1.Begin(AsyncCallback callback, Object state, Int32 timeout) +128
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContextBase httpContext, AsyncCallback callback, Object state) +384
System.Web.Mvc.MvcHandler.BeginProcessRequest(HttpContext httpContext, AsyncCallback callback, Object state) +48
System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.BeginProcessRequest(HttpContext context, AsyncCallback cb, Object extraData) +16
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +105
System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step) +50
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +163
[/TD]
[/TR]
[/TABLE]
[HR][/HR]
[B]Version Information:[/B] Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.8.4330.0
Controller Code
C#:
[FilterConfig.CheckSessionTimeOut()]
[FilterConfig.CheckAuthorizationAttribute]
[HttpGet()]
public ActionResult Index()
{
return View(getAccess(HasAccessType.AccessType.FULL));
}
[HttpPost()]
//[ValidateAntiForgeryToken()]
//[FilterConfig.CheckSessionTimeOut()]
//[HasAccessType(HasAccessType.AccessType.READ)]
public ActionResult getBoSample(int page = 1, int size = 20, string cari = "", DateTime start = new DateTime(), DateTime end = new DateTime(), int filter = 1)
{
try
{
Pageable<BoSampleResponse> pageResponse = clsTrBoSampleCustomBL.findAll(page, size, cari, start, end, filter);
return Json(clsAPI.CreateResult(true, pageResponse, string.Empty, string.Empty));
}
catch (Exception e)
{
Response.StatusCode = (int)HttpStatusCode.BadRequest;
return Json(clsAPI.CreateError(e));
}
}
Last edited by a moderator: