Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Brendan Rice 538 posts 1101 karma points
    Nov 10, 2010 @ 17:44
    Brendan Rice
    0

    Problems uploading package (how can I debug this thing?)

    I am getting the following error when I have created a package with a lot of files.  I think I may be missing files somewhere but am unsure where.

    What is the best way to debug this?

    Could not upload file
    System.Exception: Error unpacking extension... ---> System.IndexOutOfRangeException: Index was outside the bounds of the array. at umbraco.cms.businesslogic.packager.Installer.getFileName(String path, String fileName) at umbraco.cms.businesslogic.packager.Installer.LoadConfig(String tempDir) at umbraco.cms.businesslogic.packager.Installer.Import(String InputFile) --- End of inner exception stack trace --- at umbraco.cms.businesslogic.packager.Installer.Import(String InputFile) at umbraco.presentation.developer.packages.Installer.uploadFile(Object sender, EventArgs e)
  • Tim 1193 posts 2675 karma points MVP 4x c-trib
    Nov 10, 2010 @ 17:49
    Tim
    0

    Hi Brendan,

    How many files are in the package?

    For debugging errors in Umbraco, I have a copy of the latest version of Umbraco from codeplex so that I can look at the source for the methods that re throwing errors, it helps me to spot what's causing the problem.

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 10, 2010 @ 17:53
    Douglas Robar
    1

    A shot in the dark...

    Unzip the file and look at the package.xml file, which is the manifest for the package. It will list all the files to be installed. Any whacko filenames? Are all the files actually in the zip file?

    Let us know what you find.

    cheers,
    doug.

  • Brendan Rice 538 posts 1101 karma points
    Nov 10, 2010 @ 17:58
    Brendan Rice
    0

    Thanks guys, there are a lot of files in the package so it will take a while to go through it.  I think it is missing a file going by the error it would be good to know what file it was.  If the file name was included in the error it would be really useful.

  • Brendan Rice 538 posts 1101 karma points
    Nov 10, 2010 @ 17:59
    Brendan Rice
    0

    There are a pile of svn-base files that are included out of somewhere anyone see them before?

  • Brendan Rice 538 posts 1101 karma points
    Nov 10, 2010 @ 22:55
    Brendan Rice
    0

    Hi Doug,

    Just finsihed going through each file (managed to get rid of all the svn files) and all are in the package directory. Not sure where to go next with this.

    Any ideas?

    Thanks for the help,

     

    B

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 11, 2010 @ 12:22
    Douglas Robar
    0

    If you unzip'd the original package, have added/removed files, updated the package.xml file so that everything is in sync now, you can manually re-zip the guid folder and its contents and have a package ready for using with umbraco.

    If you still have problems with the package installing you might break the package into multiple parts to find the relevant bit that isn't working properly.

    Let us know what you find out.

    cheers,
    doug.

  • Brendan Rice 538 posts 1101 karma points
    Nov 11, 2010 @ 13:03
    Brendan Rice
    0

    I got to the bottom of this issue here is what I done to find out the problem:

    1. Downloaded the source of the version of umbraco that was causing issues
    2. Set up an IIS Website to point to the presentation folder of the source and set appropriate permissions
    3. Opened the solution and built it
    4. In the solution attached IIS to the w3wp.exe process to allow me to debug
    5. Made sure break on all errors was switched on in Visual Studio (http://forum.jamesfoxall.com/showthread.php?t=676)
    6. In umbraco logged into the admin section and tried to upload my package

    After a bit of debugging I traced the error back to a file I had included in the package from the root of the website.

    Have a look at the extract from the package.xml that was causing problems notice <orgPath /> notice doesn't contain anything.

     

        <file>
          <guid>AjaxMethods.aspx</guid>
          <orgPath />
          <orgName>AjaxMethods.aspx</orgName>
        </file>
        <file>
          <guid>colorbox.css</guid>
          <orgPath>/colorbox/css</orgPath>
          <orgName>colorbox.css</orgName>
        </file>

     

    Here is a snippet of the code that falls over (umbraco.cms.businesslogic.packager.Installer)

     

            private static String getFileName(String path, string fileName)

            {

                Debug.Assert(path != null && path.Length >= 1);

                Debug.Assert(fileName != null && fileName.Length >= 1);

     

                path = path.Replace('/', '\\');

                fileName = fileName.Replace('/','\\');

     

                // Does filename start with a slash? Does path end with one?

                bool fileNameStartsWithSlash = (fileName[0] == Path.DirectorySeparatorChar);

                bool pathEndsWithSlash = (path[path.Length-1] == Path.DirectorySeparatorChar);

     

                // Path ends with a slash

                if (pathEndsWithSlash)

                {

                    if(!fileNameStartsWithSlash)

                        // No double slash, just concatenate

                        return path + fileName;

                    else

                        // Double slash, exclude that of the file

                        return path + fileName.Substring(1);

                }

                else

                {

                    if (fileNameStartsWithSlash)

                        // Required slash specified, just concatenate

                        return path + fileName;

                    else

                        // Required slash missing, add it

                        return path + Path.DirectorySeparatorChar + fileName;

                }

            }

     

     

    An empty string is passed in as the path as the file belong to the root of the website.


    This looks like a bug with the above method how do I go about raising it?

     

  • Douglas Robar 3570 posts 4711 karma points MVP ∞ admin c-trib
    Nov 11, 2010 @ 13:11
    Douglas Robar
    1

    Nice job tracking this down!

    For now, the workaround would be to add a path to the file, even if it is just "/"

     <file>
         
    <guid>AjaxMethods.aspx</guid>
         
    <orgPath>/</orgPath>
         
    <orgName>AjaxMethods.aspx</orgName>
       
    </file>

    cheers,
    doug.

  • Comment author was deleted

    Nov 24, 2010 @ 13:02

    Thanks for the details, should be fixed in 4.6 (Juno)

  • Brendan Rice 538 posts 1101 karma points
    Jan 10, 2011 @ 17:01
    Brendan Rice
    0

    Nice one Tim

Please Sign in or register to post replies

Write your reply to:

Draft