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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to