ForNeVeR / AvaloniaRider

JetBrains Rider plugin for Avalonia development
https://plugins.jetbrains.com/plugin/14839-avaloniarider/
MIT License
441 stars 19 forks source link

The process cannot access the file '....' because it is being used by another process. #264

Closed j4587698 closed 1 year ago

j4587698 commented 1 year ago

If files are used in the viewmodel constructor, when debugging will throw System.IO.IOException. It looks like this file is occupied by the previewer. If close the axaml page tab, the program can run normally. Selecting edit only cannot solve this problem.

ForNeVeR commented 1 year ago

Yeah, previewer starts your program in preview mode, so if your components have side effects, then those will be applied.

The only way around that is to either restructure the program to not open files in design mode, or to open files with shared access.

Nothing could be done in the plugin, unfortunately.

j4587698 commented 1 year ago

Ok, I can use Design.IsDesignMode. It works normally. But AvaloniaVs can work normally with out Design.IsDesignMode

ForNeVeR commented 1 year ago

Could you please share some steps to reproduce the issue, then? If it works in AvaloniaVS but doesn't in AvaloniaRider, that's quite unexpected.

j4587698 commented 1 year ago

Yes, I create a repo : https://github.com/j4587698/IDETest It's only open a db file for litedb. Open MainWindow.axaml at tab. If in rider, it will throw IOException, but it's running in vs.

ForNeVeR commented 1 year ago

@j4587698, I'm sorry, the project is either deleted or private. I have no access to it. Could you please help?

j4587698 commented 1 year ago

Sorry, The repo created by vs is private by default. I didn't notice. Now it is public.

ForNeVeR commented 1 year ago

Ok, here's how it works.

ForNeVeR commented 1 year ago

I'm thinking of adding a setting for that. I still believe that using the same CWD as run mode is a good idea. But for cases like yours, when the users may want to change that default and use some other directory (say, a solution one or some other).