Orchard 1.7 Upgrade - Media Picker Field no longer working

Topics: Customizing Orchard
Jul 16, 2013 at 10:12 PM
Today I did an in place upgrade of my Orchard 1.6.1.0 install to 1.7.0.0. Everything went smooth except for the fact that any content type I had defined that used the Media Picker field no longer displays the image or contains any of the associated data. Any ideas?
Coordinator
Jul 16, 2013 at 10:37 PM
Have you upgraded the MEdia to Media Library and also the MEdia Picker Fields, everything from the upgrade module ?
If yes, have you updated your templates which could be using the media picker ?
Jul 17, 2013 at 1:00 AM
I have done all of that. However, now when I click on "Content" from the Admin panel, I get a server error.
Jul 17, 2013 at 1:05 AM
Disabling the Media Library lets me browse my Content List once again. Very strange indeed.
Coordinator
Jul 17, 2013 at 1:09 AM
what is the error message ?
Jul 17, 2013 at 1:15 AM
Server Runtime Error:

Server Error in '/' Application.

Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine.

Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
Jul 17, 2013 at 1:26 AM
Edited Jul 17, 2013 at 1:40 AM
Is there any way for me to just stick with the Media Picker Field in 1.7.0.0?

Edit: I've also noticed that the update broke the ImageGallery module that I'm using. Seems that the JQuery to display the images is no longer working.

Edit: The Image Gallery Module I am using is Image Gallery 1.3 Stable.
Coordinator
Jul 17, 2013 at 1:39 AM
Yes, don't enable the Media Library, and don't disable the Media/Media Picker modules. There is even a new Media Gallery field which comes with it to select multiple media.

I'd still would have like to understand what is happening, at least for the people who will have the same issue. Can you check you log file ?
Jul 17, 2013 at 1:44 AM
Edited Jul 17, 2013 at 1:48 AM
Sure thing - see link.

http://pastebin.com/Bcmbje8c
Jul 17, 2013 at 1:52 AM
Ended up reverting back to 1.6.1.0. Even after disabling the Media Library, I saw no options in fields for Media Picker or anything to select images, etc.
Jul 17, 2013 at 11:55 AM
I have a custom content type with a MediaPicker field defined.
The only error I got, was when I tried to name the new LibraryPicker field the same after I deleted the old MediaPicker field.
Maybe that caused your error too?

Besides that everything went smooth.
Coordinator
Jul 17, 2013 at 7:34 PM
Well you should have "Migrated" the field to the new type. Enable the Upgrade module and for to the Media Library tab.
Jul 17, 2013 at 7:37 PM
I had tried that. I even went back several times and restored my files from 1.6.1.0 install and did the upgrade process again. I would enable the upgrade module, migrate my media files, migrate the fields, etc. and still no luck. Every time I was left with a Content List that didn't work when Media Library was enabled. I also had zero data carry over from the Media Picker field.
Aug 4, 2013 at 4:22 PM
Hello dear Sebastien

I have same problem too. I did local upgrade from 1.6.1 to 1.7.

After upgrading process when i click on content list, I get the following error:

Input string was not in a correct format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.FormatException: Input string was not in a correct format.
Source Error:
Line 6: var field = (MediaLibraryPickerField) Model.ContentField;
Line 7: string name = field.DisplayName;
Line 8: var mediaParts = field.MediaParts;
Line 9:
Line 10: var returnUrl = ViewContext.RequestContext.HttpContext.Request.ToUrlString();
Source File: h:\Software Development\Web Sites\Catrim.com\Orchard.Web.1.7\Orchard\Modules\Orchard.MediaLibrary\Views\Fields\MediaLibraryPicker.SummaryAdmin.cshtml Line: 8 ============================================================
This is because i have some custom content type with media picker field. Please be aware that If i delete old content items of these content types orchard works normally and i can create new items and select media for them.
I did upgrading process step by step based on the following documents:
http://docs.orchardproject.net/Documentation/Upgrading-a-site-to-a-new-version-of-Orchard
http://docs.orchardproject.net/Documentation/Orchard-1-7-Release-Notes
Aug 5, 2013 at 6:48 PM
I had the same problem with upgrading to 1.7 release. I am curious, is there any way to upgrade to 1.7 without including the new Media Library Picker? Can I just carry over the Media Picker Field exactly as it is in 1.6.1?
Coordinator
Aug 5, 2013 at 11:53 PM
You could, but you should not.
Aug 10, 2013 at 9:55 PM
This can happen because the records in the case of Media Picker were stored with your URL and now do with your ID.

See table Orchard_Framework_ContentItemVersionRecord

OLD FORMAT EXAMPLE
<Data><Thumbnails><ThumbnailSmall>~/Media/Default/images/News/2013/07/Workshop-Theater-Dance---tec-clasica-07-08-septiembre-2013_200x130.jpg</ThumbnailSmall></Thumbnails></Data>

NEW FORMAT EXAMPLE
<Data><Thumbnails><ThumbnailSmall>{345}</ThumbnailSmall></Thumbnails></Data>

{345} is the id of the record corresponding to the stored image by the new module MediaLibrary.
Aug 11, 2013 at 8:33 AM
I updated from 1.6 to 1.7. after it, all records from Orchard_Framework_ContentItemVersionRecord are still in old format.
example
<Data><BlogPost><BeforePostImage AlternateText="окрашивание волос народными средствами цвет волос" Class="" Style="" Alignment="" Width="600" Height="400">~/Media/Default/images/окрашивание_народные_средства.jpg</BeforePostImage></BlogPost></Data>

i found this image in [Orchard_MediaLibrary_MediaPartRecord] - i suppose the migration is completed
but the alternative text for image - is empty in [Orchard_MediaLibrary_MediaPartRecord. this situation is common for all images.

i think there is something wrong with migration.

can anything be done with this?
Aug 12, 2013 at 3:24 PM
Edited Aug 12, 2013 at 3:27 PM
Same problem on my test server. After upgrading media using upgrade module, I also get the exception with string not in the correct format. If I don't upgrade media, the media picker field are not rendered on the web site although the media picker module is enabled.

[EDIT]Sorry, just noticed a bug report with a temporary fix is already available. Will try it.[/EDIT]
Aug 23, 2013 at 8:08 AM
I also encountered the same problem.
Seek a solution.
Sep 23, 2013 at 9:11 PM
Just upgraded from 1.6 to 1.7.1 and am having the same issue. Did anyone figure this out?
Coordinator
Sep 24, 2013 at 12:48 AM
It's a long thread. What issue exactly?
Sep 24, 2013 at 4:05 PM
Well, after upgrading and migrating, if I click on Content in the menu, or from the front-end of any projection page that contains an image, I get the "input string was not in a correct format." If I disable the MediaLibrary module I can get to any of these pages but are of course missing image fields.
Coordinator
Sep 24, 2013 at 4:54 PM
Can you provide a stack trace, please?
Sep 24, 2013 at 5:01 PM
Coordinator
Sep 24, 2013 at 5:21 PM
Looks like you have some corrupted data here: the field template can't get to the media parts from the field. I'm thinking your upgrade wasn't properly completed or failed somehow. Can you try to run it again? If you can, restore a backup and try again.
Sep 24, 2013 at 5:23 PM
I've tried running the migration multiple times, no luck. I'll go back to 1.6 today and give it a try again.
Thanks
Sep 24, 2013 at 5:36 PM
x3graphics wrote:
I've tried running the migration multiple times, no luck. I'll go back to 1.6 today and give it a try again.
Thanks
I have given up on this issue. I have tried upgrading multiple times, and multiple websites from 1.6 - 1.7 (or 1.7.1) without success.
Coordinator
Sep 24, 2013 at 6:57 PM
If this still doesn't work, please file a bug, if possible with the media files that won't upgrade.
Sep 25, 2013 at 11:14 AM
i have the same problem
in the front-end i get the "input string was not in a correct format"
and in the back-end when i will add an image i get "formattype resizemediaurl not found"

bei Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in \orchard1.7\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:Zeile 91.
bei Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in\orchard1.7\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:Zeile 86.
bei Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeTypeExecute(String name, INamedEnumerable1 parameters) in\orchard1.7\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:Zeile 72.
bei Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable
1 parameters) in \orchard1.7\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:Zeile 40.
bei Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvokeMember(InvokeMemberBinder binder, Object[] args, Object& result) in \orchard1.7\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:Zeile 34.
bei CallSite.Target(Closure , CallSite , Object , Int32 , Int32 , String , String , String )
bei ASP._Page_Modules_Orchard_MediaLibrary_Views_Media_Image_Thumbnail_cshtml.Execute() in orchard1.7\src\Orchard.Web\Modules\Orchard.MediaLibrary\Views\Media-Image.Thumbnail.cshtml:Zeile 9.
bei System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
bei System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
bei System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
bei System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
bei System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
bei System.Web.Mvc.HtmlHelper.RenderPartialInternal(String partialViewName, ViewDataDictionary viewData, Object model, TextWriter writer, ViewEngineCollection viewEngineCollection)
bei System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model, ViewDataDictionary viewData)
bei System.Web.Mvc.Html.PartialExtensions.Partial(HtmlHelper htmlHelper, String partialViewName, Object model)
bei Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.Render(ShapeDescriptor shapeDescriptor, DisplayContext displayContext, HarvestShapeInfo harvestShapeInfo, HarvestShapeHit harvestShapeHit) in d:\Projekte\CCC-SternReisen\orchard1.7\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:Zeile 142.
bei Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy.<>c__DisplayClass26.<>c__DisplayClass28.<Discover>b__15(DisplayContext displayContext) inorchard1.7\src\Orchard\DisplayManagement\Descriptors\ShapeTemplateStrategy\ShapeTemplateBindingStrategy.cs:Zeile 126.
bei Orchard.DisplayManagement.Descriptors.ShapeAlterationBuilder.<>c__DisplayClass3.<>c__DisplayClass5.<BoundAs>b__2(DisplayContext displayContext) in \orchard1.7\src\Orchard\DisplayManagement\Descriptors\ShapeAlterationBuilder.cs:Zeile 55.
bei Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Process(ShapeBinding shapeBinding, IShape shape, DisplayContext context) in\orchard1.7\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:Zeile 179.
bei Orchard.DisplayManagement.Implementation.DefaultDisplayManager.Execute(DisplayContext context) in \orchard1.7\src\Orchard\DisplayManagement\Implementation\DefaultDisplayManager.cs:Zeile 88.
bei Orchard.DisplayManagement.Implementation.DisplayHelper.ShapeExecute(Object shape) in \orchard1.7\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:Zeile 86.
bei Orchard.DisplayManagement.Implementation.DisplayHelper.Invoke(String name, INamedEnumerable1 parameters) in \orchard1.7\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:Zeile 44.
bei Orchard.DisplayManagement.Implementation.DisplayHelper.TryInvoke(InvokeBinder binder, Object[] args, Object& result) in \orchard1.7\src\Orchard\DisplayManagement\Implementation\DisplayHelper.cs:Zeile 29.
bei CallSite.Target(Closure , CallSite , Object , Object )
bei ASP._Page_Modules_Orchard_MediaLibrary_Views_admin_MediaItems_cshtml.<Execute>b__3(MediaManagerMediaItemViewModel x) in orchard1.7\src\Orchard.Web\Modules\Orchard.MediaLibrary\Views\Admin\MediaItems.cshtml:Zeile 8.
bei System.Linq.Enumerable.WhereSelectListIterator
2.MoveNext()
bei System.Linq.Buffer1..ctor(IEnumerable1 source)
bei System.Linq.Enumerable.ToArray[TSource](IEnumerable1 source)
bei ASP._Page_Modules_Orchard_MediaLibrary_Views_admin_MediaItems_cshtml.Execute() in \orchard1.7\src\Orchard.Web\Modules\Orchard.MediaLibrary\Views\Admin\MediaItems.cshtml:Zeile 5.
bei System.Web.WebPages.WebPageBase.ExecutePageHierarchy()
bei System.Web.Mvc.WebViewPage.ExecutePageHierarchy()
bei System.Web.WebPages.WebPageBase.ExecutePageHierarchy(WebPageContext pageContext, TextWriter writer, WebPageRenderingBase startPage)
bei System.Web.Mvc.RazorView.RenderView(ViewContext viewContext, TextWriter writer, Object instance)
bei System.Web.Mvc.BuildManagerCompiledView.Render(ViewContext viewContext, TextWriter writer)
bei System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context)
bei System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult)
bei System.Web.Mvc.ControllerActionInvoker.<>c__DisplayClass1a.<InvokeActionResultWithFilters>b__17()
bei System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func
1 continuation)
Coordinator
Sep 26, 2013 at 6:23 AM
Please see answers above.
Sep 26, 2013 at 7:57 PM
As indicated above, there is already a bug report with a temporary fix about this problem (it comes from a missing media, but migration should take care of this in my point of view). Sorry, I forgot to edit my message with the link. It's here: http://orchard.codeplex.com/workitem/19919. I've applied that fix and run the migration again. That fixed my problem.
Oct 18, 2013 at 12:16 AM
I'm running 1.7.1, which has that code in it, and I still have the same problem with not being able to create any of my content types .. same
"Input string was not in a correct format" from MediaLibraryPickerField.cs Line: 38

hoping I've missed another fix from somewhere
Oct 29, 2013 at 6:58 AM
I also have the same problem with Version 1.7.1.

I tried to update from 1.6 to 1.7.1 several time already. Upgrade the MediaLibraryPickerField caused the same error as described from, last poster and some others too.

I hope someone can help
Nov 5, 2013 at 3:08 PM
sebastienros wrote:
Well you should have "Migrated" the field to the new type. Enable the Upgrade module and for to the Media Library tab.
sebastien you say "should". Is there any documentation that tells us what we "should" do when upgrading to a specific version of Orchard? The only 1.7.1-specific documentation I can find is with respect to Azure support (http://docs.orchardproject.net/).
Nov 5, 2013 at 3:49 PM
General upgrade documentation is available here: http://docs.orchardproject.net/Documentation/Upgrading-a-site-to-a-new-version-of-Orchard

Version specific upgrade instructions are part of the release notes of each release. For 1.7 upgrade instructions for Media Library are here: http://docs.orchardproject.net/Documentation/Orchard-1-7-Release-Notes#ImportingMediafilesintotheMediaLibrary
Dec 5, 2013 at 3:26 PM
Regarding the 1.7 upgrade instructions for the Media Library upgrade. I was only able to get it working on a 1.6 to 1.7.2 upgrade of Orchard by this small change to the instructions.

Instead of disabling the module Media at the beginning I left it enabled and only after I had run the migrations did I disable it.

As always back up before you try.
Apr 6 at 8:18 PM
This issue is still present in Orchard Version 1.8 - "Input string was not in a correct format" from MediaLibraryPicker.SummaryAdmin.cshtml Line 8. I find it impossible to upgrade from 1.6 to 1.8. Not fun!

I'll see if I can generate a simple website in 1.6 that demonstrates this so I may describe how to recreate it if anyone is interested in having a look at this problem.