Customization Error-“Exception has been thrown by the target of an invocation"

Dear Sanjeev, below mentioned issue is coming.

Application Error

Exception caught in: mscorlib

Error Detail

Message: Exception has been thrown by the target of an invocation.
Inner Exception Message: Object reference not set to an instance of an object.
Program: CommonLanguageRuntimeLibrary
Method: InvokeMethod

Client Stack Trace

at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Ice.Ewa.MetadataExtractor.AssemblyLoader.TranslateCustomCode(String vdir, String assemblySubFolder, String uiappFormName, Boolean isDevMode)

Inner Exception

Object reference not set to an instance of an object.

at DDW.ExpressionStatement…ctor(ExpressionNode expression)
at DDW.Parser.ParseStatement()
at DDW.Parser.ParseBlock(BlockStatement node, Boolean isCase)
at DDW.Parser.ParseIf()
at DDW.Parser.ParseStatement()
at DDW.Parser.ParseBlock(BlockStatement node, Boolean isCase)
at DDW.Parser.ParseIf()
at DDW.Parser.ParseStatement()
at DDW.Parser.ParseBlock(BlockStatement node, Boolean isCase)
at DDW.Parser.ParseIf()
at DDW.Parser.ParseStatement()
at DDW.Parser.ParseBlock(BlockStatement node, Boolean isCase)
at DDW.Parser.ParseTry()
at DDW.Parser.ParseStatement()
at DDW.Parser.ParseBlock(BlockStatement node, Boolean isCase)
at DDW.Parser.ParseMethod(IType type, QualifiedIdentifierExpression name)
at DDW.Parser.ParseClassMember()
at DDW.Parser.ParseClass()
at DDW.Parser.ParseNamespaceOrTypes()
at DDW.Parser.Parse(TokenCollection tokens, List`1 strings)
at Ice.Ewa.TranslationTool.TranslationEngine.parseFile(StreamReader sr, String fileName, RulesManager rules)
at Ice.Ewa.TranslationTool.TranslationEngine.TranslateCustomCode(ILaunch Sender)

Have you created any custom dll for this customization

No, I didn’t created any custom dll.

According to your code you used UD Column. Have you re-generate the data-model ?

Yes, we have already re-generate the data-model.

In Dashboard Customization Epicor had a bug it didnt know how to parse [] or < > within a method. Which could mean that you have something in your code, it struggles with for example:

// Dashboard Customizations didnt like stuff like this
List<string> Hello() { ... }

It would all save but during runtime it would cause an error.

As harsh as it sounds, maybe you need to start peeling your code away, delete a method, generate and test until you narrow down the culprit section… Who knows maybe it doesnt like #region - or - if statements without { and } - perhaps it doesnt like .AsEnumerable()

1 Like