dapr / dotnet-sdk

Dapr SDK for .NET
Apache License 2.0
1.11k stars 337 forks source link

Solution does not support Live Unit Testing in Visual Studio Enterprise #685

Open eNeRGy164 opened 3 years ago

eNeRGy164 commented 3 years ago

This is only for developer comfort, not an issue using the SDK itself.

I did try to reproduce this behavior on a clean project, but it seems very specific to the Dapr .NET SDK solution.

Expected Behavior

When enabling Live Unit Testing in Visual Studio Enterprise, it should work.

Actual Behavior

Fails with the message

[15:40:32.665 Error] System.IO.FileNotFoundException: Could not find file 'D:\github\eNeRGy164\dapr\dotnet-sdk.vs\all.sln\v16\lut\7304\i\Dapr.Client\netcoreapp3.1\dapr\proto\common\v1\CommonGrpc.cs'.

A normal build generates an empty CommonGrpc.cs, but a LUT build apparently does not. I'm not sure if this is a Visual Studio LUT or a Grpc.Tools bug. Or maybe just the combination of both.

A workaround is to generate the empty file if it is a LUT build.

After this LUT works: image

Steps to Reproduce the Problem

Press play in a Visual Studio Enterprise.

Release Note

RELEASE NOTE: FIX Support Live Unit Testing in Visual Studio Enterprise.

rynowak commented 3 years ago

@jamesnk - are you familiar with this problem?

JamesNK commented 3 years ago

No. I don’t have live unit tests enabled

rynowak commented 3 years ago

Can you try it on an empty grpc project? I don't have Windows/VS easily available. If there's a bug here its in Grpc.Tools - we're not doing anything fancy in this repo.

eNeRGy164 commented 3 years ago

I couldn't reproduce it on an empty solution, even using the Dapr proto files, including shared files and targets.

edit I have the issue now on a smaller slimmed down version.

The effect starts when adding the Directory.Build.props to the src and test directories. Possible causes I see so far:

I uploaded a repo where LUT does not work, until you remove the 2 .props files (and remove the signed key from the InternalsVisibleTo attribute in DaprClientGrpc.cs)