You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucenenet.apache.org by GitBox <gi...@apache.org> on 2022/10/18 14:09:11 UTC

[GitHub] [lucenenet] NightOwl888 opened a new issue, #699: Newtonsoft.Json dependency conflict causing failures on netstandard2.0 (using net461 runtime).

NightOwl888 opened a new issue, #699:
URL: https://github.com/apache/lucenenet/issues/699

   It turns the version bump in #647 causes problems when testing the `netstandard2.0` via `net461`.
   
   ```console
   Starting test execution, please wait...
   A total of 1 test files matched the specified pattern.
   NUnit Adapter 3.17.0.0: Test execution started
   Running all tests in D:\a\_temp/net461/Lucene.Net.Tests._J-S/Lucene.Net.Tests._J-S.dll
      NUnit3TestExecutor discovered 102 of 102 NUnit test cases
   Setup failed for test fixture Lucene.Net.Codecs.TestDefaultCodecFactory
   An exception was thrown while loading the test.
   Lucene.Net.Util.LuceneSystemException: An exception occurred during initialization:
   System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   File name: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
      at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
      at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
      at System.Lazy`1.CreateValue()
      at System.Lazy`1.LazyInitValue()
      at Lucene.Net.Util.Properties.GetProperty[T](String key, T defaultValue, Func`2 conversionFunction) in /_/src/Lucene.Net/Support/Util/Properties.cs:line 138
      at Lucene.Net.Util.LuceneTestFrameworkInitializer.InitializeStaticState() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs:line 336
      at Lucene.Net.Util.LuceneTestFrameworkInitializer.DoInitialize() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs:line 213
   
   WRN: Assembly binding logging is turned OFF.
   To enable assembly bind failure logging, set the registry value [HKLM\Software\Microsoft\Fusion!EnableLog] (DWORD) to 1.
   Note: There is some performance penalty associated with assembly bind failure logging.
   To turn this feature off, remove the registry value [HKLM\Software\Microsoft\Fusion!EnableLog].
    ---> System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
      at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
      at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
      at System.Lazy`1.CreateValue()
      at System.Lazy`1.LazyInitValue()
      at Lucene.Net.Util.Properties.GetProperty[T](String key, T defaultValue, Func`2 conversionFunction) in /_/src/Lucene.Net/Support/Util/Properties.cs:line 138
      at Lucene.Net.Util.LuceneTestFrameworkInitializer.InitializeStaticState() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs:line 336
      at Lucene.Net.Util.LuceneTestFrameworkInitializer.DoInitialize() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs:line 213
      --- End of inner exception stack trace ---
      at Lucene.Net.Util.LuceneTestFrameworkInitializer.DoInitialize() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs:line 218
      at Lucene.Net.Util.LuceneTestCase.SetUpFixture.<>c__DisplayClass2_0.<EnsureInitialized>b__0() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestCase.SetUpFixture.cs:line 54
      at System.Threading.LazyInitializer.EnsureInitializedCore[T](T& target, Func`1 valueFactory)
      at Lucene.Net.Util.LuceneTestCase.SetUpFixture.EnsureInitialized(Test setUpFixture, Test testFixture) in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestCase.SetUpFixture.cs:line 55
      at Lucene.Net.Util.NUnitTestFixtureBuilder.SetUpRandomizedContext(Test setUpFixture, Test testFixture) in /_/src/Lucene.Net.TestFramework/Support/Util/NUnitTestFixtureBuilder.cs:line 230
      at Lucene.Net.Util.NUnitTestFixtureBuilder.BuildFrom(ITypeInfo typeInfo, IPreFilter filter, ITestFixtureData testFixtureData) in /_/src/Lucene.Net.TestFramework/Support/Util/NUnitTestFixtureBuilder.cs:line 156
      at Lucene.Net.Util.LuceneTestCase.TestFixtureAttribute.<BuildFrom>d__47.MoveNext() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestCase.TestFixtureAttribute.cs:line 244
      at NUnit.Framework.Internal.Builders.DefaultSuiteBuilder.BuildFrom(ITypeInfo typeInfo, IPreFilter filter)
   Setup failed for test fixture Lucene.Net.Codecs.TestDefaultDocValuesFormatFactory
   An exception was thrown while loading the test.
   Lucene.Net.Util.LuceneSystemException: An exception occurred during initialization:
   System.IO.FileLoadException: Could not load file or assembly 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
   File name: 'Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed'
      at Microsoft.Extensions.Configuration.FileConfigurationProvider.Load(Boolean reload)
      at Microsoft.Extensions.Configuration.ConfigurationRoot..ctor(IList`1 providers)
      at Microsoft.Extensions.Configuration.ConfigurationBuilder.Build()
      at System.Lazy`1.CreateValue()
      at System.Lazy`1.LazyInitValue()
      at Lucene.Net.Util.Properties.GetProperty[T](String key, T defaultValue, Func`2 conversionFunction) in /_/src/Lucene.Net/Support/Util/Properties.cs:line 138
      at Lucene.Net.Util.LuceneTestFrameworkInitializer.InitializeStaticState() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs:line 336
      at Lucene.Net.Util.LuceneTestFrameworkInitializer.DoInitialize() in /_/src/Lucene.Net.TestFramework/Support/Util/LuceneTestFrameworkInitializer.cs:line 213
   ```
   
   But this is actually 2 problems, not one.
   
   - [ ] Newtonsoft.Json has version compatibility conflicts after applying #647.
   - [ ] The test runner is not reporting DLL conflicts outside of the logs.
   
   The tests run in GitHub Actions execute one project at a time, so we cannot rely on them to detect dependency version conflicts across all of the assemblies in the solution.
   
   On the other hand, in Azure DevOps, we are publishing the test assemblies to a single directory for the entire solution. This is more like a real-world run where all of the DLLs are dropped into the same bin directory, and will reveal any conflicts that exist in our solution. I don't think it is worth the effort to try to accomplish the same thing in GitHub Actions, which is optimized for speed using as many agents as possible rather than for locating low level stuff like this by publishing the test assemblies to a single directory, which adds extra build time to the run.
   
   Unfortunately, the `--blame-crash` feature on `dotnet test` doesn't function on .NET Framework (which would have reported a failure), so if the runner crashes the only place it shows issues are in the log files that capture the test result output. So, this issue is going to take a little more effort to fix.
   
   The version conflict will probably not be that hard to fix (without rolling back), since it is occurring between `Lucene.Net.Replicator`, `Lucene.Net.TestFramework` and `Microsoft.Extensions.Configuration.Json`. `Microsoft.Extensions.Configuration.Json` has switched to using `System.Text.Json` in more recent versions, so we can most likely upgrade it to fix this problem.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [lucenenet] NightOwl888 commented on issue #699: Newtonsoft.Json dependency conflict causing failures on netstandard2.0 (using net461 runtime).

Posted by GitBox <gi...@apache.org>.
NightOwl888 commented on issue #699:
URL: https://github.com/apache/lucenenet/issues/699#issuecomment-1282896648

   For class libraries, the lower the version of the dependency we support, the lower the chance that users will run into conflicts. Keep in mind, unless it is specified otherwise it is the *minimum version* we target that users can upgrade. We targeted 1.1.2 for `net45` because it was the highest version that is compatible with `net45`. But most consumers were on a higher version of .NET Framework, so they could upgrade beyond that. Now that we have bumped the minimum version to `net462` we have more options.
   
   Looking at the options, 3.1.0 is the lowest version that is both supported and targets `System.Text.Json`, so that would give the widest support for consumers while getting us out of a conflict scenario with `Lucene.Net.Replicator`.
   
   6.0.0 is under consideration. But when we first added the dependency on `Microsoft.Extensions.Configuration.Abstractions`, we targeted the latest at the time (5.x) and had complaints from users that couldn't upgrade to that version due to conflicts with other libraries.
   
   We don't depend directly on `Microsoft.Extensions.Configuration.Json` in Lucene.Net, it is just something the test framework uses to be configurable via JSON files (we use it as a replacement for Java system properties). By injecting configuration, it can be used to do things like turn on assertions in all of Lucene.NET, control options in the test framework or directory locations to search for analyzer dictionaries. Ideally, the test framework should be on 6.0.0 but we should target a lower version of `Microsoft.Extensions.Configuration.Abstractions` in `Lucene.Net` to avoid conflicts for the majority of users. If we target too high of a version, the result will be some people will target an older version of Lucene.NET.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [lucenenet] NightOwl888 closed issue #699: Newtonsoft.Json dependency conflict causing failures on netstandard2.0 (using net461 runtime).

Posted by GitBox <gi...@apache.org>.
NightOwl888 closed issue #699: Newtonsoft.Json dependency conflict causing failures on netstandard2.0 (using net461 runtime).
URL: https://github.com/apache/lucenenet/issues/699


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [lucenenet] nikcio commented on issue #699: Newtonsoft.Json dependency conflict causing failures on netstandard2.0 (using net461 runtime).

Posted by GitBox <gi...@apache.org>.
nikcio commented on issue #699:
URL: https://github.com/apache/lucenenet/issues/699#issuecomment-1282864934

   @NightOwl888 After the removal of the old .Net version in #650 It seems a bit weird that there are 3 different targeting versions of the `Microsoft.Extensions.Configuration` package:
   https://github.com/apache/lucenenet/blob/fef018190729c27faa2e77a15b24c4c1b451e803/.build/dependencies.props#L51-L58
   
   Maybe this should just be updated to `6.0.0`? As far as the supported frameworks all the current frameworks seem to be supported: https://www.nuget.org/packages/Microsoft.Extensions.Configuration/6.0.0#supportedframeworks-body-tab
   
   And also in other packages like `Microsoft.Extensions.Configuration.Json`: https://www.nuget.org/packages/Microsoft.Extensions.Configuration.Json/6.0.0#supportedframeworks-body-tab


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@lucenenet.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org