ValueFactory attempted to access the Value property of this instance



I Installed the module and immediately got the following error.

ValueFactory attempted to access the Value property of this instance across my whole orchard installation. Tried 2 different installations on 2 different servers, got the same thing.


turnera61 wrote Apr 17, 2012 at 4:59 AM

I've dug a bit further, this seems to only happen then the module 'Media Folder' is installed aswell.

Unfortunately I need the media folder module so will have to do without

w1ld wrote Jun 8, 2012 at 1:13 PM

anoordende wrote Oct 25, 2012 at 2:54 PM

I ran into the same issue with using the image gallery and the media folder modules. In the constructor of ImageGalleryService the following statement causes a circular dependency:
        if (!MediaService.GetMediaFolders(string.Empty).Any(o => o.Name == ImageGalleriesMediaFolder)) {
            MediaService.CreateFolder(string.Empty, ImageGalleriesMediaFolder);}
Options are a) comment out this code and ensure the "ImageGalleries" folder is created manually in the Media location or b) move this code elsewhere, e.g. to the method CreateImageGallery so that this gets created upon creating the first gallery... and c) whatever else you can come up with.

In addition, HttpPostedFileBase.FileName returns the full path when uploading a file, hence you need to update the AddImage method to the following to just get the filename:
    public void AddImage(string imageGalleryName, HttpPostedFileBase imageFile) {            
        AddImage(imageGalleryName, Path.GetFileName(imageFile.FileName), imageFile.InputStream);
Hope this helps.