Based on your description, it is related to your code. We know that it will generate this issue when an externally visible generic type contains a static member
here. But it seems that it is not the whole code in your project.
Would you mind sharing this project to us? Please also attach your Visual Studio project, you can upload it to the sky driver, and then share the download link in your post.
We will try to check it.
If there's any concern, please feel free to let me know.