Broken Backwards compatibility on ContentLength property

16 posts, 0 answers
  1. Juan
    Juan avatar
    6 posts
    Member since:
    Jan 2011

    Posted 24 Sep 2013 Link to this post

    Hello, I recently had to upgrade Telerik.Web.UI.dll on a client's server (DNN 06.01.05) to 2013.2.717.35 (previous version installed was 2011.*.*.35). I had to do this because I installed some customizations where I use the latest Telerik.dll version that is suitable for IE10 and all that stuff. Then I set up an assembly binding on web.config forcing old functionallity to use new version of the library.

    Everything went fine until we discovered a problem trying to upload a file using FileExplorer on a DNN built in feature (not my customization)

    [MissingMethodException: Method not found: 'Int32 Telerik.Web.UI.UploadedFile.get_ContentLength()'.]
       DotNetNuke.Providers.RadEditorProvider.TelerikFileBrowserProvider.StoreFile(UploadedFile file, String path, String name, String[] arguments) +0
       Telerik.Web.UI.RadFileExplorer.ProcessUploadedFiles() +1134
       Telerik.Web.UI.RadFileExplorer.OnLoad(EventArgs e) +248
       System.Web.UI.Control.LoadRecursive() +71
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Control.LoadRecursive() +190
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3064

    It seems that the signature of get_ContentLength() has changed in latest builds from returning an Int32 to an Int64.

    The horror!

    I'm in DNN 6. I tried to set an assembly binding on web.config to use both versions of the dll (previous DNN functionality using telerik version 2011 and my assemblies using Telerik version 2013). This seems to be working but now I'm getting an internal DNN error:

    The base class includes the field '<componentName>', but its type (Telerik.Web.UI.RadWindowManager) is not compatible with the type of control (Telerik.Web.UI.RadWindowManager).

    Since DNN is a very popular CMS I thought may be someone faced the same scenario and could give me a hand.

    Any ideas on how to solve this problem?

    Thanks in advance.

    Juan
  2. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 27 Sep 2013 Link to this post

    Hi Juan,

    Please, note that version 5.0 or later of DNN uses the Professional provider of RadEditor, which is implementation of the DNN developers and it is not supported by Telerik. Our suggestion is to post your question in the DNN forums and contact the support of DNN for help.

    In addition, we are not aware of such problem with RadEditor outside of DNN environment. Are you able to reproduce this error in a standard ASP.NET page? If so, could you please provide sample fully runnable project demonstrating the issue so we can examine and debug it locally?

    Regards,
    Veselina Raykova
    Telerik
    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 the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Juan
    Juan avatar
    6 posts
    Member since:
    Jan 2011

    Posted 30 Sep 2013 Link to this post

    Hi Veselina, thanks for your reply.

    Regarding reproducing the issue, well, its a change on a signature's method. I could be wrong but it seems evident that code compiled against a method expecting an Int32 would fail when you install an update and the same method returns an Int64 (after setting up an assembly binding, etc.)
    I'll try to create a smaller project as an example if I have time later this week.

    In the meantime, would you be so kind to confirm in which version of Telerik.dll was this change introduced? I tried searching in the release notes but I coudln't find this specific information.

    Thansk in advance.

    Juan
  5. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 02 Oct 2013 Link to this post

    Hi Juan,

    The mentioned change was introduced in the Q2 2013 BETA (2013.2.522) version of RadControls. This improvement has been made in use of the following functionality:
    Improved: In order to upload files bigger than 2GB the type of the ContentLength properties in the AsyncUpload is changed to Int64.

    You might also find interesting the notes from this release, available here.

    Hope this helps.

    Kind regards,
    Veselina Raykova
    Telerik
    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 the blog feed now.
  6. Juan
    Juan avatar
    6 posts
    Member since:
    Jan 2011

    Posted 04 Oct 2013 Link to this post

    Thank you very much Veselina!
  7. Kevin
    Kevin avatar
    5 posts
    Member since:
    May 2011

    Posted 10 Oct 2013 Link to this post

    So how do I  fix this code then? Can I simply  convert the Int64 to Int32?

    foreach (UploadedFile
    file in RadAsyncUpload1.UploadedFiles)
    {

        byte[] bytes = new byte[file.ContentLength];

         file.InputStream.Read(bytes, 0, file.ContentLength);
    }

    file.InputStream.Read() requires an int for the third argument, not a long.

     

     

     

     

  8. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 15 Oct 2013 Link to this post

    Hi Kevin,

    Yes, you can simply cast the ContentLenght value to Int32 - the only difference will be that you will not be able to upload files bigger than 2GB.

    Regards,
    Veselina Raykova
    Telerik
    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 the blog feed now.
  9. Kevin
    Kevin avatar
    5 posts
    Member since:
    May 2011

    Posted 15 Oct 2013 Link to this post

    Thanks for the reply. That is what I did - I cast the value to Int32.

    So just curious then, how would I go about uploading a file larger than 2G? file.InputStream.Read() won't work with a long. Is there another method available for file.InputStream?
  10. Vessy
    Admin
    Vessy avatar
    1388 posts

    Posted 18 Oct 2013 Link to this post

    Hi Kevin,

    This is limitation of the framework and there is no much we can do. The Microsoft reccomendation on the subject is to read content of the files bigger than 2GB in more than one parts, so each of them will be less than Int32 and could be proceed in InputStream.Read().

    This issue was discussed in many places in the net so I would suggest you to dig a little dipper into the problem in order to find how to workaround it. For example, you can start your research here:
    Reading large file using byte[] gives error

    Regards,
    Veselina Raykova
    Telerik
    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 the blog feed now.
  11. Tony
    Tony avatar
    5 posts
    Member since:
    Nov 2011

    Posted 20 Feb 2014 in reply to Kevin Link to this post

    Hi guys,

    i am still getting the same error: Method not found: 'Int32 Telerik.Web.UI.UploadedFile.get_ContentLength()'.

    i did the following:
    var bytes = new byte[(Int32)file.ContentLength];
    file.InputStream.Read(bytes, 0, (Int32)file.ContentLength);

    Any ideas?

    Thanks




  12. Kevin
    Kevin avatar
    5 posts
    Member since:
    May 2011

    Posted 20 Feb 2014 in reply to Tony Link to this post

    I used this:
    byte[] bytes = new byte[file.ContentLength];
    file.InputStream.Read(bytes, 0, (int)file.ContentLength);
  13. Tony
    Tony avatar
    5 posts
    Member since:
    Nov 2011

    Posted 20 Feb 2014 in reply to Kevin Link to this post

    same error.

    Thanks.
  14. Tony
    Tony avatar
    5 posts
    Member since:
    Nov 2011

    Posted 21 Mar 2014 Link to this post

    can anybody help on this?
  15. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 25 Mar 2014 Link to this post

    Hello Tony,

    If you are not able to resolve the issue with the previously provided suggestions, I would recommend you opening a proper support ticket with a simple, locally runnable project that demonstrates the encountered issue.

    Regards,
    Ianko
    Telerik
     

    Build cross-platform mobile apps using Visual Studio and .NET. Register for the online webinar on 03/27/2014, 11:00AM US ET.. Seats are limited.

     
  16. ABA
    ABA avatar
    1 posts
    Member since:
    Mar 2016

    Posted 06 Mar Link to this post

    Hello,

    sorry to reopened this question. i have the same problem, and i search a solution. i want to modify the source but i don't know which one i should modify. any help please. 

  17. Ianko
    Admin
    Ianko avatar
    1535 posts

    Posted 07 Mar Link to this post

    Hi,

    The thread here is related to a two years old version and it is very likely that the problem encountered to be irrelevant to the discussion. 

    Therefore, it is suggested to open a support ticket or new forum post with more details about the problem encountered, the scenario and the version you are using. And, if possible, providing some code snippets or even better, a simple, locally runnable project which isolates the issue.

    Regards,
    Ianko
    Telerik
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017