New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New function request: GETCALLSTACK #2019
Comments
We are looking too for a possibilty to get the callstack. A command like requested would be very helpful. |
Any news on this issue? |
Hi, I can also add that there is a platform function like that and it is used for GetLastErrorCallStack(). In assembly Microsoft.Dynamics.Nav.Ncl.dll there is an internal function NavSession.GetCurrentCallStack(). using Microsoft.Dynamics.Nav.Runtime; // need to reference Microsoft.Dynamics.Nav.Ncl.dll
using System;
using System.Reflection;
namespace NavCallStack
{
public class NavCallStack
{
public string GetCurrentCallStack()
{
MethodInfo methodInfo =
typeof(NavSession)
.GetMethod(
"GetCurrentCallstack", BindingFlags.NonPublic | BindingFlags.Instance, null, new[] { typeof(Func<NavApplicationObjectBase, string>) }, null);
if (methodInfo == null)
throw new NullReferenceException("Could not find method NavSession.GetCurrentCallstack(Func<NavApplicationObjectBase, string>).");
return (string)methodInfo.Invoke(NavCurrentThread.Session, new object[] { new Func<NavApplicationObjectBase, string>(a => a.ObjectName) });
}
}
} Example output:
|
Closing, tracked in idea |
Still relevant and should be simple enough to implement since it already exists, just not available.. |
I've posted it on Yammer on November 1st, 2017, but not sure if anyone seen it.
(see https://www.yammer.com/dynamicsnavdev/#/Threads/show?threadId=974473209)
I would like to vote for a new function, accessible from AL called GETCALLSTACK.
The function should be similar to GETLASTERRORCALLSTACK, but then accessible whenever needed, without throwing an Error first.
When using events, it would be very benificial to find out from where the event was originated through the callstack.
My current solution (fully .Net based in C/AL) will of course not work anymore in AL.
And using a TryFunction with explicit Error and then GETLASTERRORCALLSTACK is not the right way to go from my opinion.
Even worse: It's not even allowed anymore to use TryFunctions in AL, so there's not even an alternate solution right now :-(
The text was updated successfully, but these errors were encountered: