Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > RadControls in ASP.NET MVC > RadCompression throws NullReferenceException

Not answered RadCompression throws NullReferenceException

Feed from this thread
  • Alex avatar

    Posted on Jul 21, 2011 (permalink)

    Hi,

    I recently upgraded our web project to Telerik version 2011.2.712 (Mvc 2, .NET 3.5). Previously we were using 2010.2.929 for Telerik.Web.UI.dll and 2010.3.1318 for Telerik.Web.Mvc.dll.

    After the upgrade, images stopped loading correctly. After debugging the issue, I found that Telerik.Web.UI.RadCompression is throwing a NullReferenceException:

    Message
    Object reference not set to an instance of an object.
    Stack Trace
       at System.Object.GetType()
       at Telerik.Web.UI.RadCompression.Compress(HttpApplication application)
       at Telerik.Web.UI.RadCompression.PreRequestHandlerExecute(Object sender, EventArgs e)
       at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
       at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    As I temporary work-around, I have disabled compression and everything seems to be working now:
    <httpModules>
      <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="UrlRoutingModule" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" />
      <!--<add name="RadCompression" type="Telerik.Web.UI.RadCompression" />-->
    </httpModules>
    <modules runAllManagedModulesForAllRequests="true">
      <remove name="UrlRoutingModule" />
      <remove name="ScriptModule" />
      <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <add name="UrlRoutingModule" preCondition="" type="System.Web.Routing.UrlRoutingModule, System.Web.Routing, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
      <remove name="RadUploadModule" />
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode" />
      <!--<remove name="RadCompression" />-->
      <!--<add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="integratedMode" />-->
      <remove name="HttpPreprocessModule" />
      <add name="HttpPreprocessModule" type="Microsoft.Cosmos.FrontEnd.WebService.IISHost.HttpPreprocessModule, Microsoft.Cosmos.FrontEnd.IISServiceHost" />
    </modules>

    Is this a know issue with the latest release?

    Thanks,
    Alex

    Reply

  • Alex avatar

    Posted on Jul 25, 2011 (permalink)

    Ping.
    Could someone from Telerik please confirm whether this is an issue with the release or a bug on our end?

    Thanks,
    Alex

    Reply

  • Martin Martin admin's avatar

    Posted on Jul 26, 2011 (permalink)

    Hello Alex,

    We have not received reports for similar issues so far. Would you mind providing us with some more details about the server version your application runs on as well as the steps we need to take in order to replicate the issue? This way I will be able to debug it locally and provide you with more to the point resolution.

    Meanwhile, could you please try removing the preCondition attribute from your RadCompression declaration and let me know whether the issue still exists?

    Regards,
    Martin
    the Telerik team

    Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

    Reply

  • Neil avatar

    Posted on Aug 15, 2011 (permalink)

    We just had this same thing happen when publishing to our live site. This issue did not occur on my dev machine or on our test server but the only way I could get the site to work once deployed was to comment out the RadCompression reference in the modules section web.config:

    <modules runAllManagedModulesForAllRequests="true">
      <remove name="RadUploadModule" />
      <remove name="RadCompression" />
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode" />
      <!--<add name="RadCompression" type="Telerik.Web.UI.RadCompression" />-->
    </modules>

    Otherwise the error was exactly as described by Alex. The only difference as far as I can tell between our test and live servers is that the test machine is running 32 bit and the live is 64 bit. Let me know what info I can give you to help you track down the cause of this problem as I really would to re-enable radcompression as is makes a noticeable difference to our application.

    Reply

  • Martin Martin admin's avatar

    Posted on Aug 15, 2011 (permalink)

    Hello Neil Alexander,

    Since a second customer encounters this problem it seems that there is a problem with the RadCompression module in this scenario. The best approach we can follow in resolving the issue is to send me a runnable sample that I can debug locally. In addition I would need the IIS version you are hosting on and the application pool settings you use. This way I will be able to track the cause of the problem and provide you with more to the point resolution.

    Just for testing purposes, could you please try whether removing the "runAllManagedModulesForAllRequests" attribute and setting precondition="managedHandler" for the RadCompression module changes the behavior:

    <modules >
      <remove name="RadUploadModule" />
      <remove name="RadCompression" />
      <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" preCondition="integratedMode" />
      <add name="RadCompression" type="Telerik.Web.UI.RadCompression" precondition="managedHandler"/>
    </modules>


    Best wishes,
    Martin
    the Telerik team

    Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

    Reply

  • Aaron avatar

    Posted on Aug 19, 2011 (permalink)

    Hi, I was having this error too and was able to resolve by making the change Martin suggested.

    IIS 7.5
    Telerik 2011.2.712
    .Net 4
    Managed pipeline mode: Integrated

    Broken:
    <modules runAllManagedModulesForAllRequests="true">
         <add name="RadCompression" type="Telerik.Web.UI.RadCompression" />
    </modules>


    Working:
    <modules>
        <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="managedHandler" />
    </modules>

    Reply

  • Chris Poirier avatar

    Posted on Aug 22, 2011 (permalink)

    I am also receiving reports of the same error. It doesn't always happen, and I haven't reproduced it myself, but it happened about 20 times in a row for one user.

    IIS 7.0
    Telerik 2011.2.712
    .Net 4
    Managed pipeline mode: Integrated

    Here is the error report:
    2011/08/10 05:38:15 System.NullReferenceException: Object reference not set to an instance of an object. at Telerik.Web.UI.RadCompression.Compress(HttpApplication application) at Telerik.Web.UI.RadCompression.PreRequestHandlerExecute(Object sender, EventArgs e) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    And below is the Web.config for the application:
    <?xml version="1.0"?>
    <configuration>
        <appSettings>
            <add key="Telerik.Web.UI.DialogParametersEncryptionKey" value="cElPYlhVajgzR3JiZERHdXdpd0JRNFVCTWVBPUx0NkU1"/>
        </appSettings>
        <system.web>
            <compilation debug="false" targetFramework="4.0">
                <assemblies>
                    <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="System.Configuration.Install, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="System.Data.OracleClient, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
                    <add assembly="Accessibility, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                    <add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Xml.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                    <add assembly="System.Data.DataSetExtensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
                </assemblies>
            </compilation>
            <authentication mode="Windows"/>
            <pages viewStateEncryptionMode="Never" validateRequest="false" enableEventValidation="false" enableSessionState="true" enableViewStateMac="false" controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
                <controls>
                    <add tagPrefix="telerik" namespace="Telerik.Web.UI" assembly="Telerik.Web.UI"/>
                    <add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                    <add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                </controls>
            </pages>
            <httpHandlers>
                <remove verb="*" path="*.asmx"/>
                <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
                <add path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" validate="false"/>
                <add path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" validate="false"/>
                <add path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" validate="false"/>
                <add path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" validate="false"/>
                <add path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" validate="false" />
            </httpHandlers>
            <httpModules>
                <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
            </httpModules>
            <httpRuntime requestValidationMode="2.0"/>
        </system.web>
        <system.webServer>
            <handlers>
                <remove name="ScriptHandlerFactory"/>
                <remove name="ScriptHandlerFactoryAppServices"/>
                <remove name="ScriptResource"/>
                <remove name="WebServiceHandlerFactory-Integrated"/>
                <remove name="ChartImage_axd"/>
                <remove name="Telerik_Web_UI_SpellCheckHandler_axd"/>
                <remove name="Telerik_Web_UI_DialogHandler_aspx"/>
                <remove name="Telerik_RadUploadProgressHandler_ashx"/>
                <remove name="Telerik_Web_UI_WebResource_axd" />
     
                <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add name="*.vbhtml_*" path="*.vbhtml" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
                <add name="*.vbhtm_*" path="*.vbhtm" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
                <add name="*.cshtml_*" path="*.cshtml" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
                <add name="*.cshtm_*" path="*.cshtm" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
                <add name="*.aspq_*" path="*.aspq" verb="*" type="System.Web.HttpForbiddenHandler" preCondition="integratedMode,runtimeVersionv4.0" />
                <add name="*.xamlx_*" path="*.xamlx" verb="*" type="System.Xaml.Hosting.XamlHttpHandlerFactory, System.Xaml.Hosting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="*.xoml_*" path="*.xoml" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="*.svc_*" path="*.svc" verb="*" type="System.ServiceModel.Activation.HttpHandler, System.ServiceModel.Activation, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="*.soap_*" path="*.soap" verb="*" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="*.rem_*" path="*.rem" verb="*" type="System.Runtime.Remoting.Channels.Http.HttpRemotingHandlerFactory, System.Runtime.Remoting, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="*.asmx_*" path="*.asmx" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="ScriptResource.axd_GET,HEAD" path="ScriptResource.axd" verb="GET,HEAD" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="*_AppService.axd_*" path="*_AppService.axd" verb="*" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="eurl.axd_*" path="eurl.axd" verb="*" type="System.Web.HttpNotFoundHandler" preCondition="integratedMode,runtimeVersionv2.0" />
                <add name="Telerik_Web_UI_WebResource_axd" path="Telerik.Web.UI.WebResource.axd" type="Telerik.Web.UI.WebResource" verb="*" preCondition="integratedMode" />
                <add name="Telerik_RadUploadProgressHandler_ashx" path="Telerik.RadUploadProgressHandler.ashx" type="Telerik.Web.UI.RadUploadProgressHandler" verb="*" preCondition="integratedMode" />
                <add name="Telerik_Web_UI_DialogHandler_aspx" path="Telerik.Web.UI.DialogHandler.aspx" type="Telerik.Web.UI.DialogHandler" verb="*" preCondition="integratedMode" />
                <add name="Telerik_Web_UI_SpellCheckHandler_axd" path="Telerik.Web.UI.SpellCheckHandler.axd" type="Telerik.Web.UI.SpellCheckHandler" verb="*" preCondition="integratedMode" />
                <add name="ChartImage_axd" path="ChartImage.axd" type="Telerik.Web.UI.ChartHttpHandler" verb="*" preCondition="integratedMode" />
            </handlers>
            <modules runAllManagedModulesForAllRequests="true">
                <remove name="ScriptModule"/>
                <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" />
                <add name="RadCompression" type="Telerik.Web.UI.RadCompression" />
            </modules>
            <validation validateIntegratedModeConfiguration="false" />
        </system.webServer>
        <system.codedom>
            <compilers>
                <compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" warningLevel="4" compilerOptions="/doc:LawDepotEditor.xml">
                    <providerOption name="CompilerVersion" value="v4.0"/>
                    <providerOption name="WarnAsError" value="false"/>
                </compiler>
            </compilers>
        </system.codedom>
    </configuration>

    Reply

  • Martin Martin admin's avatar

    Posted on Aug 23, 2011 (permalink)

    Hello Chris Poirier,

    I have reviewed your .config file and noticed the following line:

    <modules runAllManagedModulesForAllRequests="true">

    As Aaron stated in a post previous to yours, removing the runAllManagedModulesForAllRequests="true" declaration in the modules section and adding preCondition="managedHandler" for the RadCompression module section worked for his case. Could you please confirm that for your scenario?

    Here is how the modified code should look:

    <modules>
        <remove name="ScriptModule"/>
        <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
        <add name="RadUploadModule" type="Telerik.Web.UI.RadUploadHttpModule" />
        <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="managedHandler" />
    </modules>

    Let me know whether the issue persists after you apply the modifications above.

    Best wishes,
    Martin
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

    Reply

  • Aaron avatar

    Posted on Aug 26, 2011 (permalink)

    Hi Martin,

    If I have another module that requires
    <modules runAllManagedModulesForAllRequests="true">

    Is there another workaround available to still use RadCompression and avoid this error?

    Thanks in advance!

    Reply

  • Pavel Pavel admin's avatar

    Posted on Aug 29, 2011 (permalink)

    Hi Aaron,

    There is no explicit need for setting runAllManagedModulesForAllRequests="true". This property is just a shortcut which applies for all modules (effectively ignoring any preCondition that might have been set). You can enable the same behavior for your other module by not applying a preCondition for it (simply remove its precondition attribute). This is explained in the following resource:

    http://learn.iis.net/page.aspx/121/iis-7-modules-overview/#Precondition

    Kind regards,
    Pavel
    the Telerik team

    Thank you for being the most amazing .NET community! Your unfailing support is what helps us charge forward! We'd appreciate your vote for Telerik in this year's DevProConnections Awards. We are competing in mind-blowing 20 categories and every vote counts! VOTE for Telerik NOW >>

    Reply

  • Glenn avatar

    Posted on Sep 1, 2011 (permalink)

    Likewise... Same issue for us and the solution that worked for Aaron worked also for us.

    IIS 7.5
    Telerik 2011.2.712
    .Net 4
    Managed pipeline mode: Integrated

    Reply

  • Chris Poirier avatar

    Posted on Sep 1, 2011 (permalink)

    Hi Martin,

    I have not been able to reproduce the error at all, but this has not come up in our error logs since making the change, so it appears to have worked.

    Thanks,
    Chris

    Reply

  • Alan Peters avatar

    Posted on Oct 3, 2011 (permalink)

    I get literally hundreds of users every day hit my site, there are a few NullReferenceExceptions thrown by RadCompress - but they do have something in common, the user agent *always* contains "Firefox/3.5.16".

    Later versions of Firefox never cause the error, neither do other browsers.

    I don't know if that sheds any light on the issue..?

    Reply

  • Posted on Feb 2, 2012 (permalink)

    Hi all,

    I'm also getting the same error and stacktrace, but in 1 scenario, running IIS7.5 on Win 2008:
    - http://www.applications.tst/                             generates the error when i click on something and there is a page postback
    - http://www.applications.tst/master.aspx          generates no error...
    the default doc is master.aspx, but the app is not working correctly if you do not type "master.aspx"...

    When I do this on my dev machine, running local IIS7.5 on Win 7, there is no problem...
    The behaviour on the server of my client is exactly the same, also a Win 2007 IIS7.5
    browser does not matter (FF, Chrome. IE9)

    telerik controls version = 2011.3.1305.40


    Regards,

    Erik


    Reply

  • Iana Tsolova Iana Tsolova admin's avatar

    Posted on Feb 2, 2012 (permalink)

    Hello Erik,

    Try the solution provided at the bottom of this topic:
    http://www.telerik.com/help/aspnet-ajax/radcompression.html (under the know issues section)

    All the best,
    Iana Tsolova
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now

    Reply

  • Posted on Feb 3, 2012 (permalink)

    Thanks Iana,

    I had to do both (change preCondition and disable runAllManagedModulesForAllRequests ) and that did the trick.

    <modules runAllManagedModulesForAllRequests="false">
        <remove name="RadCompression" />
        <add name="RadCompression" type="Telerik.Web.UI.RadCompression" preCondition="managedHandler" />
    </modules>

    Erik

    Reply

  • MCBB avatar

    Posted on Mar 8, 2012 (permalink)

    I had this problem and had to change the preCondition below:

    "runtimeVersionv4.0" to "runtimeVersionv2.0"

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / ASP.NET AJAX > RadControls in ASP.NET MVC > RadCompression throws NullReferenceException