runtime icon indicating copy to clipboard operation
runtime copied to clipboard

AD lookup of GetGroup will return exception after migration to .net 9

Open tornie2 opened this issue 2 years ago • 3 comments

Description

We are using AD on premises as identity system on Windows machines After migrating to .net 9 we see exceptions in lookup of roles in AD

Invalid URI: The hostname could not be parsed.'

Reproduction Steps

These 4 lines will recreate the problem

using var domain = new PrincipalContext(ContextType.Domain); using var user = UserPrincipal.FindByIdentity(domain, Environment.UserName); var groups = user?.GetGroups(); Console.WriteLine(string.Join($"{Environment.NewLine}", groups));

This will fail when referencing this version of AD libs

<ItemGroup>
	<PackageReference Include="System.DirectoryServices.AccountManagement" Version="9.0.0" />
</ItemGroup>

When referencing .net 8 it works fine

<ItemGroup>
	<PackageReference Include="System.DirectoryServices.AccountManagement" Version="8.0.0" />
</ItemGroup>

Expected behavior

Return of roles for user

Actual behavior

Exception Invalid URI: The hostname could not be parsed.'

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

No response

tornie2 avatar Nov 18 '24 08:11 tornie2

Tagging subscribers to this area: @dotnet/area-system-directoryservices, @jay98014 See info in area-owners.md if you want to be subscribed.

dotnet-policy-service avatar Nov 18 '24 08:11 dotnet-policy-service

Getting the same exception here.

Work around explained here: https://github.com/dotnet/runtime/issues/109858

CyLuGh avatar Nov 18 '24 15:11 CyLuGh

Duplicate of https://github.com/dotnet/runtime/issues/109858

ericstj avatar Nov 18 '24 16:11 ericstj