Cannot find assembly system.core version 2.0.5.0

esben's Avatar

esben

22 Sep, 2017 11:12 AM

Hi
I just upgraded to Postsharp 5.0.34 and one of my unit test projects (which worked with 5.0.33) can't compile anymore :(`

I get the following error:
Cannot find assembly 'system.core, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e'. [Public key mismatch]. Build your project with detailed verbosity to see the assembly loading log.

And the detailed log output says the following:

3>  Connecting to PostSharp pipe server 'postsharp-S-1-5-21-1292172865-3042284784-1192131078-3625e-4.0-x64-release-5.0.34'
3>  The pipe server is already started: ServerRunningMutex is held.
3>  Synchronizing with other clients for pipe server 'postsharp-S-1-5-21-1292172865-3042284784-1192131078-3625e-4.0-x64-release-5.0.34' access.
3>  Waiting for pipe server 'postsharp-S-1-5-21-1292172865-3042284784-1192131078-3625e-4.0-x64-release-5.0.34' to prepare a new pipe.
3>  Connected to the pipe after 0 ms. Requesting with 39 arguments: obj\x64\Debug\Before-PostSharp\Infosoft.S4.Framework.UnitTest.dll; /X:C:\Code\repos\s4\framework\Framework\postsharp.config; /X:default; /NoLogo; /P:Output=C:\Code\repos\s4\framework\Framework\test\Infosoft.S4.Framework.UnitTest\obj\x64\Debug\Infosoft.S4.Framework.UnitTest.dll; /P:ReferenceDirectory=C:\Code\repos\s4\framework\Framework\test\Infosoft.S4.Framework.UnitTest; /P:Configuration=Debug; /P:Platform=x64; /P:SearchPath=bin\x64\Debug\|obj\x64\Debug\|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\; /P:IntermediateDirectory=obj\x64\Debug\PostSharp; /P:CleanIntermediate=False; /P:MSBuildProjectFullPath=C:\Code\repos\s4\framework\Framework\test\Infosoft.S4.Framework.UnitTest\Infosoft.S4.Framework.Core.UnitTest.csproj; /P:SignAssembly=False; /P:PrivateKeyLocation=; /P:PrivateKeyContainer=; /P:DelaySign=; /P:ResolvedReferences=C:\Code\repos\s4\framework\Framework\packages\Castle.Core.4.1.1\lib\net45\Castle.Core.dll|C:\Code\repos\s4\framework\Framework\packages\FluentAssertions.4.19.4\lib\net45\FluentAssertions.Core.dll|C:\Code\repos\s4\framework\Framework\packages\FluentAssertions.4.19.4\lib\net45\FluentAssertions.dll|C:\Code\repos\s4\framework\Framework\src\Infosoft.S4.Framework.Core\bin\x64\Debug\Infosoft.S4.Framework.Core.dll|C:\Code\repos\s4\framework\Framework\test\Infosoft.S4.Framework.Stubs\bin\x64\Debug\Infosoft.S4.Framework.Stubs.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Microsoft.CSharp.dll|C:\Code\repos\s4\framework\Framework\packages\Moq.4.7.99\lib\net45\Moq.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\mscorlib.dll|C:\Code\repos\s4\framework\Framework\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll|C:\Code\repos\s4\framework\Framework\packages\PostSharp.Redist.5.0.34\lib\net45\PostSharp.dll|C:\Code\repos\s4\framework\Framework\packages\PostSharp.Patterns.Aggregation.Redist.5.0.34\lib\net45\PostSharp.Patterns.Aggregation.dll|C:\Code\repos\s4\framework\Framework\packages\PostSharp.Patterns.Common.Redist.5.0.34\lib\net46\PostSharp.Patterns.Common.dll|C:\Code\repos\s4\framework\Framework\packages\PostSharp.Patterns.Diagnostics.Redist.5.0.34\lib\net46\PostSharp.Patterns.Diagnostics.dll|C:\Code\repos\s4\framework\Framework\packages\PostSharp.Patterns.Model.Redist.5.0.34\lib\net40\PostSharp.Patterns.Model.dll|C:\Code\repos\s4\framework\Framework\packages\ReflectionMagic.3.0.0\lib\net45\ReflectionMagic.dll|C:\Code\repos\s4\framework\Framework\packages\System.Collections.Immutable.1.4.0\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Core.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Data.DataSetExtensions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Data.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Net.Http.dll|C:\Code\repos\s4\framework\Framework\packages\System.Reflection.4.3.0\lib\net462\System.Reflection.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Xml.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Xml.Linq.dll|C:\Code\repos\s4\framework\Framework\packages\xunit.runner.visualstudio.2.2.0\build\_common\xunit.abstractions.dll|C:\Code\repos\s4\framework\Framework\packages\xunit.assert.2.2.0\lib\netstandard1.1\xunit.assert.dll|C:\Code\repos\s4\framework\Framework\packages\xunit.extensibility.core.2.2.0\lib\netstandard1.1\xunit.core.dll|C:\Code\repos\s4\framework\Framework\packages\xunit.extensibility.execution.2.2.0\lib\net452\xunit.execution.desktop.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Collections.Concurrent.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Collections.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ComponentModel.Annotations.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ComponentModel.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ComponentModel.EventBasedAsync.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Diagnostics.Contracts.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Diagnostics.Debug.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Diagnostics.Tools.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Diagnostics.Tracing.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Dynamic.Runtime.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Globalization.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.IO.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Linq.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Linq.Expressions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Linq.Parallel.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Linq.Queryable.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Net.NetworkInformation.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Net.Primitives.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Net.Requests.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Net.WebHeaderCollection.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ObjectModel.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Reflection.Emit.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Reflection.Emit.ILGeneration.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Reflection.Emit.Lightweight.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Reflection.Extensions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Reflection.Primitives.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Resources.ResourceManager.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Extensions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Handles.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.InteropServices.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.InteropServices.WindowsRuntime.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Numerics.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Serialization.Json.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Serialization.Primitives.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Runtime.Serialization.Xml.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Security.Principal.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ServiceModel.Duplex.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ServiceModel.Http.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ServiceModel.NetTcp.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ServiceModel.Primitives.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.ServiceModel.Security.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Text.Encoding.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Text.Encoding.Extensions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Text.RegularExpressions.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Threading.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Threading.Tasks.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Threading.Tasks.Parallel.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Threading.Timer.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Xml.ReaderWriter.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Xml.XDocument.dll|C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\Facades\System.Xml.XmlSerializer.dll; /P:SymbolFile=bin\x64\Debug\Infosoft.S4.Framework.UnitTest.pssym; /P:WriteWeavingSymbols=True; /P:ConstraintVerificationEnabled=True; /P:RuntimeVerificationEnabled=True; /P:TargetFrameworkMoniker=.NETFramework,Version=v4.6.2; /P:TargetPlatformMoniker=Windows,Version=7.0; /P:AspectProviders=; /P:Language=C#; /P:DefineConstants=POSTSHARP|DEBUG|TRACE; /P:UnattendedCheckDisabled=False; /P:DebugType=full; /P:BenchmarkOutputEnabled=; /P:DebuggerExtensionsMode=; /P:BuildDependenciesFile=obj\x64\Debug\PostSharp\dependencies.txt; /P:ProgramDataDirectory=C:\ProgramData\PostSharp; /P:ToolDirectory=C:\ProgramData\PostSharp\5.0.34; /P:VsixVersion=5.0.32.0; /P:InstalledFrameworksFilePath=C:\ProgramData\PostSharp\InstalledFrameworks\d6fdb411cb1b47f5b9c1c24f39b6844f.xml; /config; C:\Users\esbbach\AppData\Local\Temp\PostSharp\188379e7d1bb956e.config; /appDomainKey; .NETFramework,Version=v4.6.2
3>  info : Executing PostSharp 5.0.34 [postsharp-net40-x64-srv.exe release | .NET Framework 4.7]
3>  verbose PS0265: Detailed log for the next error:
3>  LOG: Finding reference assembly with binding identity 'system.core, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e' in the Reference context.
3>  LOG:     Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Core.dll', identity='system.core, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089', ProcessorArchitecture=NoPlatform.
3>  LOG:     Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Core.dll' [PublicKeyMismatch].
3>  LOG:     Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Core.dll', identity='system.core, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089', ProcessorArchitecture=NoPlatform.
3>  LOG:     Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Core.dll' [PublicKeyMismatch].
3>  LOG:     Found file 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Core.dll', identity='system.core, version=4.0.0.0, culture=neutral, publickeytoken=b77a5c561934e089', ProcessorArchitecture=NoPlatform.
3>  LOG:     Reference mismatch for 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.2\System.Core.dll' [PublicKeyMismatch].
3>  LOG:     The assembly 'system.core, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7798e, retargetable=yes' was not found.
``
  1. 1 Posted by esben on 22 Sep, 2017 11:32 AM

    esben's Avatar

    And apparently it seems to be related to specific method calls that uses FluentAssertions.
    And I also just confirmed it is the same issue in 5.0.33 so my initial postulate is incorrect.
    Test method that breaks

            [Fact]
            public void ProvideMetadata_Provides_EnvironmentInformation()
            {
                var target = new EnvironmentMetadataProvider();
                var command = new CommandStub(Guid.NewGuid());
                var output = target.ProvideMetadata(command)
                output.Should().NotBeEmpty();
                output.Should().NotContain(t => t.Value == string.Empty).And.NotContain(t => t.Value == null); // This here causes the compile error
            }
    
  2. Support Staff 2 Posted by PostSharp Techn... on 23 Sep, 2017 09:20 AM

    PostSharp Technologies's Avatar

    Hello,

    which kinds of projects are you referencing? There was a change in the binding map algorithm version in 5.0.33 and 5.0.34 (which fixed a bug in 5.0.33), so binding maps on your machine were regenerated. The version and public key token of System.Core is associated with Windows Phone/Xamarin projects (or maybe some profiles of .NET Portable), so maybe you are referencing a project with such reference. It's 'system.core, version=2.0.5.0, culture=neutral, publickeytoken=7cec85d7bea7.

    Note that, we are currently not actively supporting Xamarin/Windows Phone in PostSharp 5.0.

    Best regards,
    Daniel

  3. 3 Posted by esben on 25 Sep, 2017 06:49 AM

    esben's Avatar

    It is a full framework project (.net 4.6.2) and as far as I can tell it only refers packages supporting full framework (though at least fluentassertions also support .net core).

    As mentioned in the updated comments, the issue only occurs when i use the ".NotContain()" extension method from fluentassertions.

    There is NOTHING pointing to xamarin og windows phone in the solution as far as I can tell.

    I have attached a screenshot of reference just in case.

  4. Support Staff 4 Posted by PostSharp Techn... on 28 Sep, 2017 09:40 PM

    PostSharp Technologies's Avatar

    Hello,

    assembly FluentAssertions.Core is a .NET Portable 4.0 library (hence the strange version number) and there is a bug that prevents PostSharp from correctly handling such reference. We will be working on a fix.

    (issue #15532)

    Best regards,
    Daniel

  5. 5 Posted by esben on 29 Sep, 2017 05:21 AM

    esben's Avatar

    Thanks for the update, for now ill work around the issue by not using the code that breaks postsharp :)

  6. Support Staff 6 Posted by PostSharp Techn... on 11 Oct, 2017 08:38 AM

    PostSharp Technologies's Avatar

    Hello,

    the bug #15532 has been fixed in the current release of PostSharp 5.0.35.

    Should you need further help with this issue, don't hesitate to re-open this discussion.
    Best regards,

    -tony

  7. PostSharp Technologies closed this discussion on 11 Oct, 2017 08:38 AM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac