Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NETStandard 1.3 support #312

Closed
worldbeater opened this issue Jan 19, 2018 · 11 comments
Closed

NETStandard 1.3 support #312

worldbeater opened this issue Jan 19, 2018 · 11 comments
Milestone

Comments

@worldbeater
Copy link
Contributor

worldbeater commented Jan 19, 2018

Hi @SimonCropp!

There seems to be an issue with NETStandard 1.3. When I create an empty class library targeting this NETStandard version, add PropertyChanged.Fody and build it using dotnet build, I get the following output:

Restoring packages for C:\Projects\ClassLibrary2\ClassLibrary2\ClassLibrary2.csproj...
  Generating MSBuild file C:\Projects\ClassLibrary2\ClassLibrary2\obj\ClassLibrary2.csproj.nuget.g.props.
  Restore completed in 301,7 ms for C:\Projects\ClassLibrary2\ClassLibrary2\ClassLibrary2.csproj.
    Fody: Fody (version 1.0.0.0) Executing
MSBUILD : error : Fody: Could not find 'System.Collections.Generic.EqualityComparer`1'. [C:\Projects\ClassLibrary2\ClassLibrary2\ClassLibrary2.csproj]
    Fody:   Finished Fody 332ms.

Build failed.

MSBUILD : error : Fody: Could not find 'System.Collections.Generic.EqualityComparer`1'. [C:\Projects\ClassLibrary2\ClassLibrary2\ClassLibrary2.csproj]

Project setup:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard1.3</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="PropertyChanged.Fody" Version="2.2.5" />
  </ItemGroup>
</Project>

If I change project target framework version to NETStandard 2.0, the error goes away. So does this mean, that lower standard versions are no longer supported?

Thanks.

UPD: The same thing happens to NETStandard 1.0, 1.1, ..., 1.6

@BrunoJuchli
Copy link
Contributor

BrunoJuchli commented Jan 19, 2018

Note: According to the .net api browser it should be available from .net standard 1.0 on.

@candidodmv
Copy link

+1
I'm with the same problem

@SimonCropp
Copy link
Member

do any of you want to have a go at fixing this?

@candidodmv
Copy link

No, the problem keeps

@candidodmv
Copy link

I found a workaround, downgrade for version 2.2.4

@SimonCropp
Copy link
Member

"the problem keeps"?

@candidodmv
Copy link

candidodmv commented Jan 24, 2018

sorry my english is not so good. I want to say that "the problem remains"

@worldbeater
Copy link
Contributor Author

worldbeater commented Jan 24, 2018

I found a workaround, downgrade for version 2.2.4

This workaround isn't perfect actually, Fody 2.2.4 doesn't seem to play well with new dotnet build command. So, this still needs a fix. I'll try to investigate and see what's causing the issue, but it would be great if anyone more experienced could also take a look at this (perhaps, it can save some time)

@worldbeater
Copy link
Contributor Author

worldbeater commented Jan 24, 2018

Unable to reproduce this bug using PropertyChanged.Fody's testing environment. Assemblies targeting NETStandard 1.0 and weaved by Fody's .ExecuteTestRun() method called in Tests project (which targets net46; netcoreapp2.0) are weaved just fine. Code:

public class AssemblyWithOldNetStandardTests
{
    [Fact]
    public void Load()
    {
        var weavingTask = new ModuleWeaver();
        var testResult = weavingTask.ExecuteTestRun("AssemblyWithOldNetStandard.dll");
        var instance = testResult.GetInstance("SampleImplementor");
        
        var eventCount = 0;
        ((INotifyPropertyChanged)instance).PropertyChanged += (sender, args) => eventCount++;
        instance.B = 10;
        
        Assert.Equal(1, eventCount); // OK
    }
}

AssemblyWithOldNetStandard setup:

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <TargetFramework>netstandard1.0</TargetFramework>
    <DisableFody>true</DisableFody>
  </PropertyGroup>
  <ItemGroup>
    <ProjectReference Include="..\..\PropertyChanged\PropertyChanged.csproj" />
  </ItemGroup>
</Project>

SampleImplementor.cs

[AddINotifyPropertyChangedInterface]
public class SampleImplementor
{
    public int B { get; set; }
}

So maybe there is an issue with msbuild task or the nuget package itself... 🤔

@SimonCropp
Copy link
Member

can someone upload a repro solution

@worldbeater
Copy link
Contributor Author

Here it is: https://github.com/worldbeater/PropertyChanged_312_repro
Hope this helps.

@SimonCropp SimonCropp added this to the 2.2.9 milestone Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants