0

after updating from:

<package id="Google.Api.Gax" version="4.10.0" />
<package id="Google.Api.Gax.Grpc" version="4.10.0" />
<package id="Google.Api.CommonProtos" version="2.16.0" />

...to:

<package id="Google.Api.Gax" version="4.11.0" />
<package id="Google.Api.Gax.Grpc" version="4.11.0" />
<package id="Google.Api.CommonProtos" version="2.17.0" />

in a .NET Framework 4.8 project that also uses Scriban 6.2.1 (which references older versions of System.ValueTuple), I encountered this error at runtime:

System.TypeInitializationException The type initializer for 'Scriban.Functions.BuiltinFunctions' threw an exception.

System.TypeInitializationException: The type initializer for 'Scriban.Functions.BuiltinFunctions' threw an exception. ---> System.TypeInitializationException: The type initializer for 'Scriban.Functions.DateTimeFunctions' threw an exception. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ValueTuple, Version=4.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
   at Scriban.Functions.DateTimeFunctions..cctor()
   --- End of inner exception stack trace ---
   at Scriban.Functions.BuiltinFunctions.DefaultBuiltins..ctor()
   at Scriban.Functions.BuiltinFunctions..cctor()
   --- End of inner exception stack trace ---
   at Scriban.Functions.BuiltinFunctions..ctor()
   at Scriban.TemplateContext..ctor(ScriptObject builtin, IEqualityComparer1 keyComparer)
   at 

Environment details

  • OS: Windows 10 64 / Windows server
  • .NET version: .NET Framework 4.8
  • Package name and version:
  • Visual Studio 2022, packages.config-based project

Steps to reproduce

  1. add Scriban 6.2.1
  2. add
  3. run scriban code

Expected behavior:

That newer versions would not introduce assembly conflicts in .NET Framework environments, or that appropriate binding redirects would be added during NuGet installation.

Github issue: https://github.com/googleapis/google-cloud-dotnet/issues/14826

2
  • I can't reproduce the problem in a simple console.app dotnet 4.8 with scriban 6.2.1 with: Google.Api.Gax -Version 4.11.0, Google.Api.Gax.Grpc -Version 4.11.0 and Google.Api.CommonProtos -Version 2.17.0 I had this entry in my web.config, which I have commented out. I'll do some more testing <dependentAssembly> <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" /> </dependentAssembly> Commented Jun 1 at 17:58
  • System.ValueTuple is one of a handful of libraries that are particularly brittle re assembling binding; adding a redirect manually usually fixes it, but the tooling usually cannot automate it - see nickcraver.com/blog/2020/02/11/binding-redirects for a much longer discussion. The good news is: this problem has been fixed. The bad news is: the fix is modern .NET, i.e. "not .NET Framework" (.NET 9 at the time of writing, but: whatever is vCurrent) Commented Jun 1 at 21:55

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.