Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics GP (Archived)

GP2015 - PaymentTermsCalculateAvail from VS SDK addin causing GP crashes.

Posted on by Microsoft Employee

I have inherited a VS SDK enhancement that at various points, attempts to calculate payment terms information.

This enhancement was working great under GP2010 and GP2013 however with a recent upgrade to GP2015, this particular routine is causing GP to crash out periodically.

My initial thought is with the changes to the payment terms in GP2015 the routine needs to be updated but from what I can tell, everything matches correctly.

Below is the relevant call that's being made

Microsoft.Dexterity.Applications.DynamicsDictionary.SyPaymentTermsMstrTable syPaymentTermsTable = Dynamics.Tables.SyPaymentTermsMstr;
Microsoft.Dexterity.Applications.DynamicsDictionary.McDefStructureCompositeData mcDefStructureComposite = new McDefStructureCompositeData();
syPaymentTermsTable.Key = 1;
syPaymentTermsTable.PaymentTermsId.Value = strPaymentTerms;
err = syPaymentTermsTable.Get();

if (err == TableError.NoError)
{
	mcDefStructureComposite.CurrencyId = cCurrencyId;
	mcDefStructureComposite.DecimalPlaces = cDecimalPlacesCurrency;
	Microsoft.Dexterity.Applications.Dynamics.Procedures.PaymentTermsCalculateAvail.Invoke(
							     decDocAmount,
							     decDiscountDlrAmount,
							     decDiscountPctAmount,
							     ref decTermsAvailAmount,
							     0,
							     syPaymentTermsTable,
							     mcDefStructureComposite);
}
syPaymentTermsTable.Close();

The crashes that we are seeing are random.   Usually when attempting to close the card in question and/or sometimes after repeated calls.   The crash is always a generic GP has stopped working with a trace of a stack issue.  Even stack dumps show nothing that pinpoints the cause.   It was only after some trial and error that I was able to determine that the above procedure call is the fault.

If I remove the procedure call,  all is well.

As a test, I rewrote the routine to call the PaymentTermsCalculate procedure which results in the same random crashes.

With the enhancements in this area with GP2015, does anyone see any particular issues with the calls or reason that the crashes are occurring?   

*This post is locked for comments

  • Suggested answer
    Almas Mahfooz Profile Picture
    Almas Mahfooz 11,003 User Group Leader on at
    RE: GP2015 - PaymentTermsCalculateAvail from VS SDK addin causing GP crashes.

    Don't know why, I feel your mcDefStructureComposite is causing issue, also you have not set all of it's composite values.

    I will check it with dexterity

  • Tim Wappat Profile Picture
    Tim Wappat 5,701 on at
    RE: GP2015 - PaymentTermsCalculateAvail from VS SDK addin causing GP crashes.

    I would say you are trying all the right things so i can't offer much more.

    Tim.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: GP2015 - PaymentTermsCalculateAvail from VS SDK addin causing GP crashes.

    Two events

    1) SaveButton.ClickBeforeOriginal

    2) PaymentTermsLookup.SelectButton.ClickBeforeOriginal (Microsoft.Dexterity.Applications.SmartListDictionary.PaymentTermsLookupForm)

    I've played around with the events as well trying to isolate if it was just one specific event that was causing it however that didn't seem to make a difference.  

    The actual screen this is applied to is the WennSoft Job invoice entry.

    Obviously I've already validated the DLL is DAG'd against the correct modified forms dictionary.

    I've even removed all references to the form fields and hard set variables for the calls just to make the call.   That results in the same crashes.

    I keep coming back around to think that it has something to do w/ the composite.   Either that's not being setup properly which is causing a stack imbalance or that needs to be disposed somehow.

  • Tim Wappat Profile Picture
    Tim Wappat 5,701 on at
    RE: GP2015 - PaymentTermsCalculateAvail from VS SDK addin causing GP crashes.

    I think it would be interesting to know the context of how this code is called too. - what events?

    Tim.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans