Giter VIP home page Giter VIP logo

pharmacist's Introduction

Build Code Coverage

Pharmacist

Builds observables from events.

Source Generator

A source generator version is being worked on over here: https://github.com/reactivemarbles/ObservableEventsSourceGenerator

NuGet Packages

Install the following packages to start using Pharmacist.

Name Platform NuGet
Pharmacist.Core Core - Libary CoreBadge
Pharmacist Global Tool GlobalToolBadge
Pharmacist.MSBuild MSBuild Task MsBuildBadge
Pharmacist.Common Common CommonBadge

What does it do?

Pharmacist will convert events within an assembly and create observable wrappers for them.

It has been called pharmacist since it will generate Reactive Extensions (Rx) Observables for events, so it's a play on word about "Rx" which is short for prescriptions.

It can generate the observables for the following:

  • System Platforms, such as Xamarin (iOS/Android/TVOS), UWP
  • NuGet packages
  • Assemblies.

There is a MSBuild Task version and a global tool version.

How do I use?

MsBuild

Pharmacist can automatically create Observable wrappers for projects for their explicitly included NuGet packages.

In your .csproj file you can add:

<ItemGroup>
    <PackageReference Include="Pharmacist.MsBuild" Version="1.*" PrivateAssets="all" />
    <PackageReference Include="Pharmacist.Common" Version="1.*" />
</ItemGroup>

Pharmacist.MsBuild contains the MsBuild target file and appropriate tasks. Pharmacist.Common includes common source code that is required to invoke the generated observables.

This will generate wrappers only for other included PackageReference's contained within the project file.

For example if you had a inclusion for Xamarin.Forms in the same project that includes Pharmacist it will generate Observable wrappers for the included codes. It will not include any child PackageReference from other projects included via a ProjectReference. You can override that functionality by including <PharmacistGlobalPackages>true</PharmacistGlobalPackages> in a PropertyGroup inside your project.

Also it will only generate the specified ProjectReference and none of it's dependent packages. For example for a ProjectReference inclusion of ReactiveUI, it will not generate dependencies such as System.Reactive. If you want to generate observable wrappers for the dependent NuGet packages you must explicitly include them.

Command Line

Pharmacist comes with a command line version which is useful for generating for a specified platform.

The following values are supported for platforms: Android, iOS, Mac, WPF, UWP, Winforms, TVOS

Install the global tool:

dotnet tool install -g Pharmacist

To generate files:

pharmacist generate-platform -p <Platform> -o c:/directory/for/output --output-prefix="Events"

This would generate a file named Events_<Platform>.cs, where Platform would be the platform specified.

In the near future this will be changing to TargetFramework with /wpf and /winforms options.

Contribute

Pharmacist is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. Because of our Open Collective model for funding and transparency, we are able to funnel support and funds through to our contributors and community. We ❤ the people who are involved in this project, and we’d love to have you on board, especially if you are just getting started or have never contributed to open-source before.

So here's to you, lovely person who wants to join us — this is how you can support us:

pharmacist's People

Contributors

chrispulman avatar dependabot-preview[bot] avatar dependabot[bot] avatar glennawatson avatar worldbeater avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pharmacist's Issues

Make comments produce full XmlDoc style function locations

At the moment the function locations only point towards the function name. This can cause obsolete warnings to happen if someone happens to obsolete once version of the method. Change the comment generation to produce a full xml doc compatible version of the string to avoid these warnings.

[BUG] Can't handle generic base classes

Describe the bug

Pharmasist does not pick up events contained in a base class with generics.

public class TabbedPage : MultiPage, IBarElement, IElementConfiguration

Steps To Reproduce

Add pharmacist to your Xamarin Forms project.
Try to access observables from events generated from a page with generics.
public class TabbedPage : MultiPage, IBarElement, IElementConfiguration

Events like CurrentPageChanged is not generated.

Environment
Xamarin Forms 4.3

feature: Add support for MsBuild Central Package Version

Is your feature request related to a problem? Please describe.

Recently I started migrating projects to MsBuild Sdk Central Package Version. When I attempted to use Pharmacist in the following project I get errors CentralPackageVersion.

Describe the solution you'd like

Worst case, I can use Central Package Version with Pharmacist. Best case I can use Central Package Version with Pharmacist only in specific projects in my solution.

Describe alternatives you've considered

Removing Central Package Versioning.

Describe suggestions on how to achieve the feature

With my lack of knowledge on the subject I would assume that the MsBuild engine simply can't read the package version with. Pharmacist

Additional context

[BUG] Console version hardcodes TargetFramework to 16299 for UWP

Describe the bug
Generating events for UWP platform using console hardcodes the TargetPlatform to 16299.

Console app should take another parameter to specify the TargetPlatform

Steps To Reproduce
pharmacist generate-platform -p uwp -o c:\logs\ -output-prefix _Event

Additional context
Should this be applicable for other platforms too?

[BUG] Not Generate PropertyChanged event on .NET Standard 2.1

Describe the bug
If I use .NET Standard 2.1 project, no code generation occurs only for PropertyChanged.
Everything's fine with .NET Standard 2.0

Expected behavior
The following code should be generated:

public global::System.IObservable<global::System.ComponentModel.PropertyChangedEventArgs> PropertyChanged => global::System.Reactive.Linq.Observable.FromEvent<global::System.ComponentModel.PropertyChangedEventHandler, global::System.ComponentModel.PropertyChangedEventArgs>(eventHandler =>
{
    void Handler(object sender, global::System.ComponentModel.PropertyChangedEventArgs e) => eventHandler(e);
    return Handler;
}, x => _data.PropertyChanged += x, x => _data.PropertyChanged -= x);

Screenshots
image

Additional context

// Generated with Pharmacist version: 2.0.6+357b54abbd
// Package included: Autofac.6.1.0
// Package included: ImageFromXamarinUI.1.0.0-pre1
// Package included: Microsoft.AppCenter.Analytics.4.1.0
// Package included: Microsoft.AppCenter.Crashes.4.1.0
// Package included: Newtonsoft.Json.12.0.3
// Package included: Newtonsoft.Json.Bson.1.0.2
// Package included: Polly.7.2.1
// Package included: ReactiveUI.Fody.13.1.1
// Package included: ReactiveUI.XamForms.13.1.1
// Package included: Rg.Plugins.Popup.2.0.0.9
// Package included: SkiaSharp.Views.Forms.2.80.2
// Package included: sqlite-net-pcl.1.8.0-beta
// Package included: System.Reactive.5.0.0
// Package included: TouchView.4.1.99
// Package included: Xamanimation.1.3.0
// Package included: Xamarin.Forms.5.0.0.1905
// Package included: Xamarin.Essentials.1.6.0
// Package included: Xamarin.Forms.PancakeView.2.3.0.759

[BUG] Event generation fails for FFImageLoading

Describe the bug
When you install Pharmacist in a Xamarin.Forms project that has FFImageLoading it makes the event generation to fail. It can't basically handle the events that FF exposes cause they are in a static class with all the events.

Steps To Reproduce

  1. Install Pharmacist latest (1.2.2) into a Xamarin.Forms app that has FFImageLoading as well
  2. Build the project
  3. It fails on building

Expected behavior
The events should be generated.

Screenshots
image

feature: Add Blazor EventCallback Support

Is your feature request related to a problem? Please describe.

Currently, I cannot use a Blazorise TextEdit.Events(). The TextEdit exposes an EventCallback which is basically a delegate.

Describe the solution you'd like

I would like to be able to wrap events exposed by Blazor components the same way I can with other events.

Describe alternatives you've considered

None.

Describe suggestions on how to achieve the feature

Additional context

[BUG] Can't get pharmacist to work in an Uno UWP app

I'm trying to get Pharmacist to work on an Uno Platform app.
The app consists of 4 platform-specific projects: UWP, Xamarin.Droid, Xamarin.iOS and WASM (.NET Standard).

Here's a repro app that contains a newly generated Uno app (using the Uno Templates Extension), whose project files have been modified to add the following two lines before any other PackageReference declarations, as of this commit:

<PackageReference Include="Pharmacist.MsBuild" Version="1.*" PrivateAssets="all" />
<PackageReference Include="Pharmacist.Common" Version="1.*" />

When trying to build the project, I'm getting errors such as:

error MSB4044: The "PharmacistNuGetTask" task was not given a value for the required parameter "TargetFramework".

image

Xamarin.Forms Build fails after installing Pharmacist NuGets

Describe the bug
Build fails after installing Pharmacist

Steps To Reproduce

  1. Install Phamacist nuget into shared project (.Net Standard 2.0)
<PackageReference Include="Pharmacist.MsBuild" Version="1.*" PrivateAssets="all" />
<PackageReference Include="Pharmacist.Common" Version="1.*" />
  1. Try to build application
  2. See screenshot

Expected behavior
Build succeeds and all events are available as observables

Screenshots
image

Environment

  • OS: Windows 10
  • Device: Desktop i9 with 64GB ram
  • Version: 1.9.1
  • Working Version: n/a
  • Dev Env: VS2019 16.7.5 connected to MacBook Pro 10.15.7

Additional context

Seems to be only with a namespace of Xamarin.MacDev and the Shiny Geofence SetState method override. Do I need to exclude these? Or is there some other way to remove these build issues?

feature: Add base interface

Describe the solution you'd like

Add an interface that event classes can inherit from.

// A better name may be something like IRx or IReactive?
public interface IEvent<T>
{
    T Data { get; }
}

the implementation could then look like the following

public class RxUIControlEvents : IEvent<UIControl>
{
       public UIControl Data => _data;

       private readonly global::UIKit.UIControl _data;
       /// <summary>
       /// Initializes a new instance of the <see cref = "global::UIKit.UIControl"/> class.
       /// </summary>
       /// <param name = "data">The class that is being wrapped.</param>
       public RxUIControlEvents(global::UIKit.UIControl data)
       {
           _data = data;
       }

       // Event bindings removed for brevity
}

Why would this be useful?
This would then make it easy to create static helper methods for updating UI elements based on observables

public static Action<bool> Enabled(this IEvent<UIControl> reactive)
{
     return (enabled) =>
     {
           reactive.Data.Enabled = enabled;
     };
}

from the view code (e.g. UIViewController in iOS) this would enable

button = new UIButton();

ViewModel.Command
    .CanExecute
    .Subscribe(button.Events().Enabled())
    .DisposeWith(disp);

Additional Considerations

  1. I'm coming from an iOS/Android perspective, so understand that the interface might not apply to all situations; pharmacist is about creating observables from events, so the IEvents idea might be a level on top of pharmacist?

  2. RxSwift uses Rx where Pharmacist uses Events by default; adding the base interface would mean that Pharmacist wouldn't just be for events

Using the example above

ViewModel.Command
    .CanExecute
    // Confusing as this isn't an event
    .Subscribe(button.Events().Enabled())
    .DisposeWith(disp);

the Rx naming now makes more sense?

ViewModel.Command
    .CanExecute
    // More like the RxSwift style
    .Subscribe(button.Rx().Enabled())
    .DisposeWith(disp);

[BUG] Visual Studio 2019.16.5 hangs with Phamacist installed

Describe The Bug

After installing Phamacist.MsBuild and Phamacist.Common from Nuget to a newly created Xamarin project created from Prism Template. Restart Visual Studio 2019 Community and open the project. Visual Studio 2019 hangs after a few minutes at most.

However it doesn't say unresponsive in Windows Task Manager. CPU and Memory are not busy at all. There is also a Visual Studio Delay Notification in the System Tray.

I have to kill Visual Studio when this happens, it doesn't come back to life when this happens. I suspect there is something in the work that blocks Visual Studio, a infinite loop or doing something that takes a extremely long time to complete.

Steps To Reproduce

  1. Create a new Xamarin Prism project
  2. Install Phamacist.MsBuild and Phamacist.Common to main application lib
  3. Restart Visual Studio
  4. Visual Studio hangs after a few minutes, sometimes after a few minutes, some times very quickly
  5. Remove Phamacist.MsBuild and Phamacist.Common, Visual Studio does not hang.

Expected Behaviour
Visual studio should not hang.

Environment

OS: Windows 2004
Newly installed Visual Studio Version: 2019, 16.6.5, no extra extensions.

[BUG] NugetTask fail when project has dependencies hosted on private repos

Describe the bug

When your csproj reference package that are not hosted on nuget.org, it makes the build fail on PharmacistNuGetTask

Steps To Reproduce

Provide the steps to reproduce the behavior:
In your csproj add a PackageReference to a nuget package that is hosted on a private repo

Expected behavior

No build errors, and Pharmacist.Nuget.g.cs generated for all nuget packages (or at least the ones that could be downloaded)

Environment

  • OS: macOS/Windows
  • Device:
  • Version: 1.2.2
  • Working Version:

Additional context
Copy of stacktrace :
/.nuget/packages/pharmacist.msbuild/1.2.2/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(5,5): Error: PharmacistNuGetTask: System.NullReferenceException: Object reference not set to an instance of an object
at NuGet.Protocol.DownloadResourceV3.GetDownloadUrl (NuGet.Packaging.Core.PackageIdentity identity, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x0007a] in :0
at NuGet.Protocol.DownloadResourceV3.GetDownloadResourceResultAsync (NuGet.Packaging.Core.PackageIdentity identity, NuGet.Protocol.Core.Types.PackageDownloadContext downloadContext, System.String globalPackagesFolder, NuGet.Common.ILogger logger, System.Threading.CancellationToken token) [0x000bd] in :0
at Pharmacist.Core.NuGet.NuGetPackageHelper+<>c__DisplayClass16_0.b__4 (System.ValueTuple2[T1,T2] item) [0x00094] in <c092543ffe3f4af794d331f791699d8f>:0 at Pharmacist.Core.NuGet.NuGetPackageHelper.GetPackagesToCopy (System.Collections.Generic.IReadOnlyCollection1[T] startingPackages, NuGet.Protocol.Core.Types.DownloadResource downloadResource, System.Collections.Generic.IReadOnlyCollection1[T] frameworks, System.Boolean getDependencies, System.Threading.CancellationToken token) [0x001f2] in <c092543ffe3f4af794d331f791699d8f>:0 at Pharmacist.Core.NuGet.NuGetPackageHelper.DownloadPackageFilesAndFolder (System.Collections.Generic.IReadOnlyCollection1[T] packageIdentities, System.Collections.Generic.IReadOnlyCollection1[T] frameworks, NuGet.Protocol.Core.Types.DownloadResource downloadResource, System.Boolean getDependencies, System.Collections.Generic.IReadOnlyCollection1[T] packageFolders, System.String packageOutputDirectory, System.Threading.CancellationToken token) [0x00084] in :0
at Pharmacist.Core.NuGet.NuGetPackageHelper.DownloadPackageFilesAndFolder (System.Collections.Generic.IReadOnlyCollection1[T] libraryIdentities, System.Collections.Generic.IReadOnlyCollection1[T] frameworks, NuGet.Configuration.PackageSource nugetSource, System.Boolean getDependencies, System.Collections.Generic.IReadOnlyCollection1[T] packageFolders, System.String packageOutputDirectory, System.Threading.CancellationToken token) [0x00288] in <c092543ffe3f4af794d331f791699d8f>:0 at Pharmacist.Core.Extractors.NuGetExtractor.Extract (System.Collections.Generic.IReadOnlyCollection1[T] targetFrameworks, System.Collections.Generic.IReadOnlyCollection1[T] packages, System.String packageOutputDirectory) [0x0008a] in <c092543ffe3f4af794d331f791699d8f>:0 at Pharmacist.Core.ObservablesForEventGenerator.ExtractEventsFromNuGetPackages (System.IO.TextWriter writer, System.Collections.Generic.IReadOnlyCollection1[T] packages, System.Collections.Generic.IReadOnlyCollection`1[T] frameworks, System.String packageOutputFolder) [0x00090] in :0
at Pharmacist.MsBuild.PharmacistNuGetTask.Execute () [0x0014b] in :0 (Tech5.Core)

[BUG] Attempt to generate WinUI event, project compiles but events file not generated

Describe the bug
I am trying to generate events for a WinUI/UWP project. The UWP library project with reference to Pharmacist.MsBuild builds but fails to generate events file

Steps To Reproduce

  1. Open visual studio 2019
  2. Create a UWP C# library project
  3. Add reference to WinUI 2.4 pre-release
  4. Add nuget reference to Pharmacist.MsBuild
  5. Change target to 1903 and min target to 1803
  6. Build the project

repo project is here

Expected behavior
Events class/file should have been generated

Screenshots
The solution doesn't show the Pharmacist.MsBuild reference for some reason
image

Environment

  • OS: Windows 1803
  • Visual Studio 2019 16.4

[BUG] Avoid NuGet files hitting same location.

Need some checks to avoid hitting the same NuGet locations.

Eg if project A and project B are dual compiling they sometimes can leave file locks open based on our package management system.

[BUG] Visual Studio 2019 hangs during project build

Describe the bug
After adding following lines to a newly created UWP project, the project build hangs visual studio.

<ItemGroup>
    <PackageReference Include="Pharmacist.MsBuild" Version="1.*" PrivateAssets="all" />
    <PackageReference Include="Pharmacist.Common" Version="1.*" />
</ItemGroup>

Steps To Reproduce

  1. Create a new UWP Blank app
  2. Edit the csproj with the above mentioned code snippet
  3. Rebuild the csproj
  4. Visual Studio hangs

Expected behavior
Visual studio should not hang.

Environment

  • OS: Windows 1803
  • Visual Studio Version: 2019, 16.4.0

Additional context

Generate reactiveui-events for windows.web.ui.interop.webviewcontrol and friends

We are looking for someone to PR in the UWP controls in webforms/wpf. See https://t.co/5d9TKO56XH for specifics. Will be fleshing it out some more now that this has been announced.

— 𝓖eoffrey 𝓗untley (@geoffreyhuntley) May 7, 2018

As per the announcement today we are looking for folks to send in the appropriate PR's to the ReactiveUI event builder that generates IObservables for all EventHandlers in the new public API that makes UWP controls run in WinForms and WPF:

https://blogs.msdn.microsoft.com/dotnet/2018/05/07/net-core-3-and-support-for-windows-desktop-applications/

See this API for specifics as an example:

https://docs.microsoft.com/en-us/uwp/api/windows.web.ui.interop.webviewcontrol

See ~/src/EventBuilder in the codebase.

[BUG] Can't build : System.NullReferenceException on Xamarin.Android

Describe the bug

/Users/Christophe/.nuget/packages/pharmacist.msbuild/1.5.15/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(48,5): error : PharmacistNuGetTask: System.NullReferenceException: Object reference not set to an instance of an object
/Users/Christophe/.nuget/packages/pharmacist.msbuild/1.5.15/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(48,5): error : at NuGet.Protocol.DownloadResourceV3.GetDownloadUrl (NuGet.Packaging.Core.PackageIdentity identity, NuGet.Common.ILogger log, System.Threading.CancellationToken token) [0x0007a] in <83330316d0b44741910fff5cb41b7909>:0
/Users/Christophe/.nuget/packages/pharmacist.msbuild/1.5.15/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(48,5): error : at NuGet.Protocol.DownloadResourceV3.GetDownloadResourceResultAsync (NuGet.Packaging.Core.PackageIdentity identity, NuGet.Protocol.Core.Types.PackageDownloadContext downloadContext, System.String globalPackagesFolder, NuGet.Common.ILogger logger, System.Threading.CancellationToken token) [0x000bd] in <83330316d0b44741910fff5cb41b7909>:0
/Users/Christophe/.nuget/packages/pharmacist.msbuild/1.5.15/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(48,5): error : at Pharmacist.Core.NuGet.NuGetPackageHelper+<>c__DisplayClass17_0.b__4 (System.ValueTuple`2[T1,T2] item) [0x00094] in <9df0e4b5ad784380b78db0d845007e4b>:0

Screenshots

Capture d’écran 2020-03-12 à 14 16 28

Environment
OS: Mac OS 10.15.3 (19D76)
Android SDK version: 10
VS version: 8.4.8 (build 2)
ReactiveUI versions: 11.2.3 (ReactiveUI, ReactiveUI.AndroidX, ReactiveUI.AndroidSupport)
Pharmacist version: 1.5.15

Additional context

feature: MAUI Support

Is your feature request related to a problem? Please describe.
There is an error regarding to use Pharmacist on MAUI

1>C:\Users\steve\.nuget\packages\pharmacist.msbuild\1.9.1\buildTransitive\netstandard2.0\Pharmacist.MSBuild.targets(48,5): error : Neither TargetFramework nor ProjectTypeGuids have been correctly set.
1>Done building project "MauiWithGraphQL.csproj" -- FAILED.
1>C:\Users\steve\.nuget\packages\pharmacist.msbuild\1.9.1\buildTransitive\netstandard2.0\Pharmacist.MSBuild.targets(48,5): error : Neither TargetFramework nor ProjectTypeGuids have been correctly set.

Although TargetFrameworks is well set:

	<PropertyGroup>
		<TargetFrameworks>net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
		<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>

Describe the solution you'd like

To have seamless integration of MAUI

Describe alternatives you've considered
Just manually rewrite the events

Xamarin iOS project builds fine in VS2019 but Azure Devops Xamarin.iOS build on same mac fails

Describe the bug

When building using a build agent on mac. Pharmacist fails with the following exception:

"/Users/fmsdeveloper/myagent/_work/1/s/SourceFTAApp/FTAApp/FTAApp.iOS/FTAApp.iOS.csproj" (default target) (1:7) ->
"/Users/fmsdeveloper/myagent/_work/1/s/SourceFTAApp/FTAApp/FTAApp/FTAApp.csproj" (default target) (3:10) ->
"/Users/fmsdeveloper/myagent/_work/1/s/SourceFTAApp/FTAApp/FTAApp.Events/FTAApp.Events.csproj" (default target) (8:6) ->
(GeneratePharmacist target) -> 
  /Users/fmsdeveloper/.nuget/packages/pharmacist.msbuild/1.0.118/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(46,5): error : PharmacistNuGetTask: System.TypeInitializationException: The type initializer for 'Pharmacist.Core.NuGet.NuGetPackageHelper' threw an exception. ---> System.MissingMethodException: Method not found: System.Collections.Generic.IEnumerable`1<NuGet.Configuration.Settings> NuGet.Configuration.XPlatMachineWideSetting.get_Settings() [/Users/fmsdeveloper/myagent/_work/1/s/SourceFTAApp/FTAApp/FTAApp.Events/FTAApp.Events.csproj]
/Users/fmsdeveloper/.nuget/packages/pharmacist.msbuild/1.0.118/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(46,5): error :    --- End of inner exception stack trace --- [/Users/fmsdeveloper/myagent/_work/1/s/SourceFTAApp/FTAApp/FTAApp.Events/FTAApp.Events.csproj]
/Users/fmsdeveloper/.nuget/packages/pharmacist.msbuild/1.0.118/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(46,5): error :   at Pharmacist.Core.Extractors.NuGetExtractor.Extract (System.Collections.Generic.IReadOnlyCollection`1[T] targetFrameworks, System.Collections.Generic.IReadOnlyCollection`1[T] packages, System.String packageOutputDirectory) [0x00011] in <02068e4e71d14f93bcb53e5fe98ec7dc>:0  [/Users/fmsdeveloper/myagent/_work/1/s/SourceFTAApp/FTAApp/FTAApp.Events/FTAApp.Events.csproj]
/Users/fmsdeveloper/.nuget/packages/pharmacist.msbuild/1.0.118/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(46,5): error :   at Pharmacist.Core.ObservablesForEventGenerator.ExtractEventsFromNuGetPackages (System.IO.TextWriter writer, System.Collections.Generic.IReadOnlyCollection`1[T] packages, System.Collections.Generic.IReadOnlyCollection`1[T] frameworks, System.String packageOutputFolder) [0x00090] in <02068e4e71d14f93bcb53e5fe98ec7dc>:0  [/Users/fmsdeveloper/myagent/_work/1/s/SourceFTAApp/FTAApp/FTAApp.Events/FTAApp.Events.csproj]
/Users/fmsdeveloper/.nuget/packages/pharmacist.msbuild/1.0.118/buildTransitive/netstandard2.0/Pharmacist.MSBuild.targets(46,5): error :   at Pharmacist.MsBuild.PharmacistNuGetTask.Execute () [0x0014b] in <d801f7198a52487083dbe2f636ec67bf>:0  [/Users/fmsdeveloper/myagent/_work/1/s/SourceFTAApp/FTAApp/FTAApp.Events/FTAApp.Events.csproj]

Steps To Reproduce

Build Xamarin Forms iOS project using Xamarin.iOS Azure Devops Task.

Expected behavior

Should build without error.

Works fine when building in the VS2019 environment with the same mac paired

Screenshots

Environment

  • OS:
  • Version
  • Device:

Additional context

[BUG] fails to build with native dependency `VideoLAN.LibVLC.Windows`: `PEFileNotSupportedException: PE file does not contain any managed metadata`

Describe the bug
Pharmacist causes the build to fail if a nuget package containing native code is listed as a dependency;

<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.12" />

The exception during dotnet build:

Pharmacist.MSBuild.targets(48, 5): PharmacistNuGetTask: ICSharpCode.Decompiler.Metadata.PEFileNotSupportedException: PE file does not contain any managed metadata.
  at ICSharpCode.Decompiler.Metadata.PEFile..ctor(String fileName, PEReader reader, MetadataReaderOptions metadataOptions) in D:\a\Pharmacist\Pharmacist\src\ICSharpCode.Decompiler\Metadata\PEFile.cs:line 68
  at ICSharpCode.Decompiler.Metadata.PEFile..ctor(String fileName, PEStreamOptions streamOptions, MetadataReaderOptions metadataOptions) in D:\a\Pharmacist\Pharmacist\src\ICSharpCode.Decompiler\Metadata\PEFile.cs:line 54
  at Pharmacist.Core.Generation.Compilation.EventBuilderCompiler.<>c.<.ctor>b__3_1(String x) in D:\a\Pharmacist\Pharmacist\src\Pharmacist.Core\Generation\Compilation\EventBuilderCompiler.cs:line 50
  at System.Linq.Utilities.<>c__DisplayClass2_0`3.<CombineSelectors>b__0(TSource x)
  at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
  at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
  at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
  at Pharmacist.Core.Generation.Compilation.EventBuilderCompiler..ctor(InputAssembliesGroup input, NuGetFramework framework) in D:\a\Pharmacist\Pharmacist\src\Pharmacist.Core\Generation\Compilation\EventBuilderCompiler.cs:line 52
  at Pharmacist.Core.ObservablesForEventGenerator.ExtractEventsFromAssemblies(TextWriter writer, InputAssembliesGroup input, NuGetFramework framework) in D:\a\Pharmacist\Pharmacist\src\Pharmacist.Core\ObservablesForEventGenerator.cs:line 324
  at Pharmacist.Core.ObservablesForEventGenerator.ExtractEventsFromNuGetPackages(TextWriter writer, IReadOnlyCollection`1 packages, IReadOnlyCollection`1 frameworks, String packageOutputFolder) in D:\a\Pharmacist\Pharmacist\src\Pharmacist.Core\ObservablesForEventGenerator.cs:line 144
  at Pharmacist.MsBuild.NuGet.PharmacistNuGetTask.Execute() in D:\a\Pharmacist\Pharmacist\src\Pharmacist.MsBuild.NuGet\PharmacistNuGetTask.cs:line 117

Adding <ExcludeAssets>buildTransitive</ExcludeAssets> additionally to <PrivateAssets>all</PrivateAssets> fixes the build problem, but then Pharmacist just doesn't generate the Events() extension methods either.

Steps To Reproduce

  1. Add a nuget dependency on a package containing native code. In my case:
    <PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.12" />
  2. build the project
    It will fail with the above error

Expected behavior
the presence of native libraries would not cause the build to fail.

Environment

  • Windows 10 20H2
  • dotnet 5.0.202
  • Pharmacist 2.0.8

No actual assembly ICSharpCode.Decompiler available for net5.0

No actual assembly ICSharpCode.Decompiler available for net5.0

Describe the bug

/home/vsts/work/1/s/nukebuild/_build.csproj : warning NU1603: Pharmacist.Core 2.0.6 depends on ICSharpCode.Decompiler (>= 2.0.6) but ICSharpCode.Decompiler 2.0.6 was not found. An approximate best match of ICSharpCode.Decompiler 2.3.0 was resolved.
/home/vsts/work/1/s/nukebuild/_build.csproj : warning NU1701: Package 'ICSharpCode.Decompiler 2.3.0' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
/home/vsts/work/1/s/nukebuild/_build.csproj : warning NU1701: Package 'ICSharpCode.NRefactory 5.5.1' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.

Pharmacist has its own ICSharpCode.Decompiler which is not covered

Steps To Reproduce
Provide the steps to reproduce the behavior:

  1. Go to Avalonia Build Pipelines https://dev.azure.com/AvaloniaUI/AvaloniaUI/_build/results?buildId=12768&view=logs&j=2d2b3007-3c5c-5840-9bb0-2b1ea49925f3&t=f33089cd-d3fe-578c-2c5e-4ee560e10a0d
  2. Click on Linux -> Run Nuke
  3. Scroll down to end
  4. See error
    TypeLoadException: Could not load type 'ICSharpCode.Decompiler.TypeSystem.ICompilation' from assembly 'ICSharpCode.Decompiler, Version=2.3.0.1834, Culture=neutral, PublicKeyToken=d4bfe873e7598c49'.

Expected behavior
Builds and runs without warnings and exceptions

Screenshots

Environment

  • OS: Windows, Mac, Linux
  • Device:
  • Version: 2.0.6
  • Working Version:

Additional context

Changes AvaloniaUI/Avalonia@b265eff

[BUG] Unable to install Pharmacist package into Xamarin Forms 4.8.0.1821project

Describe the bug

I'm unable to install Pharmacist into Xamarin Forms 4.8.0.1821 project which targets netstandard2.0.

Package install fails with the following message.

Severity Code Description Project File Line Suppression State
Error NU1202 Package Pharmacist 2.0.6 is not compatible with netstandard2.0 (.NETStandard,Version=v2.0). Package Pharmacist 2.0.6 supports: net5.0 (.NETCoreApp,Version=v5.0) / any

The rest of the required Pharmacist packages install without a problem.

Steps To Reproduce

Expected behavior

Screenshots

Environment

  • OS:
  • Device:
  • Version:
  • Working Version:

Additional context

[Question] Issue with Pharmacist NuGet Task

Describe the bug

The "PharmacistNuGetTask" task was not given a value for the required "TargetFramework".

Steps To Reproduce
There is a reproduction repository provided
https://github.com/RLittlesII/Rfid.Observables/tree/feature/tsl-demo

Expected behavior

That Pharmacist either generates observables, or tells me why it cant.

Environment

  • macOSX: It appears to build fine
  • Windows I receive the listed error

Additional context

I also installed the Pharmacist global tool. That executed fine, generated events, none of the events were from the Tsl.AsciiProtocol package. I suspect because there are events, but I am not sure that event handlers are defined in that nuget. I loaded it in dotpeek and poked around a bit.

Weak Events?

Does Reactive.Pharmacist provide a simple solution for weak event handlers?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.