Copied to clipboard

Flag this post as spam?

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


  • James Jackson-South 489 posts 1747 karma points c-trib
    Mar 26, 2015 @ 18:20
    James Jackson-South
    0

    SaveAndPublishWithStatus failing.

    v7.2.1

    Attempting to save an IContent instance using SaveAndPublishWithStatus I get.

    Input string was not in a correct format

    It looks like it's not parsing a number properly to me but everything should be ok. All the the values on my object are added as string values since I have no idea what types IContentBase.SetValue(string propertyAlias, object value); supports as the second parameter.

    Stack trace containing the relevant parts.

    [FormatException: Input string was not in a correct format.]
       System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) +14292453
       System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +305
       Umbraco.Core.Persistence.Factories.PropertyFactory.BuildDto(IEnumerable`1 properties) +602
       Umbraco.Core.Persistence.Repositories.ContentRepository.PersistUpdatedItem(IContent entity) +2494
       Umbraco.Core.Persistence.Repositories.RepositoryBase`2.PersistUpdatedItem(IEntity entity) +251
       Umbraco.Core.Persistence.UnitOfWork.PetaPocoUnitOfWork.Commit(Action`1 transactionCompleting) +208
       Umbraco.Core.Services.ContentService.SaveAndPublishDo(IContent content, Int32 userId, Boolean raiseEvents) +984
       SchoolsTogether.Logic.Controllers.DashboardEditPageController.SaveProject(IContent project, IContentService service, ProjectForm projectForm, HttpRequestBase request) :222
    

    Any Ideas?

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Mar 26, 2015 @ 18:27
    Morten Bock
    0

    What does your doctype look like? It must have a property, where the value is stored as an int? And then the value you are passing cannot be parsed?

  • James Jackson-South 489 posts 1747 karma points c-trib
    Mar 26, 2015 @ 18:58
    James Jackson-South
    100

    Got it!

    It's that old chestnut. Booleans as integers but not really cos they're string representations of those integers because reasons.

    I feel like I'm playing Whack-a-Mole with craziness just now.

  • Morten Bock 1867 posts 2140 karma points MVP 2x admin c-trib
    Mar 26, 2015 @ 19:23
    Morten Bock
    0

    Ahh, yeah when storing data it's essential to be aware of how it will eventually be stored in the db.

    I don't know if there is such a thing as value mappers when working with the IContent as there is with the IPublishedContent?

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies