----- Original Message -----Sent: Friday, May 30, 2014 12:02 PMSubject: [Vantage] Re: Customization Error - Object reference not set to an instance of an objectI will look through the customization code again sometime next week to make sure I'm disposing of all my objects properly.
I don't feel comfortable running that batch file because we are running in a Citrix environment. Everyone's Epicor folders are located on two terminal servers. If something went wrong, it wouldn't just affect that single person. But thank you for the idea. I can take the "cache" idea into consideration when troubleshooting this further. :)
I have customizations set up in Job Tracker and Job Entry (Vantage 8.03.410). A few months back, I added functionality to change the operation and material nodes in the method tree to red if it is an added op or an added material.
Not long ago, an end user told me errors pop up when trying to launch either of these screens. They click ok and can continue but the red functionality no longer works for that session. They said the errors have been happening for a really long time (they just didn't tell me until now) so I'm not sure if the method tree functionality is what causes the error or if it is something else in the customization.
The odd thing is, it works sometimes. This may be a coincidence but when it starts giving errors, I go in and recompile the two relevant customizations and the errors go away for a while.
Below is the error message along with my code for the Job Tracker customization.
Does anyone have any ideas of what is causing this??
Error Detail
============
Exception has been thrown by
the target of an invocation.
Stack Trace
===========
at
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments,
SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle
typeOwner)
at
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments,
Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture, Boolean
skipVisibilityChecks)
at
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr,
Binder binder, Object[] parameters, CultureInfo culture)
at
Epicor.Mfg.UI.Customization.CustomScriptManager.initCustomAssembly(Assembly
assm)
Inner Exception
===============
Object reference not set to an
instance of an object.
Inner Stack Trace
=================
'//
'// Custom VB.NET code for JobTrackerForm
'// Created: 12/29/2007 3:13:47 PM
'//
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO
Imports System.Reflection
Module Script
'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **
Private WithEvents oTrans_adapter As EpiBaseAdapter
Private WithEvents edvJobHead As EpiDataView
Private WithEvents edvCustJobHeadPartRevTrack As EpiDataView
'// End Wizard Added Module Level Variables **
'// Add Custom Module Level Variables Here **
Dim jobNum as String
Dim assemblOpSeq as Integer
Dim assemblMtlSeq as Integer
Dim jobOper As JobOperSearch
Dim jobOpDS As JobOperListDataSet
Dim addedOps(0) As Integer
Dim jobMtl As JobMtlSearch
Dim jobMtlDS As JobMtlListDataSet
Dim addedMtls(0) As Integer
Private WithEvents theJobTree As Epicor.Mfg.UI.FrameWork.JobLib.MethodTree
Dim fi As FieldInfo
Dim tvp As Epicor.Mfg.UI.FrameWork.JobLib.MethodTreePanel
Sub InitializeCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization
oTrans_adapter = csm.TransAdaptersHT("oTrans_adapter")
edvJobHead = CType(oTrans.EpiDataViews("JobHead"), EpiDataView)
edvCustJobHeadPartRevTrack = CType(oTrans.EpiDataViews("CustJobHeadPartRevTrack"), EpiDataView)
'// End Wizard Added Variable Intialization
jobNum = ""
assemblOpSeq = -1
assemblMtlSeq = -1
jobOper = New JobOperSearch(oTrans.Session.ConnectionPool)
jobOpDS = Nothing
Array.Clear(addedOps, 0, addedOps.Length)
jobMtl = New JobMtlSearch(oTrans.Session.ConnectionPool)
jobMtlDS = Nothing
Array.Clear(addedMtls, 0, addedMtls.Length)
'fi = GetType(Epicor.Mfg.UI.App.JobTracker.JobTrackerForm).GetField("jobTreeViewPanel",BindingFlags.NonPublic Or BindingFlags.GetField Or BindingFlags.Instance)
'tvp = fi.GetValue(JobTrackerForm)
'theJobTree = tvp.MethodTree
'// Begin Custom Method Calls
AddAppearancesToECNTextBox()
'// End Custom Method Calls
End Sub
Sub DestroyCustomCode()
'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal
oTrans_adapter = Nothing
edvJobHead = Nothing
edvCustJobHeadPartRevTrack = Nothing
'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal
jobNum = Nothing
assemblOpSeq = Nothing
assemblMtlSeq = Nothing
jobOper = Nothing
jobOpDS = Nothing
addedOps = Nothing
jobMtl = Nothing
jobMtlDS = Nothing
addedMtls = Nothing
If theJobTree Is Nothing = False Then
theJobTree = Nothing
End If
If fi Is Nothing = False Then
fi = Nothing
End If
If tvp Is Nothing = False Then
tvp = Nothing
End If
'// End Custom Code Disposal
End Sub
Private Sub JobTrackerForm_Load(ByVal sender As object, ByVal args As EventArgs) Handles JobTrackerForm.Load
Try
fi = GetType(Epicor.Mfg.UI.App.JobTracker.JobTrackerForm).GetField("jobTreeViewPanel",BindingFlags.NonPublic Or BindingFlags.GetField Or BindingFlags.Instance)
tvp = fi.GetValue(JobTrackerForm)
theJobTree = tvp.MethodTree
Catch
End Try
End Sub
Private Sub AfterExpandTheJobTree(ByVal sender as Object, ByVal args As Infragistics.Win.UltraWinTree.NodeEventArgs) Handles theJobTree.AfterExpand
'edvJobHead = CType(oTrans.EpiDataViews("JobHead"), EpiDataView)
'If args.TreeNode.Text = "Operations" Or args.TreeNode.Text = "Materials" Then
If theJobTree Is Nothing = False Then
ColorTree(args.TreeNode)
End If
'End If
End Sub
Private Sub ColorTree(ByVal n as EpiTreeNode)
Try
jobNum = ""
assemblOpSeq = -1
assemblMtlSeq = -1
'jobOper = New JobOperSearch(oTrans.Session.ConnectionPool)
jobOpDS = Nothing
Array.Clear(addedOps, 0, addedOps.Length)
'jobMtl = New JobMtlSearch(oTrans.Session.ConnectionPool)
jobMtlDS = Nothing
Array.Clear(addedMtls, 0, addedMtls.Length)
'Dim fi As FieldInfo = GetType(Epicor.Mfg.UI.App.JobEntry.JobEntryForm).GetField("jobTreeViewPanel",BindingFlags.NonPublic Or BindingFlags.GetField Or BindingFlags.Instance)
'Dim tvp As Epicor.Mfg.UI.FrameWork.JobLib.MethodTreePanel = fi.GetValue(JobEntryForm)
'theJobTree = tvp.MethodTree
PrintRecursive(n)
Catch
End Try
End Sub
Private Sub PrintRecursive(ByVal n as EpiTreeNode)
Try
Dim nodeOpNum As Integer = Nothing
Dim nodeMtlNum As Integer = Nothing
For Each aNode As EpiTreeNode In n.Nodes
aNode.Override.NodeAppearance.ForeColor = System.Drawing.Color.Black
If aNode.Text.StartsWith("Opr:") Then
Dim strArray As String() = Split(aNode.Text, Chr(32))
nodeOpNum = CInt(strArray(1))
Array.Clear(strArray, 0, strArray.Length)
If Not(nodeOpNum = Nothing) Then
strArray = Split(aNode.Parent.Parent.Text,Chr(32))
If assemblOpSeq <> CInt(strArray(1)) Then
assemblOpSeq = CInt(strArray(1))
Array.Clear(addedOps, 0, addedOps.Length)
jobOpDS = jobOper.GetList("JobNum = '" + edvJobHead.dataView(0)("JobNum") + "' AND AssemblySeq = " + CStr(assemblOpSeq), 0, 0, False)
Dim nextIndex as Integer = 0
For each r as JobOperListDataSet.JobOperListRow In jobOpDS.JobOperList.Rows
If r.AddedOper = True Then
ReDim Preserve addedOps(nextIndex)
addedOps(nextIndex) = r.OprSeq
nextIndex = addedOps.GetUpperBound(0) + 1
End If
Next
End If
If Not(addedOps Is Nothing) And addedOps.Length > 0 Then
If Array.IndexOf(addedOps,nodeOpNum) > -1 Then
aNode.Override.NodeAppearance.ForeColor = System.Drawing.Color.Red
End If
End If
End If
Else If aNode.Text.StartsWith("Mtl:") Then
Dim strArray As String() = Split(aNode.Text, Chr(32))
nodeMtlNum = CInt(strArray(1))
Array.Clear(strArray, 0, strArray.Length)
If Not(nodeMtlNum = Nothing) Then
If aNode.Parent.Parent.Text <> "Operations" Then
strArray = Split(aNode.Parent.Parent.Text,Chr(32))
Else
strArray = Split(aNode.Parent.Parent.Parent.Text,Chr(32))
End If
If assemblMtlSeq <> CInt(strArray(1)) Then
assemblMtlSeq = CInt(strArray(1))
Array.Clear(addedMtls, 0, addedMtls.Length)
jobMtlDS = jobMtl.GetList("JobNum = '" + edvJobHead.dataView(0)("JobNum") + "' AND AssemblySeq = " + CStr(assemblMtlSeq), 0, 0, False)
Dim nextIndex as Integer = 0
For each r as JobMtlListDataSet.JobMtlListRow In jobMtlDS.JobMtlList.Rows
If r.AddedMtl = True Then
ReDim Preserve addedMtls(nextIndex)
addedMtls(nextIndex) = r.MtlSeq
nextIndex = addedMtls.GetUpperBound(0) + 1
End If
Next
End If
If Not(addedMtls Is Nothing) And addedMtls.Length > 0 Then
If Array.IndexOf(addedMtls,nodeMtlNum) > -1 Then
aNode.Override.NodeAppearance.ForeColor = System.Drawing.Color.Red
End If
End If
End If
End If
PrintRecursive(aNode)
Next
Catch
End Try
End Sub
Private Sub edvCustJobHeadPartRevTrack_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvCustJobHeadPartRevTrack.EpiViewNotification
'// ** Argument Properties and Uses **
'// view.dataView(args.Row)("[FieldName]")
'// args.Row, args.Column, args.Sender, args.NotifyType
'// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
'If (args.NotifyType = EpiTransaction.NotifyType.AddRow) Then
If (args.Row > -1) Then
SetECNTextBackColor()
End If
'End If
End Sub
Private Sub AddAppearancesToECNTextBox()
Try
txtEpiCustom2.Appearances.Clear
Dim yellowAppearance As New Infragistics.Win.Appearance
yellowAppearance.BackColor = Drawing.Color.Yellow
yellowAppearance.Key = "ECNInProcess"
Dim blueAppearance As New Infragistics.Win.Appearance
blueAppearance.BackColor = Drawing.Color.SkyBlue
blueAppearance.Key = "ECNNotInProcessHasECNText"
Dim noAppearance As New Infragistics.Win.Appearance
noAppearance.BackColor = Drawing.Color.Empty
noAppearance.Key = "NoBackColor"
txtEpiCustom2.Appearances.Add(yellowAppearance)
txtEpiCustom2.Appearances.Add(blueAppearance)
txtEpiCustom2.Appearances.Add(noAppearance)
Catch
End Try
End Sub
Private Sub SetECNTextBackColor()
Try
txtEpiCustom2.Appearance = txtEpiCustom2.Appearances("NoBackColor")
If edvCustJobHeadPartRevTrack.dataView.Count > 0 Then
If edvCustJobHeadPartRevTrack.dataView(edvCustJobHeadPartRevTrack.Row)("CheckBox03") = True Then
txtEpiCustom2.Appearance = txtEpiCustom2.Appearances("ECNInProcess")
Else If TRIM(edvCustJobHeadPartRevTrack.dataView(edvCustJobHeadPartRevTrack.Row)("Character03")) <> ""
txtEpiCustom2.Appearance = txtEpiCustom2.Appearances("ECNNotInProcessHasECNText")
End If
End If
txtEpiCustom2.Refresh()
Catch
End Try
End Sub
End Module
Do you remember if you deleted any custom fields from one of the tabs?
This is where I find the error comes from with mine.
Did you try "Test Code" under Tools or F5 in the customization that might help.
does the detail of the error give you any clues? are there any fields that are either greyed out or have a red X on them once the screen loads?
sometimes you can load in customization mode and make one small change and compile and that will fix.
You can also use customization maintenance and run verify. Hopefully this will point out the error and then you can delete the problem.
The next level would be to show custom data and remove by hand. Be sure to export or make a copy first because you can wreck things quickly here.
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Friday, May 30, 2014 8:53 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Customization Error - Object reference not set to an instance of an object
Anyone have any ideas what this could be?
CONFIDENTIALITY NOTICE
The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at 727-578-6280 and immediately delete the communication.
"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."
No. The error is quite generic (I posted it in my initial request). No fields are greyed out or have an X on them. The verify also runs fine.
The thing I'm confused about is everything builds fine and it is in use in our live system. Eventually, those two screens start having issues down the road (without any modifications to either of those customizations).
If there were no changes on the customization end from the time it works to the time it starts having errors, what would the cause be?
(Note: A month or so back, I even rebuilt the customization from scratch to eliminate any custom data that wasn't suppose to be there.)
It could be a conflict with another module or old cached info. I have a batch file (below) that cleans out all of Epicor’s cached info to clear up odd issues. Only run while Epicor is closed.
Is it possible that an object didn’t get disposed in this or another customization that has the same name?
rem Windows 7
rd /S /Q c:\ProgramData\Epicor
rem Windows XP
rd /S /Q "c:\Documents and Settings\All Users\Application Data\Epicor"
From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com]
Sent: Friday, May 30, 2014 11:16 AM
To: vantage@yahoogroups.com
Subject: [Vantage] Re: Customization Error - Object reference not set to an instance of an object
No. The error is quite generic (I posted it in my initial request). No fields are greyed out or have an X on them. The verify also runs fine.
The thing I'm confused about is everything builds fine and it is in use in our live system. Eventually, those two screens start having issues down the road (without any modifications to either of those customizations).
If there were no changes on the customization end from the time it works to the time it starts having errors, what would the cause be?
(Note: A month or so back, I even rebuilt the customization from scratch to eliminate any custom data that wasn't suppose to be there.)
CONFIDENTIALITY NOTICE
The information contained in this communication, including attachments, is privileged and confidential. It is intended only for the exclusive use of the addressee. If the reader of this message is not the intended recipient, or the employee or agent responsible for delivering it to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please notify us at 727-578-6280 and immediately delete the communication.
"This (document/presentation) may contain technical data as defined in the International Traffic In Arms Regulations (ITAR) 22 CFR 120.10. Export of this material is restricted by the Arms Export Control Act (22 U.S.C. 2751 et seq.) and may not be exported to foreign persons without prior approval form the U.S. Department of State."
I will look through the customization code again sometime next week to make sure I'm disposing of all my objects properly.
I don't feel comfortable running that batch file because we are running in a Citrix environment. Everyone's Epicor folders are located on two terminal servers. If something went wrong, it wouldn't just affect that single person. But thank you for the idea. I can take the "cache" idea into consideration when troubleshooting this further. :)