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

Announcements

No record found.

News and Announcements icon
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
    239,451 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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

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

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 622

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 532 Super User 2026 Season 1

#3
CP04-islander Profile Picture

CP04-islander 430

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans