Working with .NET 5

Hello,
I just installed .NET 5 in my computer, with the Visual Studio 16.8 update.

With Microsoft C#, I can target correctly .NET 5, but it seems that the Elements compiler doesn’t work correctly. A good test is to use the Interlocked.Or static method that is introduced with .NET 5.

In a Microsoft C# application, CC shows the Or method and the call compiles.
In an Oxygene application, CC doesn’t see the Or method and there is an error during build.

Microsoft C# test case: ConsoleApp1.zip (12.5 KB)
Oxygene test case: ConsoleApplication1.zip (30.3 KB)

Thanks, logged as bugs://85143

Thanks for the summary!

It seems that Microsoft changed the package format for .N ET Core again, between RC and final :(. because why not. Fixed for Friday’s build. Also, make sure you did a rebuild after installing a new .NET Core verson, to get the latest 5.0.1 package from remote NuGet.

Marc,
Is it possible to have a private build before Friday?
It will also solve the \$ifdef problem and the NRE in CC that annoys me all the day.

Sure thing, yes. Done.

1 Like

I think something is still wrong.
After rebuild of the Oxygene test case, I still have:

Program.pas(19,17): error E43: No static member “Or” on type “Interlocked”

When trying to compile another solution, I have errors like:

error E26: Unknown namespace “System.Collections.Specialized” in uses list
Unknown namespace “System.ComponentModel” in uses list

It is as if Oxygene doesn’t see the .NET classes.
VS doesn’t display the SDK content (is it normal, the [3.0, 5.0.0] at the end?):

The latest SDK is installed on my PC:

What am I missing?

Can I see the full (diagnostic level) rebuild log?

Yes, thats normal, it lets it to get the best version it can find above 3.0, bit no higher than 5.0.0 (5.1 might be incompatible, after all). The lower range is there because iirc theres we some versions (maybe 3.1) where there was no matching base package yet so it had to fall back to 3.0. That can probably be tweaked more, but it should not be the problem here.

As always, its really tough too tell what the actual problem is because you try hard to provide as little information as possible

same I have.

And me?

I can see that you’re on a Mac, perhaps with the .NET 5 SDK installed manually?
I’m under Windows 10, with the .NET 5 SDK installed automatically with the update 16.8 to Visual Studio. It must be installed correctly, because the same MS C# application is working fine.

Even with 5.0, Water uses 3.1.0!
Look at the references.

You really don’t wan’t me to see that log, right?

I must take the time to finish what I’m doing and then reinstall Elements 2570, so it will take a little time to have it…

In this case, what “more information” can I give you?
You have the test case, what appears on my PC.
I told you really what I think is important.

As I’m not the person who writes the compiler and the tools, I don’t know which information you really need to find the problem… I could write a book or even make a clone of my SSD and send it to you so you have all the information you want, but it’ll be a loss of time and resources. All this work to finally have a “Oh I know what’s happening” without the need to all this information…

I’ve asked TWICE now to see then build log. It works here. how am I supposed to figure out why it resolved the wrong package version for you, if you wont let me see the build log?

AFTER the first information I give to you and your remark about “little information”.
I’m currently reinstalling Elements 2570, so I can give this log in a short time.

This is the 387th support request from you where I have to go begging for a full build log!

Here is the log: BuildLog.txt (27.1 KB)

It seems that Elements doesn’t look at the same place as MS C# for the .NET 5.0…
As MS C# finds something and not Elements.

Looking at the MS C# build output, it looks for the referenced assemblies at C:\Program Files\dotnet\packs\Microsoft.NETCore.App.Ref\5.0.0\ref\net5.0.

There is also folders for ASP.NET Core and for version 3.1 in the folder tree.

Indeed it doesn’t.

1>		D:                      Checking <NuGetRepository file:///C:/Users/Patrick/.nuget/packages/>
1>		D:                      Package Microsoft.NETCore.App.Ref found in repository <NuGetRepository file:///C:/Users/Patrick/.nuget/packages/>
1>		D:                      Available Versions of 'Microsoft.NETCore.App.Ref': 3.1.0.
1>		D:                      Package Microsoft.NETCore.App.Ref:3.1.0 found in repository <NuGetRepository file:///C:/Users/Patrick/.nuget/packages/>.


It seems the problem is your local NuGet cache (not the one we maintain but the one .NET Core itself does) at C:\Users\Patrick.nuget\packages only contains 3.1 and not 5.0. Since we treat that as a proper repository, we count look further for newer versions elsewhere.

That’s not ideal, and I’m not sure how to best fix this, but the more pertinent question tis, why doesn’t this have 5.0, if you did build a 5.0 project in VC#. It looks like I need to revise that logic to also look in “the packs” folder, I’ll investigate.

Why oh why does this crao have to change with every .x build, Microsoft?

Marc,
If you look at my last message, I give you the path where MS C# looks for the .NET Core 3.1 / .NET 5.0 reference assemblies. So you must take a look at this folder.

Perhaps you have nuGet entries for 5.0 because you installed manually the .NET 5.0.100 SDK?