Options

XMLport RTC Crash from ObjectDisposedException

arnhembarnhemb Member Posts: 9
edited 2011-06-20 in NAV Three Tier
Hi All,

I am running NAV in a multi-tiered environment. When running any XMLport to import through a menu item, the XMLport runs successfully, but thereafter if the user changescompany (ctrl + O), the RTC crashes with the following error:
"The server <server name> is either unavailable or your connection has been lost. Do you want to attempt to reconnect".

When checking the event log, there is the following error:
Service: MicrosoftDynamicsNavServer
User: <user name>
Type: System.ObjectDisposedException
Message: Cannot access a closed file.
StackTrace:
at System.IO.__Error.FileNotOpen()
at System.IO.FileStream.Flush()
at Microsoft.Dynamics.Nav.Types.FileBufferedStream.Dispose(Boolean disposing)
at System.IO.Stream.Close()
at System.IO.Stream.Dispose()
at Microsoft.Dynamics.Nav.Runtime.NavStreamProvider.Dispose(Boolean disposing)
at Microsoft.Dynamics.Nav.Runtime.TreeObject.Dispose()
at Microsoft.Dynamics.Nav.Runtime.TreeHandler.InternalHostDispose()
at Microsoft.Dynamics.Nav.Runtime.TreeHandler.DisposeAllChildren()
at Microsoft.Dynamics.Nav.Runtime.TreeHandler.Dispose(Boolean disposing)
at Microsoft.Dynamics.Nav.Runtime.TreeObject.Dispose(Boolean disposing)
at Microsoft.Dynamics.Nav.Runtime.TreeObject.Dispose()
at Microsoft.Dynamics.Nav.Runtime.TreeHandler.InternalHostDispose()
at Microsoft.Dynamics.Nav.Runtime.TreeHandler.DisposeAllChildren()
at Microsoft.Dynamics.Nav.Runtime.NavCompany.Dispose(Boolean disposing)
at Microsoft.Dynamics.Nav.Runtime.TreeObject.Dispose()
at Microsoft.Dynamics.Nav.Service.Connection.GlobalTriggerCloseCompany()
at Microsoft.Dynamics.Nav.Service.NSService.<>c__DisplayClass43.<CloseConnection>b__41(Connection connection)
at Microsoft.Dynamics.Nav.Service.NSService.ExecuteOperation[T](String operationName, ServiceOperation`1 operation, Connection connection, Boolean revertLanguageChanges, WindowsIdentity impersonationIdentity)
Source: mscorlib

The odd thing is if I manually upload the file, open a stream and run the XMLport programmatically like so:
IF NOT UPLOADINTOSTREAM(Text001, '', 'All Files (*.*)|*.*', ltxtImportFileName, lstmInLocal) THEN EXIT;
ImportMFOData.SETSOURCE(lstmInLocal);
ImportMFOData.IMPORT;
Then no error occurs (but this means I lose my request page).

Could this be related to permissions? If so then why do the XMLports import sucessfully, and then only an error occurs on changing company?

Any assistance would be appreciated.
Sign In or Register to comment.