web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

System.AccessViolationException error in inbound service

(0) ShareShare
ReportReport
Posted on by 1,552

I'm trying to insert into DirPartyPostalAddressView using an inbound service.

So i have a contract class with DataMember of type LogisticsPostalCityName and LogisticsAddressStreet

and in x++ code when i say DirPartyPostalAddressView .city = request.city() or try to fill the street, i get the below error:

An unhandled exception of type 'System.AccessViolationException' occurred in System.Data.dll

Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 

Any Ideas?
I have the same question (0)
  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Which of the two statements does throw the error?

    dirPartyPostalAddressView.City = 'abc' or request.city()?

  • junior AX Profile Picture
    1,552 on at

    Here: dirPartyPostalAddressView.City = request.city();

    where in c# request.city = "Test";

  • Suggested answer
    Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    Yes, you said before that you have a problem at this line with two statements (calling city() method and assigning the return value to the City property). My question is which of this two statements throws the error.

  • Markus P. Gasser Profile Picture
    23 on at

    We have exactly the same issue. DirPartyPostAddressView - Instance is corrupt before you try to assign a value. It happens only on one DEVBOX on another DEVBOX (same code, same database - content) it works. It works at all without debugger!!

  • Martin Dráb Profile Picture
    237,965 Most Valuable Professional on at

    I've also spotted a few cases like this. AccessViolationException is thrown if (and only if) the debugger is attached.

    We discussed it in a few threads at Insider Program Yammer (e.g. here), therefore Microsoft is aware of it, unfortunately it doesn't mean that there is a fix already.

  • Markus P. Gasser Profile Picture
    23 on at

    Hi Martin, thanks for fast response! I'm a bit desperate about this due to not able to debug code. As I mention before it works on another DEVBOX. I guess it is related to VS Version (we use now VS 2017 Professional) and System - Updates (.NET - DLL's). Now I'm playing around this issue by not more using DirPartyPostAddressView, maybe I have a workaround until a miracle happens at MS.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Martin Dráb Profile Picture

Martin Dráb 503 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 434 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans