Copied to clipboard

Flag this post as spam?

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


  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 28, 2015 @ 05:49
    Sören Deger
    0

    Could not upload file System.Exception: Error unpacking extension on install package

    Hi guys,

    I use this package actions in my new package:

    http://our.umbraco.org/wiki/reference/packaging/package-actions/community-made-package-actions

     

    On load package I get this error message:

    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)

     

    I have isolated the problem, but I do not know why the error happens.

    This is the related package action:

    <Action runat="install" undo="true" alias="AddXmlFragment" file="~/config/log4net.config" xpath="/log4net" position="end">
         <appender name="mail2cmsAppender" type="Umbraco.Core.Logging.AsynchronousRollingFileAppender, Umbraco.Core">
     <file value="App_Data\Logs\mail2cms.log.txt" />
     <lockingModel type="log4net.Appender.FileAppender+MinimalLock" />
     <appendToFile value="true" />
     <rollingStyle value="Date" />
     <maximumFileSize value="5MB" />
     <layout type="log4net.Layout.PatternLayout">
     <conversionPattern value="%date [%thread] %-5level %logger - %message%newline" />
     </layout> </appender> </Action>

     

    Without this line it works great:

    <file value="App_Data\Logs\mail2cms.log.txt" />

    But as soon as I add the line again I get the install error.

     

    Does anyone know why this happens and how I can solve the problem?

     

    Best,

    Sören

  • Jan Skovgaard 11280 posts 23678 karma points MVP 10x admin c-trib
    Jan 28, 2015 @ 07:12
    Jan Skovgaard
    0

    Hi Sören

    I don't know much about package actions but I'm thinking maybe you need to add ~/ in front of the path in the value attribute? (Long shont).

    /Jan

  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 28, 2015 @ 08:15
    Sören Deger
    0

    Hi Jan,

    thank you. But in log4net.config the path for file tag must be this format:

    App_Data\Logs\mail2cms.log.txt

    and not this format:

    ~/App_Data/Logs/mail2cms.log.txt

     

    Best,

    Sören

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jan 28, 2015 @ 08:16
    Richard Soeteman
    1

    Hi Sören,

    Must be something in the xml then, weird one maybe a character. I use this action in many packages without an issue. What you should do is use the package action tester http://our.umbraco.org/projects/developer-tools/package-action-tester and run in debug mode to see what is going on.

    Hope this helps,

    Richard

  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 28, 2015 @ 08:27
    Sören Deger
    0

    Hi Richard,

    strange, the package tester say: AddXmlFragment - Installed...

    Sören

    • AddXmlFragment - InstalledAddXml
    • AddXmlFragment - Installed
    • AddXmlFragment - Installed
  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jan 28, 2015 @ 08:31
    Richard Soeteman
    0

    And it did install?

  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 28, 2015 @ 08:36
    Sören Deger
    0

    No, there are no changes in the log4net.config-

  • Richard Soeteman 4035 posts 12842 karma points MVP
    Jan 28, 2015 @ 08:52
    Richard Soeteman
    1

    Maybe copy the action in your code and then run the action in debug mode that should explain what happens.

  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 28, 2015 @ 08:56
    Sören Deger
    0

    Thank you Richard! I will make it this evening and give you feedback as soon as I found out something.

  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 28, 2015 @ 21:05
    Sören Deger
    0

    Hi Richard,

    I have copy the action class AddXmlFragment.cs in a new clean visual studio project with umbraco 7.2.1 and have set a breakpoint to Execute - Function. But the function is not reached in this scenario. If I remove this line <filevalue="App_Data\Logs\mail2cms.log.txt"/> from my package actions I can install the package after loading and the function is reached and all works great.

    But the error occurs if I click on "Load package" and due to the error I have not the possibility to install the package. Because that, the "Execute" function is not calling.

    Can you or everyone check if you can execute the package action from my first post above and if the log4net.config is updated after this? I would like to know if the problem is only with me or if anyone else has the same problem with this specific code.
    As I said, it works great without the row with the file tag... 

     

    Best,

    Sören

  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 29, 2015 @ 05:20
    Sören Deger
    0

    I have tested now again.If I call the complete package action with Package Action Tester it works now. Maybe the log4net.config file was not loaded properly in editor again at yesterday.But this works!

    Now I have changed this line

    <filevalue="App_Data\Logs\mail2cms.log.txt"/>

    to

    <fileTestvalue="App_Data\Logs\mail2cms.log.txt"/>

    And with this I can load and install the package.

    It seems that umbraco package installer has a problem on loading the package, if the tag <file> is included in AddXmlFragment package actions. 

    Can someone check this and confirm?

     

    Best,

    Sören

  • Sören Deger 733 posts 2844 karma points c-trib
    Jan 29, 2015 @ 23:53
    Sören Deger
    100

    Hi Richard,

    I have solved it with your package action tester!

    I have removed the actions for log4net from package actions and included the most of your source files directly in my mail2cms solution. Then I insert this actions hardcoded and call the PackageActionService.ExecutePackageActions(executeModel) Function in my Install class for the custom database tables.

    This works great :)

    Thank you for the support!

    #H5YR!

     

    Best,

    Sören

Please Sign in or register to post replies

Write your reply to:

Draft