task

How to find which method 'hangs' with async/await?

人盡茶涼 提交于 2019-12-07 05:00:21
问题 In the 'old' times it was very easy to track which method is hanging: just go to debugger, hit 'pause' button and go through stack traces. Now however, if the problem is in the async method, this approach does not work - since the next piece of code to execute is buried somewhere in the continuation tasks (technically it does not even hang)... Is there a way for such easy debugging with tasks? UPD. Example: public partial class MainWindow : Window { public MainWindow() { InitializeComponent()

JavaFX: How can I use correctly a ProgressIndicator in JavaFX

家住魔仙堡 提交于 2019-12-07 04:14:23
问题 I´m newbe in JavaFX. I have a problem with my JavaFX application, I need to start my ProgressIndicator (type INDETERMINATE) before a database query. This is part of my code: spinner.setVisible(true); passCripto = cripto.criptoPass(pass); MyDao dao = new MyDaoImpl(); boolean isLoginOk = dao.isUserOk(user, passCripto); boolean isStatusOk = dao.idStatusUser(user); When finished, I need to set spinner to FALSE but the spinner only is showed when database query is finished. How can I solve this ?

How reliable is windows task scheduler for scheduling code to run repeatedly?

眉间皱痕 提交于 2019-12-07 04:05:23
问题 I have a bit of code that needs to sit on a windows server 2003 machine and run every minute. What is the recommended way of handling this? Is it ok to design it as a console service and just have the task scheduler hit it ever minute? (is that even possible?) Should I just suck it up and write it as a windows service? 回答1: Since it needs to run every single minute, I would suggest writing a Windows Service. It is not very complicated, and if you never did this before, it would be great for

VScode: Defining own variables in tasks.json

江枫思渺然 提交于 2019-12-07 03:37:29
问题 I've set up a tasks.json file for building a project on multiple platforms. All platforms see the same content of the project repository. This is done either via disk sharing, because of running another platform in a VM, or via sync with the Git repository. So far so good, they all see the same task.json. However some command lines are rather long and those long lines are identical for most part. for example: "rm -rf build; mkdir build; cd build; ../configure --with-bash-malloc=no CFLAGS=\"

How to solve: Custom MSBuild task requires assembly outside of AppBase

假装没事ソ 提交于 2019-12-07 03:10:31
问题 I have a custom Task that I want to execute when building my C# projects. This task is located in MyTask.dll, which references another assembly, MyCommon.DLL. The problem is that MyCommon.dll is located at "..\Common\MyCommon.dll" relative to MyTask.dll, which puts it outside the AppBase dir for MSBuild process. I've confirmed that this is indeed the problem by analyzing MSBuild's log and seeing Fusion's report about the binding failure. What can I do to make Fusion find MyCommon.dll during

How may I resolve this error? - Delegate 'System.Action<object>' does not take 0 arguments

梦想的初衷 提交于 2019-12-07 02:12:05
问题 The following code: var ui = TaskScheduler.FromCurrentSynchronizationContext(); Task.Factory.StartNew(() => { listBox1.Items.Add("Starting to crawl " + srMainSiteURL + "..."); } , ui); is resulting in the following error: Delegate 'System.Action<object>' does not take 0 arguments After looking at other threads, I have not been able to determine nor understand the cause of the error. Please advise. 回答1: Because you did use public Task StartNew(Action<object> action, object state) I do think

Update UI before running the rest of method

帅比萌擦擦* 提交于 2019-12-07 00:55:44
问题 I have a long-running operation that have to be done in UI thread (involves UI elements that cannot be freezed). I want to display a busy indicator before running the operation. busyIndicator.Visibility = Visibility.Visible; LongRunningMethod(); busyIndicator.Visibility = Visibility.Collapsed; Of course this does not work because rendering does not occur until the operation finishes. I tried to use Task.Yield() to run the rest of method asynchronously: busyIndicator.Visibility = Visibility

How to manage properly an exception in a Task with ContinueWith

非 Y 不嫁゛ 提交于 2019-12-06 22:13:44
问题 After reading information about task and exepcion management, I am using this code to manage an exception thrown in a Task: Task<Object> myTask = Task.Factory.StartNew<Object>(doTask, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default); myTask .ContinueWith(task => afterTask(task), TaskScheduler.FromCurrentSynchronizationContext()); Where doTask and AfterTask are: private <Object> doTask() { throw new Exception("BOOM"); } private afterTask(Task<Object> aTask) { if (aTask

Grunt & requirejs optimizer for a multi app project

你。 提交于 2019-12-06 20:58:02
问题 I'm having issues getting Grunt to perform requirejs optimization on a project with the following structure: static/js |── apps |── app.js |── dash.js |── news.js ... (many more 'app' files) |── build |── collections |── libs |── models |── util |── views Each of static/js/apps/*.js should be compiled to static/js/build/*.js containing the relevant dependencies (eg. views/view1 , libs/query etc). This is currently being performed by a basic bash script: JS_ROOT="static/js" for f in ${JS_ROOT}

C# Async Task Method Without Await or Return

吃可爱长大的小学妹 提交于 2019-12-06 20:23:23
问题 I have an Interface I that is implemented in two places like: interface I { Task DoSomething(); } The interface has async Task DoSomething method API that is then implemented in class A like: class A : I {....} class B : I {....} In class A, the implementation of DoSomething is like below and that is OK: public async Task DoSomething() { if (...) { await DoIt(); } } However, in class B, the implementation of DoSomething() should not do anything. So, its implementation looks like this: public