BlogEngine 1.6.1 and Thumbnailer Extension error

Jun 3, 2010 at 7:00 PM

Hi,

Not sure if this is the right place to raise this but here goes.

1) Add a post with an image and save post - this works fine.

2) Edit the post, add a thumnailer value to the img tag and save post.

Example : <img src="/BlogEngine.NET/image.axd?picture=2010%2f6%2fMyPic.jpg[thumb:height=150]" alt="" />

This is the Error text :

Ooops! An unexpected error has occurred.

This one's down to me! Please accept my apologies for this - I'll see to it that the developer responsible for this happening is given 20 lashes (but only after he or she has fixed this problem).
Error Details:

Url : http://localhost/be16/admin/Pages/Add_entry.aspx

Raw Url : /be16/admin/Pages/Add_entry.aspx

Message : Exception of type 'System.Web.HttpUnhandledException' was thrown.

Source : System.Web

StackTrace : at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.admin_pages_add_entry_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\be16\92700332\af007f6e\App_Web_1j01pzkj.20.cs:line 0
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
TargetSite : Boolean HandleError(System.Exception)
Message : Object reference not set to an instance of an object.
Source : BlogEngine.Core
StackTrace : at ManagedExtension.Initialized(ExtensionSettings xs) in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ManagedExtension.cs:line 145
at ExtensionManager.ImportSettings(String extensionName, ExtensionSettings settings) in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ExtensionManager.cs:line 358
at ExtensionManager.ImportSettings(ExtensionSettings settings) in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\Web\Extensions\ExtensionManager.cs:line 350
at Thumbnailer.GetSettings() in c:\Inetpub\wwwroot\be16\App_Code\Extensions\Thumbnailer.cs:line 183
at Thumbnailer.ProcessImages(String content) in c:\Inetpub\wwwroot\be16\App_Code\Extensions\Thumbnailer.cs:line 136
at Thumbnailer.Post_Saving(Object sender, SavedEventArgs e) in c:\Inetpub\wwwroot\be16\App_Code\Extensions\Thumbnailer.cs:line 118
at BlogEngine.Core.BusinessBase`2.OnSaving(BusinessBase`2 businessObject, SaveAction action) in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\BusinessBase.cs:line 477
at BlogEngine.Core.BusinessBase`2.Update() in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\BusinessBase.cs:line 344
at BlogEngine.Core.BusinessBase`2.Save(String userName, String password) in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\BusinessBase.cs:line 313
at BlogEngine.Core.BusinessBase`2.Save() in D:\Projects\Be-1610\BlogEngine\DotNetSlave.BusinessLogic\BusinessBase.cs:line 288
at admin_entry.btnSave_Click(Object sender, EventArgs e) in c:\Inetpub\wwwroot\be16\admin\Pages\Add_entry.aspx.cs:line 240
at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

TargetSite : Boolean Initialized(ExtensionSettings)

3) Using Visual Web Developer 2010 Express and same setup (BE1.6.1 and Thumbnailer) do the same edit and I get the following error, plus VWD pauses in ManagedExtension.cs

System.NullReferenceException was unhandled by user code
  Message=Object reference not set to an instance of an object.
  Source=BlogEngine.Core
  StackTrace:
       at ManagedExtension.Initialized(ExtensionSettings xs) in C:\Documents and Settings\testuser\Desktop\BlogEngine.Core\Web\Extensions\ManagedExtension.cs:line 150
       at ExtensionManager.ImportSettings(String extensionName, ExtensionSettings settings) in C:\Documents and Settings\testuser\Desktop\BlogEngine.Core\Web\Extensions\ExtensionManager.cs:line 358
       at ExtensionManager.ImportSettings(ExtensionSettings settings) in C:\Documents and Settings\testuser\Desktop\BlogEngine.Core\Web\Extensions\ExtensionManager.cs:line 350
       at Thumbnailer.GetSettings() in c:\Documents and Settings\testuser\Desktop\BlogEngine.NET\App_Code\Extensions\Thumbnailer.cs:line 183
       at Thumbnailer.ProcessImages(String content) in c:\Documents and Settings\testuser\Desktop\BlogEngine.NET\App_Code\Extensions\Thumbnailer.cs:line 136
       at Thumbnailer.Post_Saving(Object sender, SavedEventArgs e) in c:\Documents and Settings\testuser\Desktop\BlogEngine.NET\App_Code\Extensions\Thumbnailer.cs:line 118
       at BlogEngine.Core.BusinessBase`2.OnSaving(BusinessBase`2 businessObject, SaveAction action) in C:\Documents and Settings\testuser\Desktop\BlogEngine.Core\BusinessBase.cs:line 477
       at BlogEngine.Core.BusinessBase`2.Update() in C:\Documents and Settings\testuser\Desktop\BlogEngine.Core\BusinessBase.cs:line 351
       at BlogEngine.Core.BusinessBase`2.Save(String userName, String password) in C:\Documents and Settings\testuser\Desktop\BlogEngine.Core\BusinessBase.cs:line 313
       at BlogEngine.Core.BusinessBase`2.Save() in C:\Documents and Settings\testuser\Desktop\BlogEngine.Core\BusinessBase.cs:line 288
       at admin_entry.btnSave_Click(Object sender, EventArgs e) in c:\Documents and Settings\testuser\Desktop\BlogEngine.NET\admin\Pages\Add_entry.aspx.cs:line 240
       at System.Web.UI.WebControls.Button.OnClick(EventArgs e)
       at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
       at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
       at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
  InnerException:

  VWD pauses on the line "if (setItem.Name == xs.Name)" as both values are null.
 

  public bool Initialized(ExtensionSettings xs)
  {
    if (xs != null)
    {
      foreach (ExtensionSettings setItem in _settings)
      {
        if (setItem.Name == xs.Name)
        {
            if (setItem.Parameters.Count == xs.Parameters.Count)
            {
                return true;
            }
        }
      }
    }
    return false;
  

A little guess work here (not a C# expert), I believe Thumbnailer does not set any parameters so will always be null.
    
4) I changed

if (setItem.Name == xs.Name)


to

if ((setItem.Name != null) && (setItem.Name == xs.Name)) 


Possibly should have been xs.Name or check both, not trying to tell people how to code just saying how I got something to work. If BlogEngine is not the item that needs changing and it's the extension that should be changed I am happy to look at Thumnailer some more.

I am just looking at the Thumbnailer as I have a tweaked version (not used for this test, yes it has the same issue) that renders out better looking thumbnails (filesize is bigger though). Eventually if I can figure it out, I will try and parameterise the values for render quality (negating this error I guess).

Thanks

 

Jun 7, 2010 at 6:11 PM

Forget the tweak to blogengine, better to remove to call to Thumbnailer.GetSettings(); in ProcessImages.

Still I am finally moving on with my real tweaks.