Microcharts icon indicating copy to clipboard operation
Microcharts copied to clipboard

[Bug] Unable to use Microcharts.Forms 1.0-preview in Xamarin Forms app that uses a .NET Standard 2.0 library

Open mfeingol opened this issue 3 years ago • 11 comments

Describe the bug Unable to use Microcharts.Forms 1.0-preview in .NET Standard 2.0 library

Which platform and version is this for? Android

To Reproduce Steps to reproduce the behavior:

  1. Install Microcharts.Forms 1.0-preview in your Xamarin Forms app
  2. Install Microcharts 0.9.5.9 in your .NET Standard 2.0 library
  3. At runtime, observe errors due to breaking changes between these two versions

Expected behavior I believe we need a 1.0-preview package for Microcharts

mfeingol avatar Aug 10 '21 21:08 mfeingol

You don't need the Microcharts package, it's not 1.0 compatible. Going forward it's by platform

eman1986 avatar Aug 10 '21 22:08 eman1986

Interesting. So if I had shared code in a library and used that library on multiple platforms... now I have to either make copies of that code or abstract it away from the Microcharts types.

mfeingol avatar Aug 10 '21 23:08 mfeingol

The idea is to keep things specific, I could make a common package if that would be beneficial.

eman1986 avatar Aug 10 '21 23:08 eman1986

I mean, it's up to you. I can see how you'd aim for the greater simplicity of a package per platform. On the other hand, those of us who support multiple platforms do benefit from having some common types we can use to consolidate code into a single place.

mfeingol avatar Aug 10 '21 23:08 mfeingol

I don't want to isolate people who use the library like you do, I know there's a couple other people who do that as well, it's not a major deal to make a shared package and it won't break things for those who do have it setup like that.

eman1986 avatar Aug 11 '21 00:08 eman1986

@eman1986: just to check in on this, do you plan to update the preview with a shared package, or will things remain as they are?

Thanks.

mfeingol avatar Nov 12 '21 01:11 mfeingol

Yes I do, been a little busy lately but I am planning on releasing another preview version soon.

eman1986 avatar Nov 12 '21 02:11 eman1986

Side note: when using microcharts newer than 0.8.4.1-pre, one cannot test with xamarin forms mocks anymore (because skia dropped the net framework assembly with 1.68.0). See this issue

This is, of course, no problem on a real device or in the simulator, but if you want to test headless with spec flow, for example, this is a show stopper.

Haukinger avatar Dec 29 '21 18:12 Haukinger

If skia dropped it, then there's nothing I can do. I'm not going to downgrade a dependency over a failure to unit test.

You might be better off making a ticket with the skia team.

eman1986 avatar Dec 29 '21 19:12 eman1986

I am using Microcharts with QuestPDF in a WPF application. So, I settled on using the new Microcharts.Forms 1.0-preview package. However, when I installed the latest Visual Studio update, I ran into Xaml Compiler errors because Microcharts.Forms package references Xamarin.Forms. Apparently, with this update, it is no longer possible for a WPF project to reference Xamarin.Forms unless you set EnableDefaultXamlItems to false in the project file (see https://github.com/dotnet/wpf/issues/6153).

I've reverted to the previous version's common package and is working for now. I wonder if there might be value in creating a Microcharts.Core package that doesn't have any "viewers"? I think that could be a good fit for integration with QuestPDF and other scenarios?

ebussa avatar Mar 04 '22 13:03 ebussa

I believe I took out wof support because it's an older framework of Microsoft and they have the uwp platform now, also I was trying to focus on the xamarin platform more than anything as that's our core demographic.

eman1986 avatar Mar 04 '22 14:03 eman1986