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, ...
Answered

System.TimeoutException not caught

(1) ShareShare
ReportReport
Posted on by 43

Hello,

I'm calling a WCF service by using this X code:

             // Use the AifUtil class to create an instance of the service client object.
            searchClient = AifUtil::CreateServiceClient(clientType);

The code is working, but yesterday I received a System.TimeoutException because the remote WCF service was not reachable.

This is the stacktrace (sorry, it's an image):

crash.png

What puzzles me is that exception should have been caught, since my code is:

    try
    {
        //Construct and configure the service client by retrieving the X   type for the service and using the AifUtil class
        
        clientType = CLRInterop::getType('FAB_CrifIntegrationV2.ServiceReference.SearchClient');

        // Use the AifUtil class to create an instance of the service client object.
		searchClient = AifUtil::CreateServiceClient(clientType);
		searchResponse = searchClient.CompanySearch(m_username, m_password, guid2str(transactionGuid), null, searchData,
													byRef inquiryDetails, byRef companyList);

		// ...
    }
    catch (Exception::CLRError)
    {
        // Handle the exception and display message in the InfoLog.
        ex = CLRInterop::getLastException();
        error(ex.ToString());

        // ...
    }

As per my understanding of MS Dynamics documentation, catching CLRError is exactly for this cases (i.e. exceptions thrown by CLR objects) but System.TimeoutException seems to have by-passed it.

Can you advise, please?

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

    Isn't your catch clause inside a database transaction? If so, it's ignored and execution continues after the transaction. That's where you can catch the exception.

  • Simone F Profile Picture
    43 on at

    Yes, unfortunately I wasn't aware of this X++ behaviour. Thank you for pointing it.

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 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans