why this code is making unity unresposnive?

using System.Threading.Tasks;
using UnityEngine;
public class sampleclass : MonoBehaviour
{
bool istrue = true;
void Start()
{
Invoke(“hello_false”, 5);
Task result = call();

        Debug.Log("is code working" + result.Result);

    }

    void hello_false()
    {
        istrue = false;
    }
    void hello()
    {
        while (istrue)
        {
            int justcount = 0;
            justcount++;
        }


    }
    async Task<string> call()
    {
        Task newtask = new Task(hello);
        newtask.Start();

        await newtask;

        return "task done ";
    }



}


when I don't use return statement code runs perfectly but when i add return statement it hangs/become unresponsive.

It seems to loop

void hello()

over and over due to

while(istrue)

And nothing really tells it to stop the loop.

It might be better to stick with coroutines and use an Action callback:

private bool isTrue = true;

private void Start () {
    // When 'Call()' completes it will log the result
    StartCoroutine (Call (result => Debug.Log (result)))
    // Kick off the kill condition
    StartCoroutine (SetFalse ());
}

private IEnumerator Call (Action<string> callback) {
    // When 'Hello()' completes, it returns the string "Task Complete 682" to the initial lambda
    yield return Hello (finalCount => callback ("Task Complete " + finalCount));
}

private IEnumerator Hello (Action<int> callback) {
    int count = 0;
    while (isTrue) {
        count++;
        yield return null;
    }
    //  Returns the count to the above lambda
    callback (count);
}

// Just a delayed operation
private IEnumerator SetFalse () {
    yield return WaitForSeconds (5f);
    isTrue = false;
}

Your problem shoud be on start function, you also need to use async for Start() and await for call(), not sure what are you trying to achive but here is the correct code :

bool istrue = true;
async void Start()
{
    Invoke("hello_false", 5);
    var finalResult = await call();

    Debug.Log("is code working " + finalResult);

}

void hello_false()
{
    istrue = false;
}

void hello()
{
    while (istrue)
    {
        int justcount = 0;
        justcount++;
    }
}

async Task<string> call()
{
    Task newtask = new Task(hello);
    newtask.Start();

    await newtask;

    return "task done ";
}