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

Fix Castle.Core dependency version #282

Merged
merged 1 commit into from
Aug 20, 2016
Merged

Conversation

jeremymeng
Copy link
Contributor

The net45 project still depends on 3.3.3

The net45 project still depends on 3.3.3
@kzu kzu merged commit 080c0fc into devlooped:netcore Aug 20, 2016
@nil4
Copy link

nil4 commented Oct 21, 2016

@jeremymeng Moq 4.6.38-alpha has a dependency on Castle.Core v3.3.3 for .NETFramework4.5 but v4.0.0-beta001 on .NETStandard1.3. In a project with dual framework support, when running tests under .NETCoreApp1.0, everything works fine, but under .NETFramework, this error is thrown:

The type initializer for 'Moq.Mock`1' threw an exception.
The type initializer for 'Moq.Proxy.CastleProxyFactory' threw an exception.
Could not load file or assembly 'Castle.Core, Version=0.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
Could not load file or assembly 'Castle.Core, Version=3.3.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   at Moq.Mock`1.<InitializeInstance>b__24_0()
   at Moq.PexProtector.Invoke(Action action)
   at Moq.Mock`1.InitializeInstance()
   at Moq.Mock`1.OnGetObject()
   at Moq.Mock.GetObject()
   at Moq.Mock.get_Object()
   at Moq.Mock`1.get_Object()

In contrast, Moq 4.6.36-alpha uses v4.0.0-beta001 under both frameworks and tests run as expected. Related to castleproject/Core#214 (comment)

@jeremymeng
Copy link
Contributor Author

@nil4 This surprised me. Depending on Castle.Core v3.3.3 for .NETFramework4.5 is the same as before I added the .NET Standard support. I double-checked. The v4.5 project builds against Castle.Core v3.3.3 and the .nuspec has the right binary. So I wonder where the problem comes from.

Do you happen to have a small project that demonstrates this issue?

@nil4
Copy link

nil4 commented Oct 25, 2016

Afraid I don't have a minimal repro that I can share. I plan to upgrade to .NET Core 1.1 preview1 later this week and will give it another go; if it still happens, I'll try to trim my project down.

@nil4
Copy link

nil4 commented Oct 27, 2016

I upgraded to .NET Core 1.1 and the error is still present. Unfortunately my attempts to reduce the code to a simple repro failed (it works fine when reduced). Since Castle.Core 4.0.0-beta002 became available in the mean time, I added it to my test project.json, thus forcing Moq to use this version. This fixes the issue and the tests run as expected.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants