Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot open a DLL produced with .NET 10 Alpha using ILSpy 8.2.0.7535 #3349

Closed
carlossanlop opened this issue Dec 13, 2024 · 5 comments
Closed
Labels

Comments

@carlossanlop
Copy link

I created a simple console app that targets .NET 10 alpha (latest available nightly) It compiled without issues. (I shared the csproj and cs code at the end for a repro).

If I try to open the produced assembly, I get an error using this ILSpy version:

ILSpy version 8.2.0.7535
.NET version 6.0.36-servicing.24514.21+f1dd57165bfd91875761329ac3a8b17f6606ad18
        ✅You are using the latest release.

Note that the sidebar is able to show the API tree, but if I try to expand a type, I get this callstack:

Image

If I change the language to IL, it shows a bunch of System.Reflection attributes for the assembly:
Image

But a couple seconds later this dialog showed up:
Image

Project code:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Library</OutputType>
    <TargetFramework>net10.0</TargetFramework>
    <Nullable>enable</Nullable>
  </PropertyGroup>

</Project>
using System;

namespace MyNamespace.MySubNamespace;

[AttributeUsage(AttributeTargets.Class)]
public class MyUnchangedAttribute : Attribute
{
    public MyUnchangedAttribute() { }
}
@carlossanlop
Copy link
Author

My colleague @ericstj found the root cause:

if (versionString.Length == 3)
versionString += ".0";

@siegfriedpammer
Copy link
Member

Sorry for the bug, who would've thought that .NET reaches version 10 😉... this is so embarrassing. Thanks for reporting!

@carlossanlop
Copy link
Author

No worries! We caught it early, fortunately. .NET has grown so fast!

@ericstj
Copy link

ericstj commented Dec 13, 2024

You might consider replacing this parsing with https://learn.microsoft.com/en-us/dotnet/api/system.runtime.versioning.frameworkname?view=net-9.0 or if you keep the parsing, just create a new version if it doesn't have enough parts. That way you don't muck with the string.

@ericstj
Copy link

ericstj commented Dec 13, 2024

Thank you for the quick fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants