I noticed this unexpected entry in the trace log on one of our on-premise 2013 farms:

85c6b8ca-b2a3-4c6e-8a9f-d60d96224577 Stack trace:   
    at Microsoft.SharePoint.SPFile.GetFileStream(OpenBinaryFlags openOptions, String etagNotMatch, String& etagNew, String& contentTagNew)    
    at Microsoft.SharePoint.SPFile.OpenBinaryStream(SPOpenBinaryOptions openOptions, String etagNotMatch, String& etagNew)    
    at Microsoft.SharePoint.SPFile.OpenBinaryStream(SPOpenBinaryOptions openOptions)

I also managed to find the source of the exception which is inside a custom timerjob:

SPFile file = null;
using (var site = new SPSite(siteCollectionUrl))
    file = site.RootWeb.GetFile(folderRelativeFilePath);
var stream = file.OpenBinaryStream(); // this call throws the above exception

The file type of the file in question is XSD and I have already verified that the XSD-syntax is correct. I am also able to replicate the error on my development environment but the exception is not thrown in debug mode. My question is why I am seeing a GUID instead of the message for the exception and is there any way of getting the actual message? This is a similar question to this stackexchange question but with some important differences:

  • The exception is thrown from native code in SPFile.GetFileStream and not in any custom code.
  • The GUID is not the correlation id, feature id or any other GUID in the VS Solution or trace log.

I should also mention that the code runs fine in spite of the exception being thrown.

  • Did you try checking in ULS log? – Ankit Kumar Apr 20 '16 at 13:17
  • Have you tried a try-catch to see if the error message is more specific? – Erin L Apr 20 '16 at 13:39
  • That is where the exception came from, ULS log and trace log is the same thing – Stig Perez Apr 20 '16 at 13:40
  • Is this a result of the "throw new SPException(message);" ? – George Grainger Apr 20 '16 at 14:47
  • @ErinL Yes but the exception is not thrown when I debug the code. Even if I configure VS to throw all CLR exceptions it appears to be caught and handled internally – Stig Perez Apr 22 '16 at 5:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.