“Process cannot access the file” error with .net app

Questions about Wine on Linux
Locked
3bhkrh
Newbie
Newbie
Posts: 3
Joined: Sun Oct 23, 2016 9:38 am

“Process cannot access the file” error with .net app

Post by 3bhkrh »

I have a legacy .NET app (dotnetapp) that works fine on Windows XP and has been for many years. I setup Ubuntu 14.04 in a VirtualBox VM to try and see if I can get the app to work under Wine on Ubuntu. The app uses a OCX control to display images from a website. I setup .NET 3.5sp1, registered the OCX control, installed necessary libraries (mdac28, jet40, etc.) under wine (app requirements). The OCX control receives a xml file from the website containing a list of URLs for the images to be displayed. It seems to save the xml file to a "temp" location before reading it. The app otherwise works fine, but when I navigate to a screen which uses the OCX control to display images, it throws a "unhandled exception" complaining that the "c:\users\username\Temp\xml" cannot be accessed since it is being accessed by another process.

I have tried the obvious, i.e. deleted everything from the Temp directory, unregister/reregister the OCX control, etc. lsof shows:

Code: Select all

COMMAND     PID     USER   FD   TYPE DEVICE SIZE/OFF   NODE NAME
dotnetapp 18113 username   83r   REG    8,1      175 812517 ./xml
wineserve 18116 username  177r   REG    8,1      175 812517 ./xml
wineserve 18116 username  178r   REG    8,1      175 812517 ./xml
I've also tried different versions of wine (1.6, 1.8, 1.9) as well as .NET 2.0sp2 and .NET3.5sp1. Same story in all combinations. I don't have access to the source code of the OCX or the dotnetapp to debug the code.

Code: Select all

Exception output:

See the end of this message for details on invoking 
just-in-time (JIT) debugging instead of this dialog box.


************** Exception Text **************
System.IO.IOException: The process cannot access the file 'C:\users\username\Temp\xml' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
   at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
   at System.IO.StreamWriter.CreateFile(String path, Boolean append)
   at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
   at System.IO.StreamWriter..ctor(String path)
   at dotnetapp.frmMain1.DisplayPages(UInt32[] arrPages, AxIMGViewAX& objIMGAx)
   at dotnetapp.frmMain2.cmbPages_i_SelectedIndexChanged(Object sender, EventArgs e)
   at System.Windows.Forms.ComboBox.OnSelectedIndexChanged(EventArgs e)
   at System.Windows.Forms.ComboBox.set_SelectedIndex(Int32 value)
   at dotnetapp.frmMain2.LoadPagesFilter()
   at dotnetapp.frmMain2.frmMain2_Load(Object sender, EventArgs e)
   at System.Windows.Forms.Form.OnLoad(EventArgs e)
   at System.Windows.Forms.Form.OnCreateControl()
   at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
   at System.Windows.Forms.Control.CreateControl()
   at System.Windows.Forms.Control.WmShowWindow(Message& m)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
   at System.Windows.Forms.ContainerControl.WndProc(Message& m)
   at System.Windows.Forms.Form.WmShowWindow(Message& m)
   at System.Windows.Forms.Form.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Loaded Assemblies **************
...
Any ideas what could be causing this issue? I have never seen this error when using the app on Windows XP. Output of winetricks list-installed:

Code: Select all

dotnet20
jet40
mdac27
mdac28
mfc42
msvcirt
vb6run
vcrun6sp6
vcrun6
wsh56vb
wsh57
3bhkrh
Newbie
Newbie
Posts: 3
Joined: Sun Oct 23, 2016 9:38 am

Re: “Process cannot access the file” error with .net app

Post by 3bhkrh »

I should clarify, my latest test environment for the above issue is running Ubuntu 16.04, wine-1.6.2, and .NET 2.0 framework.
User avatar
dimesio
Moderator
Moderator
Posts: 13208
Joined: Tue Mar 25, 2008 10:30 pm

Re: “Process cannot access the file” error with .net app

Post by dimesio »

1.6.2 is over two years old and no longer supported. You need to test the latest development release, which is currently 1.9.21. https://wiki.winehq.org/Ubuntu
3bhkrh
Newbie
Newbie
Posts: 3
Joined: Sun Oct 23, 2016 9:38 am

Re: “Process cannot access the file” error with .net app

Post by 3bhkrh »

I just did that, same results. Now running 1.9.21 on Ubuntu 16.04.
Locked