Error after updating from 2.0 to 2.7 with catagory.cs

Nov 8, 2012 at 3:08 AM
Edited Nov 8, 2012 at 2:13 PM

I am attempting to upgrade to v2.7 from 2.0.  I downloaded the source code.  Upated my CE db and placed it in the source folder.  Updated the web.config file.  Built the solution and then went to view in browser.

I have attempted this using just the "standard" theme as well as my theme and get the same result.  I have tried many other test to see if I could identify the issue but I am at my limit.

Error is below.  Any thoughts?



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 361:        public string CompleteTitle()
Line 362:        {
Line 363:            return this.parent == null
Line 364:                       ? this.title
Line 365:                       : string.Format("{0} - {1}", GetCategory((Guid)this.parent).CompleteTitle(), this.title);

Source File: C:\Users\guy.nethery\Documents\Visual Studio 2010\Projects\BlogEngine2.7\BlogEngine\BlogEngine.Core\Category.cs    Line: 363

Stack Trace:

[NullReferenceException: Object reference not set to an instance of an object.]
   BlogEngine.Core.Category.CompleteTitle() in C:\Users\guy.nethery\Documents\Visual Studio 2010\Projects\BlogEngine2.7\BlogEngine\BlogEngine.Core\Category.cs:363
   BlogEngine.Core.Category.CompareTo(Category other) in C:\Users\guy.nethery\Documents\Visual Studio 2010\Projects\BlogEngine2.7\BlogEngine\BlogEngine.Core\Category.cs:399
   System.Collections.Generic.GenericArraySortHelper`1.InsertionSort(T[] keys, Int32 lo, Int32 hi) +165
   System.Collections.Generic.GenericArraySortHelper`1.IntroSort(T[] keys, Int32 lo, Int32 hi, Int32 depthLimit) +75
   System.Collections.Generic.GenericArraySortHelper`1.IntrospectiveSort(T[] keys, Int32 left, Int32 length) +51
   System.Collections.Generic.GenericArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) +76

[InvalidOperationException: Failed to compare two elements in the array.]
   System.Collections.Generic.GenericArraySortHelper`1.Sort(T[] keys, Int32 index, Int32 length, IComparer`1 comparer) +241
   System.Array.Sort(T[] array, Int32 index, Int32 length, IComparer`1 comparer) +205
   System.Collections.Generic.List`1.Sort(Int32 index, Int32 count, IComparer`1 comparer) +88
   System.Collections.Generic.List`1.Sort() +11
   BlogEngine.Core.Category.get_Categories() in C:\Users\guy.nethery\Documents\Visual Studio 2010\Projects\BlogEngine2.7\BlogEngine\BlogEngine.Core\Category.cs:117
   _default.AddMetaKeywords() +33
   _default.Page_Load(Object sender, EventArgs e) +727
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +51
   System.Web.UI.Control.OnLoad(EventArgs e) +92
   BlogEngine.Core.Web.Controls.BlogBasePage.OnLoad(EventArgs e) in C:\Users\guy.nethery\Documents\Visual Studio 2010\Projects\BlogEngine2.7\BlogEngine\BlogEngine.Core\Web\Controls\BlogBasePage.cs:133
   System.Web.UI.Control.LoadRecursive() +54
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +772

Nov 8, 2012 at 6:26 AM

It might be related to this Issue: 

The person suggests a workaround in the code.  You could try that, by updating Category.cs with the code he posted.

Nov 8, 2012 at 2:12 PM

That did the trick.   Thanks Ben.

This lead me to other issues/question which I will post at a later date in another discussion.

Nov 9, 2012 at 9:12 PM

Well that sort of did the trick.

I have an issue where one of my child categories "Denise" is not listed under its parent "Family Fun".  The balance are correct.

You can see what I mean here:


Anyone have any thoughts on what might be the cause?