microcharts-dotnet / Microcharts

Create cross-platform (Xamarin, Windows, ...) simple charts.
MIT License
2.02k stars 361 forks source link

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

Open mfeingol opened 3 years ago

mfeingol commented 3 years ago

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

eman1986 commented 3 years ago

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

mfeingol commented 3 years ago

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.

eman1986 commented 3 years ago

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

mfeingol commented 3 years ago

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.

eman1986 commented 3 years ago

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.

mfeingol commented 3 years ago

@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.

eman1986 commented 3 years ago

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

Haukinger commented 2 years ago

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.

eman1986 commented 2 years ago

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.

ebussa commented 2 years ago

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?

eman1986 commented 2 years ago

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.