Skip to content

Merge main into live #46933

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

Merged
merged 7 commits into from
Jun 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 9 additions & 8 deletions docs/azure/includes/dotnet-all.md

Large diffs are not rendered by default.

17 changes: 9 additions & 8 deletions docs/azure/includes/dotnet-new.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/core/compatibility/10.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ If you're migrating an app to .NET 10, the breaking changes listed here might af
| [MSBUILDCUSTOMBUILDEVENTWARNING escape hatch removed](sdk/10.0/custom-build-event-warning.md) | Behavioral change | Preview 1 |
| [MSBuild custom culture resource handling](sdk/10.0/msbuild-custom-culture.md) | Behavioral change | Preview 1 |
| [NU1510 is raised for direct references pruned by NuGet](sdk/10.0/nu1510-pruned-references.md) | Source incompatible | Preview 1 |
| [PackageReference without a version raises an error](sdk/10.0/nu1015-packagereference-version.md) | Behavioral change | Preview 6 |
| [HTTP warnings promoted to errors in `dotnet package list` and `dotnet package search`](sdk/10.0/http-warnings-to-errors.md) | Behavioral/source incompatible change | Preview 4 |

## Windows Forms
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
title: "Breaking change - PackageReference without a version raises an error"
description: "Learn about the breaking change in .NET 10 where PackageReference without a version raises NU1015 error instead of NU1604 warning."
ms.date: 06/23/2025
ai-usage: ai-assisted
ms.custom: https://github.com/dotnet/docs/issues/46386
---

# PackageReference without a version will raise an error

Starting in .NET 10, NuGet raises a [`NU1015` error](/nuget/reference/errors-and-warnings/nu1015) when a `PackageReference` item doesn't have a version specified, instead of the previous [`NU1604` warning](/nuget/reference/errors-and-warnings/nu1604).

There's no change when using Central Package Management, since by design the PackageReference XML should not have a version in that scenario.

## Version introduced

.NET 10 Preview 6

## Previous behavior

Previously, NuGet raised a NU1604 warning with the following text:

> Project dependency 'PackageA' does not contain an inclusive lower bound. Include a lower bound in the dependency version to ensure consistent restore results.

## New behavior

Starting in .NET 10, NuGet raises a NU1015 error with the following text:

> The following PackageReference item(s) do not have a version specified: PackageA

## Type of breaking change

This is a [behavioral change](../../categories.md#behavioral-change).

## Reason for change

The "no lower bound" message was confusing, and it was unclear how to fix the issue. Additionally, NuGet restored the lowest version for that package, which is rarely what developers want. This change provides clearer and more actionable error messages when the version metadata is missing.

## Recommended action

Add a version to the package reference, for example:

```diff
- <PackageReference Include="Some.Package" />
+ <PackageReference Include="Some.Package" Version="1.2.3" />
```

If the lowest package version is desired, then use `Version="0.0.0"`. In this case, NuGet will raise warning NU1603, rather than the previous NU1604.

To revert to the previous warning, you can set `SdkAnalysisLevel` to `9.0.300` or lower. However, this will affect all features that gate on `SdkAnalysisLevel`.

## Affected APIs

None.
4 changes: 4 additions & 0 deletions docs/core/compatibility/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@ items:
href: sdk/10.0/msbuild-custom-culture.md
- name: NU1510 is raised for direct references pruned by NuGet
href: sdk/10.0/nu1510-pruned-references.md
- name: PackageReference without a version raises error
href: sdk/10.0/nu1015-packagereference-version.md
- name: HTTP warnings promoted to errors in package list and search
href: sdk/10.0/http-warnings-to-errors.md
- name: Windows Forms
Expand Down Expand Up @@ -1984,6 +1986,8 @@ items:
href: sdk/10.0/msbuild-custom-culture.md
- name: NU1510 is raised for direct references pruned by NuGet
href: sdk/10.0/nu1510-pruned-references.md
- name: PackageReference without a version raises error
href: sdk/10.0/nu1015-packagereference-version.md
- name: HTTP warnings promoted to errors in package list and search
href: sdk/10.0/http-warnings-to-errors.md
- name: .NET 9
Expand Down
31 changes: 31 additions & 0 deletions docs/core/extensions/file-globbing.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,37 @@ The preceding C# code:

The additional `Match` overloads work in similar ways.

### Ordered evaluation of include/exclude

By default, the matcher evaluates **all** include patterns first, then applies **all** exclude patterns, regardless of the order in which you added them. This means you can't re-include files that were previously excluded.

Starting in version 10 of the [📦 Microsoft.Extensions.FileSystemGlobbing package](https://www.nuget.org/packages/Microsoft.Extensions.FileSystemGlobbing), you can opt into *ordered* evaluation, where includes and excludes are processed exactly in the sequence they were added:

```csharp
using Microsoft.Extensions.FileSystemGlobbing;

// Preserve the order of patterns when matching.
Matcher matcher = new(preserveFilterOrder: true);

matcher.AddInclude("**/*"); // include everything
matcher.AddExclude("logs/**/*"); // exclude logs
matcher.AddInclude("logs/important/**/*"); // re-include important logs

var result = matcher.Execute(new DirectoryInfoWrapper(new DirectoryInfo(root)));
foreach (var file in result.Files)
{
Console.WriteLine(file.Path);
}
```

In this mode, patterns are applied one after another:

- `**/*` adds all files.
- `logs/**/*` filters out anything in `logs/`.
- `logs/important/**/*` adds back only files under `logs/important/`.

Existing code that uses the default constructor will continue to run with the original "all includes, then all excludes" behavior.

## Pattern formats

The patterns that are specified in the `AddExclude` and `AddInclude` methods can use the following formats to match multiple files or directories.
Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/asynchronous-programming/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ You can start by updating the code so the thread doesn't block while tasks are r

:::code language="csharp" source="snippets/index/AsyncBreakfast-V2/Program.cs" ID="SnippetMain":::

The code updates the original method bodies of `FryEggs`, `FryBacon`, and `ToastBread` to return `Task<Egg>`, `Task<Bacon>`, and `Task<Toast>` objects, respectively. The updated method names include the "Async" suffix: `FryEggsAsync`, `FryBaconAsync`, and `ToastBreadAsync`. The `Main` method returns the `Task` object, although it doesn't have a `return` expression, which is by design. For more information, see [Evaluation of a void-returning async function](/dotnet/csharp/language-reference/language-specification/classes#14153-evaluation-of-a-void-returning-async-function).
The code updates the original method bodies of `FryEggs`, `FryBacon`, and `ToastBread` to return `Task<Egg>`, `Task<Bacon>`, and `Task<Toast>` objects, respectively. The updated method names include the "Async" suffix: `FryEggsAsync`, `FryBaconAsync`, and `ToastBreadAsync`. The `Main` method returns the `Task` object, although it doesn't have a `return` expression, which is by design. For more information, see [Evaluation of a void-returning async function](/dotnet/csharp/language-reference/language-specification/classes#15144-evaluation-of-a-void-returning-async-function).

> [!NOTE]
> The updated code doesn't yet take advantage of key features of asynchronous programming, which can result in shorter completion times. The code processes the tasks in roughly the same amount of time as the initial synchronous version. For the full method implementations, see the [final version of the code](#review-final-code) later in this article.
Expand Down
52 changes: 28 additions & 24 deletions docs/csharp/misc/cs0060.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,40 @@
description: "Compiler Error CS0060"
title: "Compiler Error CS0060"
ms.date: 07/20/2015
f1_keywords:
f1_keywords:
- "CS0060"
helpviewer_keywords:
helpviewer_keywords:
- "CS0060"
ms.assetid: ae6d4fb7-5ff9-4883-82c3-f55b190f439a
---
# Compiler Error CS0060

Inconsistent accessibility: base class 'class1' is less accessible than class 'class2'

Class accessibility should be consistent between the base class and inherited class.

The following sample generates CS0060:

```csharp
// CS0060.cs
class MyClass
// try the following line instead
// public class MyClass
{
}

public class MyClass2 : MyClass // CS0060
{
public static void Main()
{
}
}
```

Inconsistent accessibility: base class 'Class1' is less accessible than class 'Class2'

In C#, a derived class cannot have broader accessibility than its base class. If the base class is less accessible, consumers of the derived class might unintentionally gain access to a class they shouldn't see.

Subclasses can never be more accessible than their base classes. That would allow consumers of the subclass broader access to the base type than was intended.

The following sample produces CS0060 because `Class1` is `internal` and `Class2` is `public`.

```csharp
internal class Class1
{
}

public class Class2 : Class1 // 🛑 CS0060: Class1 is less accessible
{
}
```

You can resolve CS0060 in one of two ways:

- Make the base class more accessible: Change `Class1` to be `public`.
- Restrict the derived class's accessibility: Change `Class2` to be `internal`.

> [!TIP]
> Base classes can be _more_ accessible than their subclasses, but never _less_ accessible.

## See also

- [Access Modifiers](../programming-guide/classes-and-structs/access-modifiers.md)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9</TargetFrameworks>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,19 @@ public string Format(string format, object arg,
fmtString = "N" + precision.ToString();
}
if (format.Substring(0, 1).Equals("I", StringComparison.OrdinalIgnoreCase))
return c1.Real.ToString(fmtString) + " + " + c1.Imaginary.ToString(fmtString) + "i";
{
// Determine the sign to display.
char sign = c1.Imaginary < 0 ? '-' : '+';
// Display the determined sign and the absolute value of the imaginary part.
return c1.Real.ToString(fmtString) + " " + sign + " " + Math.Abs(c1.Imaginary).ToString(fmtString) + "i";
}
else if (format.Substring(0, 1).Equals("J", StringComparison.OrdinalIgnoreCase))
return c1.Real.ToString(fmtString) + " + " + c1.Imaginary.ToString(fmtString) + "j";
{
// Determine the sign to display.
char sign = c1.Imaginary < 0 ? '-' : '+';
// Display the determined sign and the absolute value of the imaginary part.
return c1.Real.ToString(fmtString) + " " + sign + " " + Math.Abs(c1.Imaginary).ToString(fmtString) + "j";
}
else
return c1.ToString(format, provider);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net9</TargetFrameworks>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,13 @@ Public Class ComplexFormatter
End Try
fmtString = "N" + precision.ToString()
End If
' Determine the sign to display.
Dim sign As Char = If(c1.Imaginary < 0.0, "-"c, "+"c)
' Display the determined sign and the absolute value of the imaginary part.
If fmt.Substring(0, 1).Equals("I", StringComparison.OrdinalIgnoreCase) Then
Return c1.Real.ToString(fmtString) + " + " + c1.Imaginary.ToString(fmtString) + "i"
Return c1.Real.ToString(fmtString) + " " + sign + " " + Math.Abs(c1.Imaginary).ToString(fmtString) + "i"
ElseIf fmt.Substring(0, 1).Equals("J", StringComparison.OrdinalIgnoreCase) Then
Return c1.Real.ToString(fmtString) + " + " + c1.Imaginary.ToString(fmtString) + "j"
Return c1.Real.ToString(fmtString) + " " + sign + " " + Math.Abs(c1.Imaginary).ToString(fmtString) + "j"
Else
Return c1.ToString(fmt, provider)
End If
Expand Down
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy