Bug 53300 - shared violation on path /dev/usb/lp0
Summary: shared violation on path /dev/usb/lp0
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: JIT ()
Version: 4.6.0 (C8)
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
Depends on:
Reported: 2017-03-14 08:42 UTC by Roman
Modified: 2017-03-14 08:42 UTC (History)
2 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 53300 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Roman 2017-03-14 08:42:59 UTC
Hello, developers. Why does mono become a worse and a worse last time?

First problem:

I have application which works with printer on usb interface. I use a FileStream for port managing. And during one application session I can open port just one time and next time I get error shared violation on path /dev/usb/lp0. If application close and run again port open one time too and next time I again get error shared violation on path /dev/usb/lp0.
I've tried to use different FileStream constructor overrides and problem was resolved FileStream(parameters2.PortName, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite) although on 2.10 version mono a FileStream(parameters2.PortName, FileMode.Open) was enough for normal working. I close port as 

usbPort = null;

I assume that port must be opened in exclusive mode, none sharing.

Second problem:

I have two applications. First is monogame second is winforms. So I run monogame using code option for window "fullscreen = true" without hiding mouse cursor, above monogame I run winforms application as screensaver using next options:

this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;

Sometimes when winforms was closed I see black screen with mouse cursor instead monogame application. Also under monogame must be a terminal emulator but I can't see it even using Alt+TAB. Only black screen and mouse cursor are on my display. If I run a killall mono in a new terminal emulator that old terminal emulator and desktop achieve. I repeat that it happens not every time it happens sometimes. 
I used 2.10 mono version since 2012 and I never notice such bugs there.