csharp-web icon indicating copy to clipboard operation
csharp-web copied to clipboard

Error when parse to required type in function action declaration is not successful

Open p-dim-popov opened this issue 5 years ago • 0 comments

Action is:

public HttpResponse Create(int range, ...)
{ ...

Test situation is: image

Exception is:

System.FormatException: Input string was not in a correct format.
   at System.Number.ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type)
   at System.String.System.IConvertible.ToInt32(IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType, IFormatProvider provider)
   at System.Convert.ChangeType(Object value, Type conversionType)
   at SUS.MvcFramework.Host.ExecuteAction(HttpRequest request, Type controllerType, MethodInfo action, IServiceCollection serviceCollection) in C:\fakepath\SUS.MvcFramework\Host.cs:line 95
   at SUS.MvcFramework.Host.<>c__DisplayClass1_2.<AutoRegisterRoutes>b__3(HttpRequest request) in C:\fakepath\SUS.MvcFramework\Host.cs:line 70
   at SUS.HTTP.HttpServer.ProcessClientAsync(TcpClient tcpClient) in C:\fakepath\SUS.HTTP\HttpServer.cs:line 73

Probably should be set to default instead of throwing exception and resulting to: image

p-dim-popov avatar Oct 18 '20 13:10 p-dim-popov