Skip to content

fix: Replace generic QueryStringMapParameter attribute with Type argument#118

Merged
HofmeisterAn merged 1 commit into
mainfrom
bugfix/non-generic-querystring-map-attribute
Jun 27, 2026
Merged

fix: Replace generic QueryStringMapParameter attribute with Type argument#118
HofmeisterAn merged 1 commit into
mainfrom
bugfix/non-generic-querystring-map-attribute

Conversation

@HofmeisterAn

Copy link
Copy Markdown
Collaborator

Generic attributes are a .NET 7+ runtime feature. On net48 and other pre net7.0 runtimes, reflecting over QueryStringMapParameter<T> throws System.NotSupportedException ("Generic types are not valid.") when the query string is built, breaking ListImagesAsync and every other call that uses filter/map parameters.

Make the attribute non-generic by passing the mapped type via typeof instead of a type parameter:

[QueryStringMapParameter<IDictionary<...>>("filters", false)]
[QueryStringMapParameter(typeof(IDictionary<...>), "filters", false)]

/cc @Rob-Hague @campersau

@HofmeisterAn HofmeisterAn added the bug Something isn't working label Jun 27, 2026
@HofmeisterAn HofmeisterAn marked this pull request as ready for review June 27, 2026 08:23
@campersau

Copy link
Copy Markdown

It is sad that netstandard2.0 allows this...
Could we add windows .net framework to CI? At least to see if the build works?

@Rob-Hague

Copy link
Copy Markdown

It fixes the hello world repro, thanks!

(I couldn't get a definitive run in my original environment - struggles with patching in the fix - but LGTM anyway)

@Rob-Hague

Copy link
Copy Markdown

(I couldn't get a definitive run in my original environment - struggles with patching in the fix - but LGTM anyway)

I walked away for a while and came back to a clean run having taken about 10 minutes to initialise, vs about 1 min in testcontainers 4.11. It seems to be spending a significant amount of time in SharpZipLib writing a tar, but anyway, that's a problem for another day, and this fix works. Thanks 👍

@HofmeisterAn

Copy link
Copy Markdown
Collaborator Author

It is sad that netstandard2.0 allows this...

Yes, unfortunately, there are no compile checks.

We could probably use the windows-2025 runner, but we have a couple of issues with it in TC (Docker daemon not very reliable). I'm not sure how many changes we'd need to make to the pipeline just to cover this case.

@HofmeisterAn

Copy link
Copy Markdown
Collaborator Author

It seems to be spending a significant amount of time in SharpZipLib writing a tar

I doubt it's related to this change. Your image build is probably quite large, or you're copying a lot of files into the image, which TC needs to package into a tarball first.

@HofmeisterAn HofmeisterAn merged commit 734c9bb into main Jun 27, 2026
29 of 30 checks passed
@HofmeisterAn HofmeisterAn deleted the bugfix/non-generic-querystring-map-attribute branch June 27, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants