2

I have it working perfectly with the UWP application but as soon as I try run the Droid version I get the following error :-

Error Generation failed: System.AggregateException: One or more errors occurred. ---> System.InvalidOperationException: Generation failed for Uno.UI.SourceGenerators.RemoteControl.RemoteControlGenerator.System.MissingMethodException: Method not found: 'Microsoft.CodeAnalysis.Compilation Uno.SourceGeneration.SourceGeneratorContext.get_Compilation()'.

I'm not sure where to look next. Any pointers? I would really like to continue using Refit with my REST API.

Thanks G

Jérôme Laban
  • 5,224
  • 3
  • 20
  • 17
George Bamber
  • 25
  • 2
  • 2
  • Hi @george, I can confirm I'm using Refit in a Uno-platform project. Would you have some code sample to look at ? – matfillion May 04 '20 at 19:05
  • Uno.UI.SourceGenerators.RemoteControl.RemoteControlGenerator is for the HotReload, I'm not sure it would be related to refit – matfillion May 04 '20 at 19:06
  • Could you mention which version of visual studio you are using ? – Jérôme Laban May 05 '20 at 02:13
  • Hi Jerome - I'm using 16.5.4 with latest pre-release UNO packages. Looking at the binlog file it shows an error with RefitStubs.g.cs. If I create a new UNO solution and add Refit and build it fails straight away. Remove Refit it builds ok. – George Bamber May 05 '20 at 06:05
  • Hi matfillion - thanks for the offer but even just adding Refit to a brand new UNO solution fails. – George Bamber May 05 '20 at 06:10
  • Could you share the sample project that you've built, on github ? – Jérôme Laban May 05 '20 at 13:48
  • You can try get from here? It's a new UNO solution with the Refit NuGet packaged added https://github.com/GeorgeB2009/Playground/blob/master/RefitTest.zip – George Bamber May 05 '20 at 15:00
  • @GeorgeBamber, I was curious about the difference between your sample and the project I'm using refit so I took a quick look. Using Refit "4.7.51" instead is working. – matfillion May 05 '20 at 18:23
  • Refit 4.8.14 works perfectly. Thanks for the info. – George Bamber May 05 '20 at 19:17

1 Answers1

2

Refit 5.0 is not compatible with Uno.SourceGeneration 2.0 (used by Uno), as it loads up a Roslyn version that is different from the one used used by the Uno source generators during the build.

This is the reason you're seeing this error of method not found.

There are multiple ways to fix this (e.g. AppDomainIsolatedTask), but it cannot be done on the user's side.

Jérôme Laban
  • 5,224
  • 3
  • 20
  • 17
  • Thanks Jerome - I've gone back to the 4.8 version. I would never have worked this out. Will I be able to move to 5.0 at a later date? – George Bamber May 05 '20 at 19:19
  • We'll find a way to make this work. This is something that will happen more often in the future, now that source generators are going to be in C# 9.0. I suspect that this Refit feature will migrate over faster than Uno (some features are missing in C# 9.0 generators). – Jérôme Laban May 05 '20 at 19:54