SharePoint 2013: nativehr0x80070002ativehrnativestackativestack error when documents are uploaded to a document library and workflow does not move to relevant folder

Hi Experts,

I am frequently experiencing an error in my SharePoint 2013 on premise environment when users try to upload a document to a document library. When a user uploads a document, the person is asked to fill out two fields (both are lookups). Afterward, the workflow should send the document to a 'To Be Approved' folder. However, this is not happening for 'some' documents so they get stuck. Not every document is failing to move. A developer created a custom Visual Studio workflow so the solution is deployed as a .WSP to the farm. I do not have access to the source code. The attached .PNG file shows the error that is logged in a custom list called 'Logs' in SharePoint. However, I obtained the ULS logs for that time and I have added that below. The build information is Windows Server 2012 R2 (Build 9600​) with SharePoint 2013 v.15.0.4727.1000​​​​​​. Any help / guidance is much appreciated. Further, how can one see the source code in the .WSP file.

Note: Below, I have changed the user's staff id to 'user id' and I have re-named the .pdf file.

ULS Log:
ttidLogWssCellStgConcise [Url: Incoming Documents/test123.pdf][User: i:0#.w|user id (NonCobaltOriginated)][StreamSizes: Request=0 bytes, Response=0 bytes][TotalRequestTime: 16msec][PartitionID: Default][Request: PutChanges **FFU Pri=0 Result=Success][cbOld=0][cbNew=111464][cLR:0][MD:0=AutoGenerated.OOF.No.NoOtherUsers.FutureOpen.Recently.DocumentIsActive.Content.Wired.None.Normal][cBCQ=0][cbCQ=0][cBRB=0][cbRB=0][cbREB=0][cBHBW=4][cbHBW=113262][cbHBEW=257280][cBHBDel=0][Mngd]
Ciaran FogartyAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Piotr StrycharzSoftware/web developerCommented:
Please provide more log lines (at least 10, but up to several dozens lines are associated with the single request).

Source code can be easily viewed with IlSpy utility; you should unpack WSP first and look for DLL file from it.
Ciaran FogartyAuthor Commented:
Thanks Piotr for the link to the decompiler.

ULS logs as requested:

Category      Level      Message      Correlation
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      0ea9989e-69f4-60dd-3cd2-37c3bd6ceb92
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      0fa9989e-3918-60dd-b238-b87b259172f7
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      0fa9989e-3919-60dd-b238-b5e50595e626
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      13a9989e-4930-60dd-904a-ee7397e4122f
Personal Site Instantiation      Medium      Call to PersonalSiteInstantiationState::Init for user id with IsUserSelf(): True, IsProfileAdmin: False, resulted in m_bCanUseStorage: True, m_bCanUseMicrobloggingAndFollowing: True, m_bCanPersonalize: True, m_bCanFollowTagsAndUsers: True, [MySiteHost Found?=True CompatLevel=15 Licensed?=True URL=https://site:123] StackTrace:   at Microsoft.Office.Server.UserProfiles.UserProfile.PersonalSiteInstantiationContext.Init(UserProfileManager objManager, UserProfile userProfile, SPSite mySiteHost)     at Microsoft.Office.Server.UserProfiles.UserProfile.PersonalSiteInstantiationContext..ctor(UserProfileManager objManager, UserProfile userProfile)     at Microsoft.Office.Server.UserProfiles.UserProfile.InitPersonalSiteInstantiationContext()     at Microsoft.SharePoint.Portal.WebControls.FeedWebPartBase.SetUpInitialData(Boolean isSiteFeed, String siteId)     at Microsoft.SharePoint.Portal.WebControls.SiteFeedWebPart.OnPreRender(Object sender, EventArgs e)     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Control.PreRenderRecursiveInternal()     at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)     at System.Web.UI.Page.ProcessRequest()     at System.Web.UI.Page.ProcessRequest(HttpContext context)     at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()     at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)     at System.Web.HttpApplication.PipelineStepManager.ResumeSteps(Exception error)     at System.Web.HttpApplication.BeginProcessRequestNotification(HttpContext context, AsyncCallback cb)     at System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.UnsafeIISMethods.MgdIndicateCompletion(IntPtr pHandler, RequestNotificationStatus& notificationStatus)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotificationHelper(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)     at System.Web.Hosting.PipelineRuntime.ProcessRequestNotification(IntPtr rootedObjectsPointer, IntPtr nativeRequestContext, IntPtr moduleData, Int32 flags)      13a9989e-4930-60dd-904a-ee7397e4122f
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      13a9989e-797f-60dd-3cd2-39a239b246de
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      13a9989e-d9e8-60dd-904a-e9b0f66e2653
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      14a9989e-79a3-60dd-3cd2-352df5aacbaf
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      14a9989e-e9e5-60dd-3cd2-357e515a92ab
Claims Authentication      Medium      STS Call Claims Windows: Successfully requested sign-in claim identity for user 'user id'.      24e0640e-e044-4ca4-a079-606ea8f61b18
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      16a9989e-e956-60dd-904a-e16b116ba479
Client File Access      Medium      ttidLogWssCellStgConcise [Url: Incoming Documents/test123.pdf][User: i:0#.w|user id (NonCobaltOriginated)][StreamSizes: Request=0 bytes, Response=0 bytes][TotalRequestTime: 0msec][PartitionID: Default][Request: PutChanges **FFU Pri=0 Result=Success][cbOld=0][cbNew=9876][cLR:0][MD:0=AutoGenerated.OOF.No.NoOtherUsers.FutureOpen.Recently.DocumentIsActive.Content.Wired.None.Normal][cBCQ=0][cbCQ=0][cBRB=0][cbRB=0][cbREB=0][cBHBW=1][cbHBW=11093][cbHBEW=64320][cBHBDel=0][Mngd]      16a9989e-e956-60dd-904a-e16b116ba479
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      16a9989e-c989-60dd-3cd2-312bd874ff7d
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      16a9989e-b9df-60dd-3cd2-3b2b66673241
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      16a9989e-f9ff-60dd-3cd2-386abae2e30b
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      17a9989e-b905-60dd-904a-eaa1bb3ce6e5
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      17a9989e-a937-60dd-3cd2-349f36bc8775
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      17a9989e-a937-60dd-3cd2-3f496047a26e
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      17a9989e-29c3-60dd-904a-e440db0272a3
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      18a9989e-296e-60dd-3cd2-3374c57eb98f
Authentication Authorization      Medium      Non-OAuth request. IsAuthenticated=True, UserIdentityName=0#.w|user id, ClaimsCount=284      19a9989e-b950-60dd-3cd2-314401fef7ed
Claims Authentication      Medium      STS Call Claims Windows: Successfully requested sign-in claim identity for user 'user id'.      ae46d655-bcef-43b5-b64f-8cebee03a25e
Piotr StrycharzSoftware/web developerCommented:
Still, it seems that you logs do not contain error you spotted (there is no 0x80070002 string in there). In general the 0x80070002 is FILE_NOT_FOUND error. Example (in Powershell):

PS C:\> $site = Get-SPSite http://site
PS C:\> $site.OpenWeb([Guid]::NewGuid())
Exception calling "OpenWeb" with "1" argument(s): "<nativehr>0x80070002</nativehr><nativestack></nativestack>"
At line:1 char:1
+ $site.OpenWeb([Guid]::NewGuid())
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
    + FullyQualifiedErrorId : FileNotFoundException

Open in new window


The error is too general to be able to deduce from it. You need to search more logs.
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Ciaran FogartyAuthor Commented:
I also got this from the logs which confirms your point. That ILSpy tool is good but I'm not sure that 100% of the code is there? Anyway, I may have to add code after de-compiling to get it back working as per functional requirement or look at developing an alternative using Nintex (could be budget constraints there). What do you think Piotr?

System.IO.FileNotFoundException: <nativehr>0x80070002</nativehr><nativestack></nativestack>, StackTrace:  
 at Microsoft.SharePoint.SPWeb.GetFileOrFolderProperties(String strUrl, ListDocsFlags listDocsFlags, Boolean throwException, SPBasePermissions& permMask)    
 at Microsoft.SharePoint.SPFile.PropertiesCore(Boolean throwException)    
 at Microsoft.SharePoint.SPFile.get_CheckOutType()    
 at SPSite.IncomingDocumentsER.IncomingDocumentsER.<>c__DisplayClass2.<ItemUpdated>b__0()    
 at Microsoft.SharePoint.SPSecurity.<>c__DisplayClass5.<RunWithElevatedPrivileges>b__3()    
 at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)    
 at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)    
 at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)    
 at SPSite.IncomingDocumentsER.IncomingDocumentsER.ItemUpdated(SPItemEventProperties properties)    
 at Microsoft.SharePoint.SPEventManager.RunItemEventReceiver(SPItemEventReceiver receiver, SPUserCodeInfo userCodeInfo, SPItemEventProperties properties, SPEventContext context, String receiverData)    
 at Microsoft.SharePoint.SPEventManager.RunItemEventReceiverHelper(Object receiver, SPUserCodeInfo userCodeInfo, Object properties, SPEventContext context, String receiverData)    
 at Microsoft.SharePoint.SPEventManager.<>c__DisplayClassa`1.<InvokeEventReceiver>b__7()    
 at Microsoft.SharePoint.SPSecurity.RunAsUser(SPUserToken userToken, Boolean bResetContext, WaitCallback code, Object param)    
 at Microsoft.SharePoint.SPEventManager.InvokeEventReceiver[ReceiverType](SPUserToken userToken, Guid tranLockerId, RunEventReceiver runEventReceiver, Object receivers, Int32 n, Object properties, SPEventReceiverOperationsType operationsType, Boolean& canceled, String& error)    
 at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPRemoteEventReceiverCallType remoteCallType, SPUserToken userToken, Guid tranLockerId, RunEventReceiver runEventReceiver, RunRemoteEventReceiver runRemoteEventReceiver, Object receivers, Object properties, Boolean checkCancel, SPEventReceiverOperationsType operationsType)    
 at Microsoft.SharePoint.SPEventManager.InvokeEventReceivers[ReceiverType](SPRemoteEventReceiverCallType remoteCallType, Byte[] userTokenBytes, Guid tranLockerId, RunEventReceiver runEventReceiver, RunRemoteEventReceiver runRemoteEventReceiver, Object receivers, Object properties, Boolean checkCancel, SPEventReceiverOperationsType operationsType)    
 at Microsoft.SharePoint.SPEventManager.HandleEventCallback[ReceiverType,PropertiesType](Object callbackData)    
 at Microsoft.SharePoint.Utilities.SPThreadPool.WaitCallbackWrapper(Object state)    
 at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)    
 at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)    
 at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()    
 at System.Threading.ThreadPoolWorkQueue.Dispatch()
Piotr StrycharzSoftware/web developerCommented:
Well, it seems there is a bug in the event code. You may share decompiled code for us if it is not secret, NDA, or sth (SPSite.IncomingDocumentsER.IncomingDocumentsER.ItemUpdated method). However, if we see the code or not - the producer must make corrections. This is something related to the document being moved. Do you use library with minor versions and force checkout? If so - checked out document with version 0.1 is visible only to the author (RunWithElevatedPriviliges does not see it [=File not found??]). Have no other ideas so far.

You may also consider running out-of-box workflow, SharePoint Designer workflow or just using built-in library approval.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ciaran FogartyAuthor Commented:
Hi Piotr, thanks for your helpful reply. Unfortunately, I cannot share the code. As far as I am aware, version history was not considered because it is just a 'drop-off' library. The document is moved immediately after the two SharePoint metadata columns are filled in.  However, you have given me direction and I can now plan the next steps. I am grateful for your assistance. Agree, code must be corrected. SP Designer and library approvals are viable alternatives. I'm happy to mark your latest reply as a recommended solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SharePoint

From novice to tech pro — start learning today.