Mapsui / Mapsui

Mapsui is a .NET Map component for: MAUI, WPF, Avalonia, Uno, Blazor, WinUI, Xamarin and Eto
https://mapsui.com
MIT License
1.22k stars 317 forks source link

Code Annotations in Mapsui.Geometry #54

Closed kwesolowski closed 9 years ago

kwesolowski commented 9 years ago

At the moment Mapsui.Geometries does not have access to code annotations. Has any work on it started, or do you have plan to put separate Annotations.cs to Mapsui.Geometries?

Could we make annotations internal, and use [assembly: InternalsVisibleTo("Mapsui.SomeSubProj")] to allow reuse without making annotations public? At the momemt ReSharper keeps suggesting using Mapsui.Annotations (as second option to Jetbrains.Annotations).

pauldendulk commented 9 years ago

At the moment I don't have a clear picture of the annotations story. I remember using it once and having regrets about it. What is in this case the purpose? What about making reusable code public?

You should also know Mapsui.Geometries is based on an old SharpMap code. SharpMap itself is using NTS instead. I am still considering replacing Mapsui.Geometries with NTS. For the renderer I am also considering something super simple so that it can be used in other projects. (less dependencies is less conflicts).

kwesolowski commented 9 years ago

Multiple public APIs in Mapsui lacks argument validation (so instead of ArgumentNullException NullPointerException is thrown within Mapsui internal code). While adding such validations ReSharper tries to add relevant annotation, but At the moment geometries does not have access to them.

Annotations are usefull:

I had once summarized options: http://stackoverflow.com/questions/15679473/adding-resharper-code-annotation-to-own-code-in-a-non-invasive-manner/32024227#32024227

Its relatively big decision for you to make, and I can help with execution (no matter which one you pick).

pauldendulk commented 9 years ago

Mapsui has an Annotations.cs. Is this the third option?

What do you mean with 'internal checked'?

kwesolowski commented 9 years ago

It is almost 3 option - usually Annotations.cs is generated by Resharper, and if you check "internal" then all generated attribute classes are internal. It allows to share them within one "suite" by [assembly: InternalsVisibleTo("")] but prevents client code from using them (so in your project you can generate your own/use Jetbrains.Annotations from nuget).

At the moment Annotations.cs from Mapsui are not accessible from Geometry - so either third library (Mapsui.Core?) with generated Annottations is required if we would want to reuse them, or separate Mapsui.Geomtries.Annotations would be required (or drop Annotations.cs and depend on Jetbrains.Annotaations nuget - neither solution sounds good to me :/)

pauldendulk commented 9 years ago

If we add Annotations.cs to both Mapsui and Mapsui.Geometries with "internal" checked this will not cause conflicts?

kwesolowski commented 9 years ago

AFAIK no, I can give it a try and create PR with "what i think would be best", so you can check it out.

pauldendulk commented 9 years ago

Great.

pauldendulk commented 9 years ago

https://github.com/pauldendulk/Mapsui/commit/51e750bb30a2465ba91daec096fe0f295803edb1