3

I have a .NET Framework 4.7.2 website running with a .NET Standard 2.0 Class Library DLL. I thought I understood ValueTuple and .NET Standard 2.0. Apparently I don't. Here's a ValueTuple defined in a .NET Standard 2.0 DLL.

    public static IEnumerable<(string state, int program)> StateManufacturers
    {
        get
        {
            //blah blah, read a database and return some StateManufacturers
            return _StateManufacturers;
        }
    }

Here's what happens when it gets called from another file located in a 4.7.2 DLL...

var validStateManufacturers = ABC.Globals.StateManufacturers;

Compiler Error Message: BC30643: Property 'StateManufacturers' is of an unsupported type.

If I take that EXACT same code and move it to a .NET Framework 4.7.2 Class Library DLL, it works fine. According to this link it should work fine in .NET Standard 2.0. What am I missing? MSFT is encouraging us to move to .NET Standard 2.0+, and yet stuff like this keeps happening...

Robert4Real
  • 1,332
  • 5
  • 21
  • 39
  • I'm a bit puzzled. You're showing C# code and a [VB error](https://learn.microsoft.com/en-us/dotnet/visual-basic/misc/bc30643). Can you provide a [Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example)? – Paulo Morgado Jan 23 '20 at 11:39
  • The original code was in VB. I translated a one-liner to C# to remain consistent with prior code. In any case, here's the original...Dim validStateManufacturers = ABC.Globals.StateManufacturers. The puzzle remains.... – Robert4Real Jan 24 '20 at 04:00
  • To add some more context, I've built this with Microsoft.Net.Compilers (rosyln) 2.8.0. I'm assuming that it understands ValueTuple, as I have other code outside of .NET Standard 2.0 that uses ValueTuple. – Robert4Real Jan 24 '20 at 04:09
  • Still need a repro. – Paulo Morgado Jan 24 '20 at 09:30
  • I have a hint: when I `nuget restore` and System.ValueTuple is downloaded, the package cache directory `System.ValueTuple.4.5.0\lib\netstandard2.0` contains an empty file called `_._`, while the other .NET directories in `\lib` contain an actual `System.ValueTuple.dll`. Perhaps the dotnet team shipped a broken build config. – Phil Feb 22 '23 at 23:03

0 Answers0