PayPal payment completed but order not created due to FormatException in Login.cshtml
Smartstore Version: 5.1.0
Describe the bug
A customer completed a PayPal payment successfully (money was debited from their PayPal account), but no corresponding order was created in the Smartstore backend. The order is either missing entirely or was never persisted.
The application log from the same time shows a System.FormatException in Views/Identity/Login.cshtml (line 96), caused by the BooleanConverter failing to parse the string "1" as a valid Boolean value. This exception is thrown during checkbox rendering (GenerateCheckBox) via SmartHtmlGenerator.GenerateInput.
It appears that the FormatException crashes the request that processes the PayPal return/callback, which prevents the OrderProcessingService from finalizing the order.
Steps to reproduce
- Add a product to the cart
- Proceed to checkout and select PayPal as payment method
- Complete payment on PayPal side
- Get redirected back to the shop
- The redirect triggers a request that renders
Login.cshtml, where a checkbox field (likely "Remember me") receives the value "1" instead of "true" in ModelState
FormatException is thrown → order processing is interrupted
- Payment is completed on PayPal's side, but no order exists in Smartstore
Expected behavior
- The
FormatException should not occur — SmartHtmlGenerator should handle non-standard boolean values like "1" and "0" gracefully (this is a known ASP.NET Core issue: dotnet/aspnetcore#55512)
- Even if an exception occurs during page rendering, the PayPal order finalization (via webhook or return URL callback) should not be affected by unrelated view rendering errors
- The order should be created and persisted regardless of non-critical UI errors
Stack trace
System.FormatException: 1 is not a valid value for Boolean.
---> System.FormatException: String '1' was not recognized as a valid Boolean.
at System.Boolean.Parse(ReadOnlySpan`1 value)
at System.ComponentModel.BooleanConverter.ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, Object value)
--- End of inner exception stack trace ---
at System.ComponentModel.BooleanConverter.ConvertFrom(...)
at Microsoft.AspNetCore.Mvc.ModelBinding.ModelBindingHelper.ConvertSimpleType(...)
at Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GetModelStateValue(...)
at Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GenerateInput(...)
at Smartstore.Web.Rendering.SmartHtmlGenerator.GenerateInput(...)
at Microsoft.AspNetCore.Mvc.ViewFeatures.DefaultHtmlGenerator.GenerateCheckBox(...)
at Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.GenerateCheckBox(...)
at Microsoft.AspNetCore.Mvc.TagHelpers.InputTagHelper.Process(...)
...
at AspNetCore.Views_Identity_Login.<ExecuteAsync>b__32_1()
in Views\Identity\Login.cshtml:line 96
(Full stack trace available upon request.)
Impact
- Customer was charged via PayPal but received no order confirmation
- The order does not appear in the Smartstore admin panel
- This likely affects any checkout flow where the PayPal return coincides with a request that renders a Boolean checkbox from
ModelState containing the value "1"
Suggested fix
- SmartHtmlGenerator: Override
GetModelStateValue or wrap the GenerateCheckBox call with a try-catch to handle FormatException gracefully — e.g., treat "1" as true and "0" as false
- PayPal module: Ensure that order finalization (capture confirmation / webhook processing) is decoupled from view rendering, so that a rendering error cannot prevent the order from being persisted
Related issues
Environment
- Smartstore version: 5.1.0
- Payment method: PayPal (via Smartstore PayPal module)
- Hosting: IIS (
C:\inetpub\wwwroot\...)
PayPal payment completed but order not created due to FormatException in Login.cshtml
Smartstore Version: 5.1.0
Describe the bug
A customer completed a PayPal payment successfully (money was debited from their PayPal account), but no corresponding order was created in the Smartstore backend. The order is either missing entirely or was never persisted.
The application log from the same time shows a
System.FormatExceptioninViews/Identity/Login.cshtml(line 96), caused by theBooleanConverterfailing to parse the string"1"as a valid Boolean value. This exception is thrown during checkbox rendering (GenerateCheckBox) viaSmartHtmlGenerator.GenerateInput.It appears that the FormatException crashes the request that processes the PayPal return/callback, which prevents the
OrderProcessingServicefrom finalizing the order.Steps to reproduce
Login.cshtml, where a checkbox field (likely "Remember me") receives the value"1"instead of"true"inModelStateFormatExceptionis thrown → order processing is interruptedExpected behavior
FormatExceptionshould not occur —SmartHtmlGeneratorshould handle non-standard boolean values like"1"and"0"gracefully (this is a known ASP.NET Core issue: dotnet/aspnetcore#55512)Stack trace
(Full stack trace available upon request.)
Impact
ModelStatecontaining the value"1"Suggested fix
GetModelStateValueor wrap theGenerateCheckBoxcall with a try-catch to handleFormatExceptiongracefully — e.g., treat"1"astrueand"0"asfalseRelated issues
GenerateCheckBoxGenerateCheckBoxthrows exception for unparseable URL parametersEnvironment
C:\inetpub\wwwroot\...)