SimpleIdServer
SimpleIdServer copied to clipboard
SCIM internal server error - System.NullReferenceException: Object reference not set to an instance of an object.
Looks like there is a bug where when you try to get a group that doesn't exist and add filters you will get this
System.NullReferenceException: Object reference not set to an instance of an object.
at SimpleIdServer.Scim.Persistence.EF.Extensions.EFSCIMExpressionLinqExtensions.BuildResult(IQueryable`1 representations, SCIMDbContext dbContext, IEnumerable`1 includedAttributes, IEnumerable`1 excludedAttributes, String id, String resourceType) in /Users/me/Scim/SimpleIdServer.Scim.Persistence.EF/Extensions/EFSCIMExpressionLinqExtensions.cs:line 40
at SimpleIdServer.Scim.Persistence.EF.EFSCIMRepresentationQueryRepository.FindSCIMRepresentationById(String representationId, String resourceType, GetSCIMResourceParameter parameter) in /Users/me/Scim/SimpleIdServer.Scim.Persistence.EF/EFSCIMRepresentationQueryRepository.cs:line 35
at SimpleIdServer.Scim.Queries.GetRepresentationQueryHandler.Handle(String id, GetSCIMResourceRequest parameter, String resourceType) in /Users/me/Scim/SimpleIdServer.Scim/Queries/GetRepresentationQueryHandler.cs:line 42
at SimpleIdServer.Scim.Api.BaseApiController.InternalGet(String id, GetSCIMResourceRequest parameter) in /Users/me/Scim/SimpleIdServer.Scim/Api/BaseApiController.cs:line 410
example request: http://localhost:8000/Groups/d66c9547-7a3b-44a5-8ce8-417616ee8d03?excludedAttributes=members
I managed to fix it by adding if (result is null) return null; in
if (filteredAttrs != null) {
filteredAttrs = filteredAttrs.Where(a => a.RepresentationId == id);
var result = await representations.FirstOrDefaultAsync(r => r.Id == id && r.ResourceType == resourceType);
if (result is null) return null;
var includedFullPathLst = (includedAttributes != null && includedAttributes.Any()) ? includedAttributes.Where(i => i is SCIMComplexAttributeExpression).Select(i => i.GetFullPath()) : new List<string>();
result.FlatAttributes = filteredAttrs.ToList();
return result;
}
this code is in SimpleIdServer.Scim.Persistence.EF\Extensions\EFSCIMExpressionLinqExtensions.cs:36
Hello,
Thank you for your feedback. :) The issue has been resolved in the master branch.
KR,
SID
Should this issue be closed then?