Hi Marthin, were you able to resolve this issue because I am also facing a similar issue?
I have had a simular issue once. It was some files in the VPP that was created, but didn't exists.
I used this code to fix the problem
protected void Button12_Click(object sender, EventArgs e)
{
StartIndexOnItemLit.Text = "";
StringBuilder builder=new StringBuilder();
VirtualPathHandler instance = VirtualPathHandler.Instance;
foreach (var a in VirtualPathHandler.Instance.VirtualPathProviders.Keys)
{
if (a is VirtualPathUnifiedProvider)
{
var dir = instance.GetDirectory((a as VirtualPathUnifiedProvider).VirtualPathRoot, true);
foreach (var element in dir.Children)
{
CheckItem(builder, element);
}
}
}
StartIndexOnItemLit.Text="<ul>"+builder.ToString()+"</ul>";
// Itera.Cms5Provider.AddToIndexer.Current.AddToIndex(StartIndexOnItem.Text, true, false);
}
private void CheckItem(StringBuilder builder, object element)
{
if (element is UnifiedDirectory)
{
CheckDir((element as UnifiedDirectory), builder);
}
if (element is UnifiedFile)
{
CheckFil((element as UnifiedFile), builder);
}
}
void CheckDir(UnifiedDirectory dir, StringBuilder builder)
{
try
{
builder.AppendLine("<ul>");
foreach (var a in dir.Children)
{
CheckItem(builder, a);
}
builder.AppendLine("</ul>");
}
catch (System.Exception error)
{
builder.AppendLine(dir.Name+" "+dir.VirtualPath+" "+error.Message+" "+error.StackTrace);
}
}
void CheckFil(UnifiedFile fil,StringBuilder builder)
{
try
{
var a = fil.Summary;
}
catch (Exception error)
{
builder.AppendLine("<li>deleting file since source don't exists " + fil.VirtualPath + "</li>");
fil.Delete();
}
}
Awesome! I had the exact same problem with the VersioningFileSummary nullreference. This code helped me resolving this issue, thank you.
you are welcome. Took myself some time to understand why. In my case it was a FileCreate event that throw an error
Anders, thanks a lot for sharing this! Saved me a lot of (unnecessary) work! :) Cheers!
Hi Anders,
I got a similar error but I wonder if you could explaon some more abput where you use the code you posted?
Best regards,
Carl
Carl, in my case I added an admin plugin with a button - and then added an event handler for that button's click event to execute Anders' code.
he reason for the inconsistencies in my case was that I was trying to set file properties before I had written data to the file.
When I try to open Global Files in File management Action Window I get a System.NullReferenceException on EPiServer.Web.Hosting.Versioning.VersioningFileSummary..ctor(FileItem file, FileOperations fileOp).
My setup is two servers with EPiServer 5.2.375.133 installed. Both joined to same domain. VPP files are stored on a third server in the same domain. AppDomain user is a domain account with modify permissions on the fileshare. Both servers use the same database. Remote events are configured for cache invalidation.
All worked fine until yesterday. The problem started after I uploaded an image, cropped it and saved it with a new name and then deleted the new cropped file. During the delete operation/request there was some kind of performance related problem within the environment. After the delete operation I always get the exception described above when I try to browse Global Files in File management. The VPP for Global Files is a EPiServer.Web.Hosting.VirtualPathVersioningProvider with default configuration.
The uploaded file and the cropped file still exist on the fileshare. The filename of the files also exists in the tblItems table, but the pkID is not the same as the guid on the fileshare. When viewing the site in viewmode, images from global files can be viewed.
There seams to be one or two files miss referenced in the VPP. Anyone knows how to fix this? And should this ever happen?