This project is read-only.

Cumulus TagCloud error

Topics: Controls
Jan 6, 2011 at 7:18 PM

I've upgraded to 2.0 and added the Cumulus flash tag cloud widget.  Yet when I run and try to add the Cumulus widget, I get an error in WidgetBase.cs.

The Cache field is null. 

public StringDictionary GetSettings()
    var cacheId = string.Format("be_widget_{0}", this.WidgetId);
    if (this.Cache[cacheId] == null) //<-ERRORS HERE
        var ws = new WidgetSettings(this.WidgetId.ToString());
        this.Cache[cacheId] = ws.GetSettings();

    return (StringDictionary)this.Cache[cacheId];

The call stack looks like this:
> App_Code.lw5f-mew.dll!App_Code.Controls.WidgetBase.GetSettings() Line 83 + 0x8 bytes C#
  App_Web_gljlhrhl.dll!Widgets.Cumulus.CumulusWidget.Width.get() Line 74 + 0x8 bytes C#
  App_Web_gljlhrhl.dll!ASP.widgets_cumulus_widget_ascx.__Render__control1(System.Web.UI.HtmlTextWriter __w = {System.Web.UI.HtmlTextWriter}, System.Web.UI.Control parameterContainer = {ASP.widgets_cumulus_widget_ascx}) Line 6 + 0x3d bytes C#
Any ideas as to where the Cache is supposed to get set and why it isn't?
Jan 6, 2011 at 9:25 PM

I'm not sure exactly, but have you seen this post?  It's a different error message than what you may be getting here ... so it may not be related.

Do you have a link to the Cumulus widget code?

Jan 6, 2011 at 10:36 PM

I had other errors and found that post previously.  I had already updated the edit and widget CS files to include the using statements for App_Code.Controls and BlogEngine.Core.Web.Extensions, as well as cleaned up the naming syntax to this in the CS file:

namespace Widgets.Cumulus
    public partial class CumulusWidget : WidgetBase

 and this in the ascx file:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="widget.ascx.cs" Inherits="Widgets.Cumulus.CumulusWidget" %>


The Cumulus code I am using is available from


Jan 7, 2011 at 8:30 AM

I downloaded the widget.  I made two changes .... I added "using App_Code.Controls" to the top of widget.ascx.cs and edit.ascx.cs ... and the widget is working for me, in BE 2.0.

I don't have "namespace Widget.Cumulus" like you are showing in your post.  The two code-behind .CS files have these "class" lines:

public partial class widgets_Cumulus_widget : WidgetBase
public partial class widgets_Cumulus_edit : WidgetEditBase

The error you are showing is actually an error in WidgetBase (App_Code\Controls) -- not in the Cumulus widget.  You might already be aware of this.  Although I see that the error occurs when the Cumulus widget is Getting Settings.

Although you've identified which line of code the error is occurring on, is there an error message?  The more details you can post, the better.

Is "cacheId" null?  That seems unlikely since the line before sets "cacheId" to a value ... so I don't think "cacheId" can be null.  It's possible "this.Cache[cacheId]" is null, but that should not throw an error.  That line of code is checking to see if "this.Cache[cacheId]" is null, and if so, retrieving a value.

Jan 7, 2011 at 9:33 AM

Can anybody confirm that this Cumulus version is secure? I remember I read some articles about security holes in the past. I've found that -

Jan 7, 2011 at 6:34 PM

Thanks for checking into it Ben.  I had renamed the classes to make it more consistent with other widgets.  I deleted everything and re-added and only added the App_Code.Controls using statement.  When I run it locally, and attempt to add the Cumulus widget via the Administration controls, on the line

    if (this.Cache[cacheId] == null) //<-ERRORS HERE

Cache is null.
Jan 7, 2011 at 7:44 PM

So it sounds like you're saying that "this.Cache" is null.  this.Cache is short for System.Web.Caching.Cache ... and this is (or should always be) available and non-null for all ASP.NET pages and user controls.  It's the basic Cache system in ASP.NET, and is used throughout BE, and other ASP.NET applications.

System.Web.Caching.Cache is the same as System.Web.HttpRuntime.Cache.  So you could try replacing "this.Cache" with "System.Web.HttpRuntime.Cache" to see what happens.

Jan 7, 2011 at 8:11 PM

By changing "this.Cache[cacheId]" in App_Code/Controls/WidgetBase.cs to "System.Web.HttpRuntime.Cache[cacheId]" in the GetSettings function, I was able to get it to add with no errors.  Thanks for your help.  Still curious why this.Cache would be null when it isn't for any of the other controls/widgets.

Jun 7, 2011 at 1:47 PM

Hi, I have downloaded the source from

and had to add

using App_Code.Controls

to the both *.cs files

and also have the cache == null error

and like Kevinrmcd said: this is only for the cumulus widget

this is how my getsettings looks like now:

public StringDictionary GetSettings()
            var cacheId = string.Format("be_widget_{0}", this.WidgetId);
            //if (this.Cache[cacheId] == null)
            if (System.Web.HttpRuntime.Cache[cacheId] == null)
                var ws = new WidgetSettings(this.WidgetId.ToString());
                //this.Cache[cacheId] = ws.GetSettings();
                System.Web.HttpRuntime.Cache[cacheId] = ws.GetSettings();

            //return (StringDictionary)this.Cache[cacheId];
            return (StringDictionary)System.Web.HttpRuntime.Cache[cacheId];

using App_Code.Controls

using App_Code.Controls