System.NullReferenceException Error
System.NullReferenceException Error
I'm getting the following error when trying to access my site:
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Here's the Stack Trace:
NullReferenceException: Object reference not set to an instance of an object.]
CommerceBuilder.Taxes.TaxCalculator.Calculate(Basket basket) +63
CommerceBuilder.Orders.Basket.Recalculate() +54
ConLib_MiniBasket.Page_PreRender(Object sender, EventArgs e) +52
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnPreRender(EventArgs e) +2066972
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal() +62
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
Here's the weird part: Multiple machines on the same network. One accesses just fine, the others (including a Mac) get the error. I've looked at the connection string every way I can think of and I can't figure out why it comes up on one but not the others.
Any ideas?
Thanks!
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Here's the Stack Trace:
NullReferenceException: Object reference not set to an instance of an object.]
CommerceBuilder.Taxes.TaxCalculator.Calculate(Basket basket) +63
CommerceBuilder.Orders.Basket.Recalculate() +54
ConLib_MiniBasket.Page_PreRender(Object sender, EventArgs e) +52
System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +34
System.Web.UI.Control.OnPreRender(EventArgs e) +2066972
System.Web.UI.Control.PreRenderRecursiveInternal() +77
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.WebControls.WebParts.WebPart.PreRenderRecursiveInternal() +62
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Control.PreRenderRecursiveInternal() +161
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1360
Here's the weird part: Multiple machines on the same network. One accesses just fine, the others (including a Mac) get the error. I've looked at the connection string every way I can think of and I can't figure out why it comes up on one but not the others.
Any ideas?
Thanks!
Re: System.NullReferenceException Error
UPDATE:
Got home, tried to access the site, same error. Then I went to the site IP address/Admin. Came up no problem, logged in, and was able to view the store. What would make that error intermittent?
Got home, tried to access the site, same error. Then I went to the site IP address/Admin. Came up no problem, logged in, and was able to view the store. What would make that error intermittent?
Re: System.NullReferenceException Error
UPDATE #2:
When I go to ipaddress/Admin the login page comes up. If I then go to the Default page WITHOUT LOGGING IN the site comes up.
When I go to ipaddress/Admin the login page comes up. If I then go to the Default page WITHOUT LOGGING IN the site comes up.
Re: System.NullReferenceException Error
Hello,
Can you please post information from Help->About on which version and build number you are using?
Also please let me know if there are any customizations you have made.
Can you also please describe the setup of your taxes?
Can you reproduce the problem with an anonymous user?
Can you reproduce this when you register as a new user?
Do you reproduce this when you use login using an existing user account?
Can you please post information from Help->About on which version and build number you are using?
Also please let me know if there are any customizations you have made.
Can you also please describe the setup of your taxes?
Can you reproduce the problem with an anonymous user?
Can you reproduce this when you register as a new user?
Do you reproduce this when you use login using an existing user account?
Re: System.NullReferenceException Error
Here's the version info:
PLATFORM: ASP.NET
VERSION: 7.1
BUILD: 10875
AjaxControlToolkit: 1.0.10301.0
CommerceBuilder: 7.0.10576.0
CommerceBuilder.AbleCommerceTax: 7.1.0.0
CommerceBuilder.AustraliaPost: 7.1.0.0
CommerceBuilder.AuthorizeNet: 7.0.9764.0
CommerceBuilder.CanadaPost: 7.0.0.0
CommerceBuilder.CCH: 7.0.0.0
CommerceBuilder.Configuration: 7.0.10576.0
CommerceBuilder.CyberSource: 7.0.9764.0
CommerceBuilder.DataClient.Api: 1.0.0.21
CommerceBuilder.DataClient.Csv: 1.0.0.0
CommerceBuilder.DHL: 7.0.8825.0
CommerceBuilder.DHLInternational: 7.1.0.0
CommerceBuilder.ECB: 7.0.0.0
CommerceBuilder.FedEx: 7.0.9725.0
CommerceBuilder.FRBNY: 7.0.0.0
CommerceBuilder.GoogleCheckout: 7.0.10052.0
CommerceBuilder.InternetSecure: 7.0.9764.0
CommerceBuilder.LinkPoint: 7.0.9764.0
CommerceBuilder.Paradata: 7.0.9764.0
CommerceBuilder.PayFlowPro: 7.0.10061.0
CommerceBuilder.PayJunction: 7.0.9764.0
CommerceBuilder.PayPal: 7.1.10840.0
CommerceBuilder.Protx: 7.1.10124.0
CommerceBuilder.Services: 7.0.10576.0
CommerceBuilder.SkipJack: 7.0.9764.0
CommerceBuilder.UPS: 7.0.10041.0
CommerceBuilder.USPS: 7.0.9728.0
CommerceBuilder.Web: 7.0.10576.0
ComponentArt.Web.UI: 2007.1.1566.3
CyberSource.Base: 2.0.0.0
CyberSource.Clients: 5.0.2.0
CyberSource.Clients.XmlSerializers: 5.0.2.0
CyberSource.WSSecurity: 2.0.0.0
CybsWSSecurityIOP: 1.0.0.0
edtFTPnet: 1.2.4.0
FredCK.FCKeditorV2: 2.5.2912.21007
ICSharpCode.SharpZipLib: 0.85.5.452
LinkPointTransaction: 1.0.1797.29766
log4net: 1.2.10.0
Microsoft.Practices.EnterpriseLibrary.Common: 2.0.0.0
Microsoft.Practices.EnterpriseLibrary.Data: 2.0.0.0
Microsoft.Practices.ObjectBuilder: 1.0.51205.0
Microsoft.Web.Preview: 1.2.61025.0
NVelocity: 7.0.8530.0
PaygatewayNET: 3.0.0.0
paypal_base: 4.2.1.0
PFProCOMLib: 1.0.0.0
PFProdotNET: 0.0.0.0
Validators: 1.0.0.0
WebChart: 1.1.1.6
wwHoverPanel: 1.85.0.0
No taxes are set up yet.
I have not tried to reproduce the error as an anonymous or new user.
I have only logged in as admin, which does not produce the error.
Thanks!
PLATFORM: ASP.NET
VERSION: 7.1
BUILD: 10875
AjaxControlToolkit: 1.0.10301.0
CommerceBuilder: 7.0.10576.0
CommerceBuilder.AbleCommerceTax: 7.1.0.0
CommerceBuilder.AustraliaPost: 7.1.0.0
CommerceBuilder.AuthorizeNet: 7.0.9764.0
CommerceBuilder.CanadaPost: 7.0.0.0
CommerceBuilder.CCH: 7.0.0.0
CommerceBuilder.Configuration: 7.0.10576.0
CommerceBuilder.CyberSource: 7.0.9764.0
CommerceBuilder.DataClient.Api: 1.0.0.21
CommerceBuilder.DataClient.Csv: 1.0.0.0
CommerceBuilder.DHL: 7.0.8825.0
CommerceBuilder.DHLInternational: 7.1.0.0
CommerceBuilder.ECB: 7.0.0.0
CommerceBuilder.FedEx: 7.0.9725.0
CommerceBuilder.FRBNY: 7.0.0.0
CommerceBuilder.GoogleCheckout: 7.0.10052.0
CommerceBuilder.InternetSecure: 7.0.9764.0
CommerceBuilder.LinkPoint: 7.0.9764.0
CommerceBuilder.Paradata: 7.0.9764.0
CommerceBuilder.PayFlowPro: 7.0.10061.0
CommerceBuilder.PayJunction: 7.0.9764.0
CommerceBuilder.PayPal: 7.1.10840.0
CommerceBuilder.Protx: 7.1.10124.0
CommerceBuilder.Services: 7.0.10576.0
CommerceBuilder.SkipJack: 7.0.9764.0
CommerceBuilder.UPS: 7.0.10041.0
CommerceBuilder.USPS: 7.0.9728.0
CommerceBuilder.Web: 7.0.10576.0
ComponentArt.Web.UI: 2007.1.1566.3
CyberSource.Base: 2.0.0.0
CyberSource.Clients: 5.0.2.0
CyberSource.Clients.XmlSerializers: 5.0.2.0
CyberSource.WSSecurity: 2.0.0.0
CybsWSSecurityIOP: 1.0.0.0
edtFTPnet: 1.2.4.0
FredCK.FCKeditorV2: 2.5.2912.21007
ICSharpCode.SharpZipLib: 0.85.5.452
LinkPointTransaction: 1.0.1797.29766
log4net: 1.2.10.0
Microsoft.Practices.EnterpriseLibrary.Common: 2.0.0.0
Microsoft.Practices.EnterpriseLibrary.Data: 2.0.0.0
Microsoft.Practices.ObjectBuilder: 1.0.51205.0
Microsoft.Web.Preview: 1.2.61025.0
NVelocity: 7.0.8530.0
PaygatewayNET: 3.0.0.0
paypal_base: 4.2.1.0
PFProCOMLib: 1.0.0.0
PFProdotNET: 0.0.0.0
Validators: 1.0.0.0
WebChart: 1.1.1.6
wwHoverPanel: 1.85.0.0
I have customized a few scriptlets and created some new ones, but modifications have been for layout and content only.Also please let me know if there are any customizations you have made.
Can you also please describe the setup of your taxes?
Can you reproduce the problem with an anonymous user?
Can you reproduce this when you register as a new user?
Do you reproduce this when you use login using an existing user account?
No taxes are set up yet.
I have not tried to reproduce the error as an anonymous or new user.
I have only logged in as admin, which does not produce the error.
Thanks!
Re: System.NullReferenceException Error
Are you still able to reproduce the bug in a situation?
When was the last time you were able to reproduce the bug?
Can you go to Configure->Taxes->Settings and let me know if you have taxes enabled or not?
When was the last time you were able to reproduce the bug?
Can you go to Configure->Taxes->Settings and let me know if you have taxes enabled or not?
Re: System.NullReferenceException Error
Taxes are enabled. I just reproduced the error this morning on a machine by doing the following:
Accessing http://myipaddress/Default.aspx, the error occurs.
Backspace over Default.aspx and typing Admin, I get the admin login screen.
Backspace over everything except http://myipaddress, I get the default site page.
Accessing http://myipaddress/Default.aspx, the error occurs.
Backspace over Default.aspx and typing Admin, I get the admin login screen.
Backspace over everything except http://myipaddress, I get the default site page.
Re: System.NullReferenceException Error
Seems to be session or cookie related. When I clear my browser cache, cookies, and authenticated sessions, the error returns. After reaching the admin page, I can navigate freely between the admin console and the default site with no error no matter if I log in or not.
-
- Ensign (ENS)
- Posts: 10
- Joined: Wed Nov 26, 2008 5:43 am
Re: System.NullReferenceException Error
We've had the same issue. After some painstaking going back through the revisions of the software to see what changes caused the error we came to the following conclusion:
It's putting the mini basket on the front page. When you log in under a browser that hasn't been to Able Commerce before with no Able cookies, it falls over on the basket recalculate. I think this is caused by the mini basket recalculating within the page Page_PreRender method before the cookies have been created. When the Token.Instance.User is requested it returns a user with an id of 0 with a somehow invalid basket. The invalid basket goes pop when it's recalculated.
Our fix to ConLib/MiniBasket.ascx.cs is as follows:
//BUILD THE BASKET ON PRERENDER SO THAT WE CAN ACCOUNT
//FOR ANY PRODUCTS ADDED DURING THE POSTBACK CYCLE
protected void Page_PreRender(object sender, System.EventArgs e)
{
//PREPARE BASKET FOR DISPLAY
//**EGGHEAD**
if (Token.Instance.User.UserId != 0)
{
//**EGGHEAD**
Basket basket = Token.Instance.User.Basket;
basket.Package(true);
basket.Recalculate();
//VALIDATE THE BASKET
List<string> basketMessages = new List<string>();
bool basketValid = basket.Validate(out basketMessages);
//DISPLAY ANY WARNING MESSAGES
if (!basketValid)
{
Session["BasketMessage"] = basketMessages;
//Redirect to basket page where these error messages will be displayed
Response.Redirect("~/Basket.aspx");
}
BindBasket(basket);
//**EGGHEAD**
}
else
ShowBasket(false);
//**EGGHEAD**
}
It's putting the mini basket on the front page. When you log in under a browser that hasn't been to Able Commerce before with no Able cookies, it falls over on the basket recalculate. I think this is caused by the mini basket recalculating within the page Page_PreRender method before the cookies have been created. When the Token.Instance.User is requested it returns a user with an id of 0 with a somehow invalid basket. The invalid basket goes pop when it's recalculated.
Our fix to ConLib/MiniBasket.ascx.cs is as follows:
//BUILD THE BASKET ON PRERENDER SO THAT WE CAN ACCOUNT
//FOR ANY PRODUCTS ADDED DURING THE POSTBACK CYCLE
protected void Page_PreRender(object sender, System.EventArgs e)
{
//PREPARE BASKET FOR DISPLAY
//**EGGHEAD**
if (Token.Instance.User.UserId != 0)
{
//**EGGHEAD**
Basket basket = Token.Instance.User.Basket;
basket.Package(true);
basket.Recalculate();
//VALIDATE THE BASKET
List<string> basketMessages = new List<string>();
bool basketValid = basket.Validate(out basketMessages);
//DISPLAY ANY WARNING MESSAGES
if (!basketValid)
{
Session["BasketMessage"] = basketMessages;
//Redirect to basket page where these error messages will be displayed
Response.Redirect("~/Basket.aspx");
}
BindBasket(basket);
//**EGGHEAD**
}
else
ShowBasket(false);
//**EGGHEAD**
}
-
- Lieutenant (LT)
- Posts: 78
- Joined: Wed Mar 05, 2008 11:27 am
Re: System.NullReferenceException Error
I got the same error today after deleting all the demo products and importing my products via a custom SQL script. When I add a product to the basket I get the following error message:
{"Object reference not set to an instance of an object."}
I fired up another browser and did the same thing and I didn't receive an error. This is definitely session/cookie related. I am running:
PLATFORM: ASP.NET
VERSION: 7.0.2
BUILD: 11659
Has this bug been fixed or did I forget to call something after importing my products?
{"Object reference not set to an instance of an object."}
I fired up another browser and did the same thing and I didn't receive an error. This is definitely session/cookie related. I am running:
PLATFORM: ASP.NET
VERSION: 7.0.2
BUILD: 11659
Has this bug been fixed or did I forget to call something after importing my products?