ChilliCream / graphql-platform

Welcome to the home of the Hot Chocolate GraphQL server for .NET, the Strawberry Shake GraphQL client for .NET and Banana Cake Pop the awesome Monaco based GraphQL IDE.
https://chillicream.com
MIT License
5.26k stars 746 forks source link

Blazor WASM hotreload with StrawberryShake code generation #4008

Closed sourcejon closed 2 years ago

sourcejon commented 3 years ago

Describe the bug Hotreload fails on a blazor wasm project when using StrawberryShake code generation

To Reproduce Steps to reproduce the behavior:

  1. create a blazor wasm project using dotnet 6.0.100-preview.6.21355.2
  2. add "hotReloadProfile": "blazorwasm" to your launch profile in launchSettings.json
  3. run project using dotnet watch, check output for the following message: watch : Hot reload enabled. For a list of supported edits, see https://aka.ms/dotnet/hot-reload. Press "Ctrl + R" to restart.
  4. make a simple edit to index.razor and ensure hotreload is working
  5. add StrawberryShake tooling for code generation and configure as per https://chillicream.com/docs/strawberryshake/get-started
  6. run dotnet watch and make a simple change as per step 4.

Expected behavior hotreload continues to work and code generators does not fire

Desktop (please complete the following information): Win 10, Chrome 91

Additional context watch : StrawberryShake.CodeGeneration.CSharp.Analyzers\StrawberryShake.CodeGeneration.CSharp.Analyzers.CSharpClientGenerator\SourceGraphQLClient.StrawberryShake.cs(1332,57): error CS0229: Ambiguity between 'GetBrokerByIDBuilder._idSerializer' and 'GetBrokerByIDBuilder._idSerializer' watch : StrawberryShake.CodeGeneration.CSharp.Analyzers\StrawberryShake.CodeGeneration.CSharp.Analyzers.CSharpClientGenerator\SourceGraphQLClient.StrawberryShake.cs(1338,102): error CS0121: The call is ambiguous between the following methods or properties: 'GetBrokerByIDBuilder.DeserializeNonNullableInt32(JsonElement?)' and 'GetBrokerByIDBuilder.DeserializeNonNullableInt32(JsonElement?)'

psalmeight commented 3 years ago

@sourcejon were you able to run strawberryshake on .net 6 prev 6? did you had any issues related with https://github.com/ChilliCream/hotchocolate/issues/3959?

sourcejon commented 3 years ago

@psalmeight No issues with #3959 , it all run's perfect except for hotreload support. It's worth noting I do have .net 5 installed on my system.

PS C:\Users\X\source\repos\X\src\WebApps\BlazorHotReload> dotnet graphql init https://workshop.chillicream.cloud/graphql/ -n ConferenceClient -p .\BlazorHotReload\ Download schema started. Download schema completed in 727 ms Client configuration started. Client configuration completed in 167 ms PS C:\Users\X\source\repos\X\src\WebApps\BlazorHotReload> dotnet --version 6.0.100-preview.6.21355.2

dmg-hamann commented 3 years ago

I am having the same issue. For the time beeing you can set "emitGeneratedCode"in .graphqlrc.json to false. Without the generated code in your solution dotnet watch works fine. But of course you will lack intelli sense.

michaelstaib commented 3 years ago

Hey there, we will address this soon ... We have just switched to the preview 7 SDK and will slowly upgrade project targets.

MisinformedDNA commented 3 years ago

Where are we with this?

spin973 commented 3 years ago

it is impossible to work in Blazor Wasm with hotreload in Visual Studio 2022 (Preview 6.0) .NET 6.0.0-rc.2.21480.10 and StrawberryShake 12.0.1

Any workaround waiting for HC-13?

jorrit commented 3 years ago

Never mind all this, I've opened #4430.

michaelstaib commented 2 years ago

This is now fixed with 12.7