Azure-Samples / Azure-Samples/azure-search-dotnet-samples

quickstart-keyword-search: CS0433/CS0121 build errors + first-run crash with current package versions

Open
#191 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
155
Forks
426
Avg merge
6d 10h
Merged PRs (30d)
2

Description

**Sample:** quickstart-keyword-search (AzureSearchQuickstart)

**Environment:**
- .NET SDK: 9 (fails on SDK 10, despite docs stating .NET 8+ works)
- Azure.Identity 1.19.0
- Azure.Core 1.54.0
- Azure.Search.Documents 12.0.0

This tutorial's sample code has issues with current package versions (Azure.Identity 1.19.0+, Azure.Core 1.53.0+, Azure.Search.Documents 12.0.0) and the target framework listed:

0. Tutorial states .NET 8 or later is required, but the project fails to run on SDK 10 — had to install SDK 9 specifically to get it working. Recommend clarifying the actual supported SDK range.

1. CS0433 (DefaultAzureCredential ambiguous): Azure.Core 1.53.0+ consolidated identity types (DefaultAzureCredential, etc.) into itself. Having both Azure.Identity and Azure.Core as direct PackageReferences now causes a duplicate-type compile error. Fix: remove the Azure.Identity PackageReference — DefaultAzureCredential is available directly from Azure.Core.

2. CS0121 (DeleteIndex ambiguous call): SearchIndexClient.DeleteIndex now has two overloads with optional trailing params, so a bare DeleteIndex(indexName) call doesn't resolve. Fix: use a named argument, e.g. DeleteIndex(indexName, cancellationToken: default).

3. DeleteIndexIfExists throws on first run: the sample calls GetIndexNames() but never checks its result before calling DeleteIndex, so it throws a 404 RequestFailedException when the index doesn't exist yet (e.g. first run). Fix:

private static void DeleteIndexIfExists(string indexName, SearchIndexClient adminClient)
{
try
{
adminClient.DeleteIndex(indexName, cancellationToken: default);
}
catch (RequestFailedException ex) when (ex.Status == 404)
{
// index doesn't exist — nothing to delete
}
}

Recommend updating the .csproj snippet, Program.cs sample, and stated SDK requirements to reflect these.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the quickstart-keyword-search (AzureSearchQuickstart) project, its .csproj package references, and Program.cs. Build and run it with the listed current package versions and the documented SDKs to reproduce the compiler errors and first-run 404. Done means the package and SDK guidance is accurate, the sample builds without ambiguous calls, and a first run does not fail when the index is absent.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, csharp
Domain
backend, cloud
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
76/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.