logo
Welcome to our new AbleCommerce forums. As a guest, you may view the information here. To post to this forum, you must have a registered account with us, either as a new user evaluating AbleCommerce or an existing user of the application. For all questions related to the older version of Gold and earlier, please go to AbleCommerce Gold forum. Please use your AbleCommerce username and password to Login. New Registrations are disabled.

Notification

Icon
Error

Options
Go to last post Go to first unread
charles25686713  
#1 Posted : Monday, March 6, 2023 3:35:58 PM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
One of our users apparently just encountered an error in MyOrders. MyOrders works, as far as I know and in my testing, which tells me there may be bad data somewhere for this user. I don't see the userid listed here anywhere? Any ideas on how to solve this?

---
An error has occured [sic!] at /Members/MyOrders
Exception: Cannot convert null to 'bool' because it is a non-nullable value type Stack Trace: at CallSite.Target(Closure , CallSite , Object ) at ASP._Page_Views_Members__AccountSideMenu_cshtml.Execute() in \Views\Members\_AccountSideMenu.cshtml:line 62 at System.Web.WebPages.WebPageBase.ExecutePageHierarchy() at System.Web.Mvc.WebViewPage.ExecutePageHierarchy() at System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage) at System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilterRecursive(IList`1 filters, Int32 filterIndex, ResultExecutingContext preContext, ControllerContext controllerContext, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) at System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) at System.Web.Mvc.Controller.ExecuteCore() at System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) at System.Web.Mvc.Async.AsyncResultWrapper.<>c.<.cctor>b__15_0(IAsyncResult asyncResult, Action action) at System.Web.Mvc.Controller.EndExecute(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.<>c.<BeginProcessRequest>b__20_1(IAsyncResult asyncResult, ProcessRequestState innerState) at System.Web.Mvc.Async.AsyncResultWrapper.WrappedAsyncVoid`1.CallEndDelegate(IAsyncResult asyncResult) at System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.<>c__DisplayClass5_0.<Wrap>b__0() at System.Web.Mvc.HttpHandlerUtil.ServerExecuteHttpHandlerWrapper.Wrap[TResult](Func`1 func) at System.Web.HttpServerUtility.ExecuteInternal(IHttpHandler handler, TextWriter writer, Boolean preserveForm, Boolean setPreviousPage, VirtualPath path, VirtualPath filePath, String physPath, Exception error, String queryStringOverride)
---

Thanks,
Charles

Edited by user Tuesday, March 7, 2023 12:44:12 PM(UTC)  | Reason: Not specified

Wanna join the discussion?! Login to your AbleCommerce Forums forum account. New Registrations are disabled.

Joe Payne2  
#2 Posted : Tuesday, March 7, 2023 9:06:12 AM(UTC)
Joe Payne2

Rank: Advanced Member

Groups: HelpDesk, Developers
Joined: 11/9/2018(UTC)
Posts: 564

Thanks: 122 times
Was thanked: 26 time(s) in 25 post(s)
The line number is odd. Line 62 in that view would never throw that error.

Like 63 would, but not line 62. Is the file modified perhaps?

If the actual error is line 63, the problem is the ViewBag.ReviewsVisible value. That value only gets set if the user is a registered user. So if an anonymous user hits the /Members/MyOrders page, like a bot crawling the site, it's possible to see that error get thrown.

Or, someone checked out as guest and then accessed the Members area of the site. A guest shopper is not considered a 'registered' shopper. Do you have guest checkout enabled?
charles25686713  
#3 Posted : Tuesday, March 7, 2023 9:23:42 AM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Joe Payne2 Go to Quoted Post
The line number is odd. Line 62 in that view would never throw that error.

Like 63 would, but not line 62. Is the file modified perhaps?

If the actual error is line 63, the problem is the ViewBag.ReviewsVisible value. That value only gets set if the user is a registered user. So if an anonymous user hits the /Members/MyOrders page, like a bot crawling the site, it's possible to see that error get thrown.

Or, someone checked out as guest and then accessed the Members area of the site. A guest shopper is not considered a 'registered' shopper. Do you have guest checkout enabled?


Hi Joe, thanks for responding.

This file is not modified. Stock AC 9.0.7 file.

Guest checkout is not enabled.

I tried to access that page w/o being logged in, and I get redirected. If there's a way to access the page without being logged in, I don't know how to do it!

What code are you looking at? My MyOrders.cshtml file is only 5 lines long.

charles25686713  
#4 Posted : Tuesday, March 7, 2023 10:46:29 AM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
There's an entry in the log for MyWishList now as well, also at line 62.
Jay  
#5 Posted : Tuesday, March 7, 2023 11:49:38 AM(UTC)
Jay

Rank: Member

Groups: Authorized User, Developers
Joined: 11/12/2018(UTC)
Posts: 25

Thanks: 1 times
Was thanked: 4 time(s) in 3 post(s)
Quote:
What code are you looking at? My MyOrders.cshtml file is only 5 lines long.

If you look at the error message where it says line 62, it shows the file name also: \Views\Members\_AccountSideMenu.cshtml:line 62.

I would agree with Joe, it doesn't seem like 62 would post that error, but line 63 could. Here are line 62 and 63:
Code:
                classAttribute = activePage == "members/myproductreviews" || activePage == "members/editmyreview" ? "class=\"active\"" : "";
                if (ViewBag.ReviewsVisible == true)

The Members Controller (\Controllers\MembersController.cs) code for Account Side Menu only sets ViewBag.ReviewsVisible to true if the user is registered and reviews are enabled; otherwise, it is never set to anything. Therefore, if reviews are not enabled, it seems like ViewBag.ReviewsVisible would be returning null here, causing the error. But it seems like other merchants who don't have reviews enabled would be seeing the same errors and this would have been noticed and fixed before. Sorry, I know that's not a definitive answer, but maybe it is a clue.
charles25686713  
#6 Posted : Tuesday, March 7, 2023 11:56:08 AM(UTC)
charles25686713

Rank: Advanced Member

Groups: Authorized User, Developers
Joined: 7/1/2022(UTC)
Posts: 71

Thanks: 5 times
Was thanked: 1 time(s) in 1 post(s)
Originally Posted by: Jay Go to Quoted Post
Quote:
What code are you looking at? My MyOrders.cshtml file is only 5 lines long.

If you look at the error message where it says line 62, it shows the file name also: \Views\Members\_AccountSideMenu.cshtml:line 62.

I would agree with Joe, it doesn't seem like 62 would post that error, but line 63 could. Here are line 62 and 63:
Code:
                classAttribute = activePage == "members/myproductreviews" || activePage == "members/editmyreview" ? "class=\"active\"" : "";
                if (ViewBag.ReviewsVisible == true)

The Members Controller (\Controllers\MembersController.cs) code for Account Side Menu only sets ViewBag.ReviewsVisible to true if the user is registered and reviews are enabled; otherwise, it is never set to anything. Therefore, if reviews are not enabled, it seems like ViewBag.ReviewsVisible would be returning null here, causing the error. But it seems like other merchants who don't have reviews enabled would be seeing the same errors and this would have been noticed and fixed before. Sorry, I know that's not a definitive answer, but maybe it is a clue.


Thanks.

This is my code that has a problem!

Charles
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.