IDE gets stuck in some cases

Sometimes my IDE "looses" its connection to the webserver. I can see this by the fact that the run button in the top right is visible, but the server is running, when I click the start button again, it will switch its state to stop, for some seconds, then it returns to the start state, the webserver continues to restart at this point.

Now I am in a situation in which I cannot stop the webserver anymore, my only solution is to leave the current application (going back to the overview) and clicking on it again. Then navigate back to were you where before, searching for the page, selecting your last element, open some property window ...

The log says it's possible to stop the server by hitting CTRL+C, but that's not possible. I tried to click Build>Stop as also on Deploy>Stop, both seem to start the compilation again from the start ... with the same result: the Run-Button changes only for some seconds.

I mean, getting out of the Application and entering it again only takes 2 seconds, so this isn't a real problem. But I think it's worth mentioning that there is no way to stop the server from running in this situation and what is written in the build log is just ... a lie.

I know it only transports the information which would be in a normal dos-console which would react to CTRL+C. But wouldn't it be nice to recognize the shortcut in Radzen too? Sure CTRL+C cannot be used because it's already taken for the copy-function, but maybe you can change the output message or put a little button somewhere? Or maybe an option to just open a dos-console like Visual Studio does. I find the integrated console cumbersome anyway, it regulary gets into my way while editing in longer property windows and it pops out on its own everytime I compile. And it cannot be resized (not the window, not the font-size), so reading an exception ends in copy-all to an proper texteditor anyway.

STR:

  • create a button which triggers a function in ServerMethodsController
  • start the app, click the button, let the function crash
  • welcome in the mentioned state

What does the custom server method do? Does it only throw an exception?

On purpose in this case, yes. As far as I know it wasn't important which exception I had.

That's very strange. It is indeed not normal for the run button to be enabled while the application is still running. Unfortunately I couldn't reproduce it in our local tests. Could you please try the attached application? Can you make it get stuck as with your application?
server-method.zip (21.6 KB)

I have to admit I am already trying to reproduce it in my own application today, but I cannot.

But let's try it another way:

  • double click on the run button
  • the button will display "stop" and then "start" again, like it should
  • Now you have a running server and no way to stop it

The Console says this: (Is this in the right order? shouldn't be the 'open you browser' line the last one)

radzen: Generating code ...
radzen: Code generation done in 510ms.
dotnet: c:\dev\Manager\server\project.csproj : warning NU1608: Detected package version outside of dependency constraint: Microsoft.ApplicationInsights.DependencyCollector 2.4.1 requires Microsoft.ApplicationInsights (= 2.4.0) but version Microsoft.ApplicationInsights 2.5.1 was resolved.

dotnet: c:\dev\Manager\server\project.csproj : warning NU1608: Detected package version outside of dependency constraint: Microsoft.ApplicationInsights.DependencyCollector 2.4.1 requires Microsoft.ApplicationInsights (= 2.4.0) but version Microsoft.ApplicationInsights 2.5.1 was resolved.

dotnet: [15:30:57 WRN] The static context of LoggerFactory wasn't setup before the singleton Instance was used, creating an adHoc instance. Please call LoggerFactory.InitializeStaticLogger(...) fo use the Instance property.

dotnet: [15:30:58 INF] Envkey: WebServices - LOCAL DEV

dotnet: info: Manager.Startup[0]
      Envkey: WebServices - LOCAL DEV

dotnet: Hosting environment: Development
Content root path: c:\dev\Manager\server
Now listening on: http://[::]:5000
Now listening on: http://[::]:80
Application started. Press Ctrl+C to shut down.

ng-cli: ** Angular Live Development Server is listening on 0.0.0.0:8000, open your browser on http://localhost:8000/ **

ng-cli: 
Date: 2019-09-20T13:31:25.977Z
Hash: b00066d3d0ed41f07870
Time: 24179ms
chunk {es2015-polyfills} es2015-polyfills.js, es2015-polyfills.js.map (es2015-polyfills) 285 kB [initial] [rendered]
chunk {main} main.js, main.js.map (main) 2.86 MB [initial] [rendered]
chunk {polyfills} polyfills.js, polyfills.js.map (polyfills) 498 kB [initial] [rendered]
chunk {runtime} runtime.js, runtime.js.map (runtime) 6.08 kB [entry] [rendered]
chunk {styles} styles.js, styles.js.map (styles) 703 kB [initial] [rendered]
chunk {vendor} vendor.js, vendor.js.map (vendor) 8.75 MB [initial] [rendered]

ng-cli: i 「wdm」: Compiled successfully.

After trying this out some more times I event got an error from the application (not reproduceable at this point):

Since my machine is often under heavy load (multiple Visual Studio instances, an sql server, a docker environment, an on-premise build agent) ... maybe it's just a race condition thing.

Indeed we reproduced a similar issue with double-clicking the Run button. A potential fix will ship with the next Radzen release.

1 Like

It's possible that my problem was just this behaviour all along and I just happend to have an exception from time to time when I hastily triggered a rebuild after working on my ServerMethods. Could you try to describe what this potential fix was about? Was it just a change in the UI oder are you detecting the running server differently?

There was a possibility to stop the server before the process has started. As a result the server process remained unaccounted for and one cannot stop it from the UI.

1 Like

Installed Version 2.24.0
The button itself now changes text according to the stuff which is listed in the console, fine so far.
But I didn't need long to get into that stuck situation again.
I now get an error message every SECOND time I try to start the server, in the other instace the output console says just:

radzen: Generating code ...
radzen: Code generation done in 514ms.
radzen: Stopped server.

The other output is a little bit more interesting:

radzen: Generating code ...
radzen: Code generation done in 461ms.
dotnet: c:\dev\Manager\server\project.csproj : warning NU1608: Detected package version outside of dependency constraint: Microsoft.ApplicationInsights.DependencyCollector 2.4.1 requires Microsoft.ApplicationInsights (= 2.4.0) but version Microsoft.ApplicationInsights 2.5.1 was resolved.

dotnet: c:\dev\Manager\server\project.csproj : warning NU1608: Detected package version outside of dependency constraint: Microsoft.ApplicationInsights.DependencyCollector 2.4.1 requires Microsoft.ApplicationInsights (= 2.4.0) but version Microsoft.ApplicationInsights 2.5.1 was resolved.

dotnet: c:\program files\dotnet\sdk\2.2.103\Microsoft.Common.CurrentVersion.targets(4194,5): warning MSB3026: Could not copy "obj\Debug\netcoreapp2.2\server.dll" to "bin\Debug\netcoreapp2.2\server.dll". Beginning retry 1 in 1000ms. The process cannot access the file 'c:\dev\Manager\server\bin\Debug\netcoreapp2.2\server.dll' because it is being used by another process.  [c:\dev\Manager\server\project.csproj]

<Message - line above - repeats for 10 tries>

dotnet: c:\program files\dotnet\sdk\2.2.103\Microsoft.Common.CurrentVersion.targets(4194,5): error MSB3027: Could not copy "obj\Debug\netcoreapp2.2\server.dll" to "bin\Debug\netcoreapp2.2\server.dll". Exceeded retry count of 10. Failed.  [c:\dev\Manager\server\project.csproj]
c:\program files\dotnet\sdk\2.2.103\Microsoft.Common.CurrentVersion.targets(4194,5): error MSB3021: Unable to copy file "obj\Debug\netcoreapp2.2\server.dll" to "bin\Debug\netcoreapp2.2\server.dll". The process cannot access the file 'c:\dev\Manager\server\bin\Debug\netcoreapp2.2\server.dll' because it is being used by another process. [c:\dev\Manager\server\project.csproj]

dotnet: 

dotnet: The build failed. Please fix the build errors and run again.

The log says bin-files are being used by another process:

It seems the fix was incomplete. Can you send us your project to info@radzen.com so we can troubleshoot further? We need the contents of the meta and server directories. You can delete the server\bin and server\obj directories to minimize the total file size.

Also let us know if there are any steps that predictably reproduce the problem.

Mail is sent. @STR: I am sorry, I did not find a reproducible situation until now.

Maybe you wanna force stop every dotnet instance which was spawned by radzen when the user hits the start button?

I just realized the patch made it somehow worse. The blocking dotnet.exe isn't going to vanish when I close the radzen-project, even restarting radzen does not get rid of it :frowning:

The only way I have been able to reproduce this problem is by constantly double-clicking the Run button. I am not sure this is a realistic case to support (Visual Studio code has similar process locking issues if you try to debug/stop/debug again). Can you reproduce this problem during normal work with Radzen? By normal I mean to run the project and stop it after the server has started.

I will try to do so these days and report back when I have hopefully more information.

We will continue investigating and will post updates here if we discover anything else.

1 Like

VS as also VSCode have the possibility to restart with a dedicated button, I am not sure how that could fit to Radzens UI but it would be a way to work around that double clicking problem - if you are a person which even does this, maybe it's not something in everybodys workflow. With a 'controlled' restart it's maybe even possible to not open a new browser window everytime, like it happens on-the-fly if you change something in Radzen UI.

Now that I am thinking about it, this whole thing ist only happening when I change something in the ServerMethodsController. It could be just the checkbox in the menubar 'Watch for external changes'. If it is enabled, changes to that cs file will automatically recompile.