Hi,
When we call the following C/CAL code in NAV2013R2 we sometimes get errors in the middle tier and on the client. This was written for V5.00 and has worked fine in classic for the last 8 years.
Has anyone had issues with SETSELECTIONFILTER raising errors on the middle tier server?
The results in the call stack for ANOTHER user AfterGetCurrRecord()
Type: System.Collections.Generic.KeyNotFoundException
Message: The given key was not present in the dictionary.
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.Dynamics.Nav.Runtime.DataAccess.<>c__DisplayClass15.<TryHandleAsPrimaryKeyLookup>b__14(NCLMetaField f)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Dynamics.Nav.Runtime.DataAccess.TryHandleAsPrimaryKeyLookup(DataCacheRequest request, Boolean cacheOnly, MutableRecordBuffer& recordBuffer)
at Microsoft.Dynamics.Nav.Runtime.DataAccess.InnerFind(FindCacheRequest request, Boolean fromPosition, Func`1 onlyCurrentKeyNeededForNextRow)
at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.IssueFindRequest(DataError errorLevel, Boolean reversed, FindType findType, Boolean useCache)
at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.FindRecordSet(DataError errorLevel, Boolean forUpdate)
at Microsoft.Dynamics.Nav.Runtime.NavRecord.ALFindSet(DataError errorLevel, Boolean forUpdate, Boolean updateKey)
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncInValidSelections_Scope.OnRun() - BROKE HERE WHILE DOING FIND
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncSetButtons_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncSetButtons()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.OnAfterGetCurrRecord() - MOVED RECORDS
at Microsoft.Dynamics.Nav.Runtime.NavForm.AfterGetCurrRecord()
Source: mscorlib
HResult: -2146232969
This results in the call stack when ANOTHER user clicked ActOpen:
Type: System.Collections.Generic.KeyNotFoundException
Message: The given key was not present in the dictionary.
StackTrace:
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at Microsoft.Dynamics.Nav.Runtime.DataAccess.<>c__DisplayClass15.<TryHandleAsPrimaryKeyLookup>b__14(NCLMetaField f)
at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
at System.Linq.Buffer`1..ctor(IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Microsoft.Dynamics.Nav.Runtime.DataAccess.TryHandleAsPrimaryKeyLookup(DataCacheRequest request, Boolean cacheOnly, MutableRecordBuffer& recordBuffer)
at Microsoft.Dynamics.Nav.Runtime.DataAccess.InnerFind(FindCacheRequest request, Boolean fromPosition, Func`1 onlyCurrentKeyNeededForNextRow)
at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.IssueFindRequest(DataError errorLevel, Boolean reversed, FindType findType, Boolean useCache)
at Microsoft.Dynamics.Nav.Runtime.RecordImplementation.FindRecordSet(DataError errorLevel, Boolean forUpdate)
at Microsoft.Dynamics.Nav.Runtime.NavRecord.ALFindSet(DataError errorLevel, Boolean forUpdate, Boolean updateKey)
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncInValidSelections_Scope.OnRun() - BROKE HERE WHILE DOING FIND
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncSetButtons_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncRefresh_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncRefresh()
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncOpenInstruction_Scope.OnRun()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.FncOpenInstruction()
at Filter.InvokeWithFilter(NavMethodScope )
at Microsoft.Dynamics.Nav.BusinessApplication.Page50031.ActOpen_a45_OnAction() - CLICKED THIS
Source: mscorlib
HResult: -2146232969