Question: I was wondering what would be the correct declaration for a long running task.

```
suspend fun methodName(image: Bitmap?): String? = async {
   // heavy task
}.await()

```

OR

```
fun methodName(image: Bitmap?): String? {
   //heavyTask
}

```

And in code use

```
async{
   methodName()
}.await()

```

The First one restricts the heavy operation to be performed on the background thread always. So, it's safe (In a way that it will be run on background thread, so that new Devs will be sure to use it in suspendable construct).

Which is the better approach?

Answer: 
It's a bug. Fix should be available in the upcoming SDK version 2.1.1. There are 3 things you can do right now:

1. You can install SDK 2.1.301 ([x64 Installer](https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180605-09/final/assets/Sdk/2.1.301-preview-008906/dotnet-sdk-2.1.301-win-x64.exe), [x86 Installer](https://dotnetfeed.blob.core.windows.net/orchestrated-release-2-1/20180605-09/final/assets/Sdk/2.1.301-preview-008906/dotnet-sdk-2.1.301-win-x86.exe), [Version info](https://github.com/dotnet/versions/tree/master/build-info/dotnet/product/cli/release/2.1))
2. Or you can make the fix yourself for current 2.1.300 SDK, it's a one liner in **C:\Program Files\dotnet\sdk\2.1.300\Sdks\Microsoft.NET.Sdk.Razor\build\netstandard2.0\Sdk.Razor.CurrentVersion.targets** and change line 460 from:

```
DependsOnTargets="RazorCompile"

```

to

```
DependsOnTargets="ResolveRazorGenerateInputs"

```
3. Or keep using **dotnet publish**
For my case, I have installed Microsoft.NET.Sdk.Razor 2.2.0

Open "Package Manager Console"
run follows query....

> 
> Install-Package Microsoft.NET.Sdk.Razor -Version 2.2.0
> 
> 
> 

Razor is a markup syntax for adding server-side logic to web pages. This package contains MSBuild support for Razor.