System.NullReferenceException

Object reference not set to an instance of an object.

Exception source: App_Web_ijpkjcay

Exception string:

System.NullReferenceException: Object reference not set to an instance of an object. at Controls_Portals_2_usercontrols_gallery_gallerydetails.loadProduct(String Id) in D:\Websites\Caracole\Staging\Portal\controls\portals\2\usercontrols\gallery\gallerydetails.ascx.vb:line 250 at Controls_Portals_2_usercontrols_gallery_gallerydetails.Page_Load(Object sender, EventArgs e) in D:\Websites\Caracole\Staging\Portal\controls\portals\2\usercontrols\gallery\gallerydetails.ascx.vb:line 20 at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

Object reference not set to an instance of an object.

Server Error in '/' Application.

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.

Source Error:


Line 248:        Dim product As Caracole.Business.Data.Product = query.FirstOrDefault()
Line 249:
Line 250:        Dim _sku As String = product.Number
Line 251:        If _sku.Contains("CALBED") Then
Line 252:            _sku = _sku.Replace("CALBED", "KINBED")

Source File: D:\Websites\Caracole\Staging\Portal\controls\portals\2\usercontrols\gallery\gallerydetails.ascx.vb    Line: 250

Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
   Controls_Portals_2_usercontrols_gallery_gallerydetails.loadProduct(String Id) in D:\Websites\Caracole\Staging\Portal\controls\portals\2\usercontrols\gallery\gallerydetails.ascx.vb:250
   Controls_Portals_2_usercontrols_gallery_gallerydetails.Page_Load(Object sender, EventArgs e) in D:\Websites\Caracole\Staging\Portal\controls\portals\2\usercontrols\gallery\gallerydetails.ascx.vb:20
   System.Web.UI.Control.OnLoad(EventArgs e) +108
   System.Web.UI.Control.LoadRecursive() +67
   System.Web.UI.Control.LoadRecursive() +164
   System.Web.UI.Control.LoadRecursive() +164
   System.Web.UI.Control.LoadRecursive() +164
   System.Web.UI.Control.LoadRecursive() +164
   System.Web.UI.Control.LoadRecursive() +164
   System.Web.UI.Control.LoadRecursive() +164
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3320