BotFramework-Composer
BotFramework-Composer copied to clipboard
dotnet build errror when starting a bot project (because it is being used by another process)
Describe the bug
I've seen this a number of times now when switching between different bot projects. Bots start to report errors when starting due to the .exe being used by another process. bot project has only been launched as part of using Composer, VS hasn't been opened against the csproj or anything outside composer.
Digging around in task manager it seems djbfskill6 had a process running in the background, Composer perhaps isn't terminating these processes correctly in some instances?
Error occurred building the bot
Message:
Command failed: dotnet build djbfskill1.csproj
Command:
dotnet build djbfskill1.csproj
Stack Trace:
Error: Command failed: dotnet build djbfskill1.csproj
at ChildProcess.exithandler (child_process.js:308:12)
at ChildProcess.emit (events.js:210:5)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
Output:
Microsoft (R) Build Engine version 16.9.0+57a23d249 for .NET
Copyright (C) Microsoft Corporation. All rights reserved.
Determining projects to restore...
C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj : warning NU1701: Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
All projects are up-to-date for restore.
C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj : warning NU1701: Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 2 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 3 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 4 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 5 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 6 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 7 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 8 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 10 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): error MSB3027: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Exceeded retry count of 10. Failed. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): error MSB3021: Unable to copy file "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
Build FAILED.
C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj : warning NU1701: Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj : warning NU1701: Package 'Microsoft.Azure.KeyVault.Core 1.0.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework '.NETCoreApp,Version=v3.1'. This package may not be fully compatible with your project.
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 1 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 2 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 3 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 4 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 5 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 6 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 7 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 8 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 9 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): warning MSB3026: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Beginning retry 10 in 1000ms. The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): error MSB3027: Could not copy "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". Exceeded retry count of 10. Failed. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
C:\Program Files\dotnet\sdk\5.0.201\Microsoft.Common.CurrentVersion.targets(4919,5): error MSB3021: Unable to copy file "C:\Users\darrenj\djbfskill1\djbfskill1\obj\Debug\netcoreapp3.1\apphost.exe" to "bin\Debug\netcoreapp3.1\djbfskill1.exe". The process cannot access the file 'C:\Users\darrenj\djbfskill1\djbfskill1\bin\Debug\netcoreapp3.1\djbfskill1.exe' because it is being used by another process. [C:\Users\darrenj\djbfskill1\djbfskill1\djbfskill1.csproj]
Version
1.4.0-nightly.237101
Browser
- [x] Electron distribution
- [ ] Chrome
- [ ] Safari
- [ ] Firefox
- [ ] Edge
OS
- [ ] macOS
- [x] Windows
- [ ] Ubuntu
By "switching bot projects" do you mean, open bot1, start bot1, and switch to bot2 and back to bot1, then start again?
note: seems to be an issue with the new runtime
Now I have 3 dangling processes with Composer closed and no bugs hit:
Sorry, by switching between Bots I meant different bot projects
Passing P0 from closed dup here for consideration.
Shiproom - Tony is working on a similar issue that relates to this. depending on that issue, we'll decide on this issue.
I am also able to repro this by doing the following:
- Create / Open bot
- Start bot
- Install package while bot is running
- Try to start bot
- Observe errors
- Starting bot again is successful
Related: #7498, #7114
After some investigation, it seems like the package manager extension is calling reloadProject()
which does not actually stop the currently running bot. However, the correct behavior -- which is observed when switching bot projects, is to call stopBot()
.
This is a limitation of the shell API which does not expose the ability to stop a bot to the extensions.
Shiproom - approved
Shiproom - PR merged. Closing the issue.
@srinaath - I still see the dangling process in today's build. Is that supposed to be fixed?
[BF]c:\workspace\botroot\TempPlay>tasklist | findstr /i teletest
TeleTest.exe 48360 Console 3 421,520 K
TeleTest.exe 7308 Console 3 71,276 K
Version: 2.0.0-nightly.243997.543d0b4 Electron: 8.2.4 Chrome: 80.0.3987.165 NodeJS: 12.13.0 V8: 8.0.426.27-electron.0
Shiproom - since this was reopened, I've removed the approved label.
Shiproom - we've fixed some of these scenarios. At this point, I'm moving this out of R13 for consideration in a post build release
let's use this ticket to track a better cleanup approach for all processes like what VSCode do.
I spiked out a PoC of a mechanism that would allow the Electron main process to wait for asynchronous cleanup tasks on the renderer process before shutting down.
Now it's just a matter of deciding whether it's something we want to use or modify and then porting it over to Composer. We would then be able to wait for running bots to be shut down by this mechanism before closing Composer.
I spiked out a PoC of a mechanism that would allow the Electron main process to wait for asynchronous cleanup tasks on the renderer process before shutting down.
Now it's just a matter of deciding whether it's something we want to use or modify and then porting it over to Composer. We would then be able to wait for running bots to be shut down by this mechanism before closing Composer.
Awesome demo of the POC, it looks very promising. In terms of timeline, at this moment i don't think we have resource to include this in R14, what do you think? How about we move this to R15?
@boydc2014 I agree. Let's move it to R15.
Here are some notes from the team's previous meeting about the feature:
-
Need to test this with auto update -- will calls to
installAndUpdate()
, which closes all the app windows, trigger the shutdown logic? -
Need to consider handling force quits (Alt + F4 / Task Manager on Windows -- Mac equivalent)
- Can catch UNIX signals:
process.on('SIGINT', () => { doCleanup() });
- This should be cross-platform as well
- Can catch UNIX signals:
-
Blocking client on cleanup could be annoying without some sort of status / progress screen (
Shutting down...
)- Teams used to do this in the early days and it was annoying
- We could also add a timeout that eventually force quits the app if the shutdown is taking too long
Regarding auto update compatibility, from the electron-updater
source:
Note:
autoUpdater.quitAndInstall()
will close all application windows first and only emitbefore-quit
event onapp
after that.
This should hit the clean-up logic.
There was some work done to improve this. I believe this is fixed. Feel free to reopen if not