Open rigtigeEmil opened 5 hours ago
I'm seeing this error everywhere that I'm using arguments like this.
Is this for any type? Including strings, ints, etc. or is it just enums?
Ah, sorry, you're completely right - it's only for enums 👍
Weird - I'm struggling to recreate it. Is that enum defined in your project or an external library? If the latter, what's the library?
Odd, let me see if I can repro it. It's my own enum, but it's defined in a project outside of the test project.
I get the issue in this repro. I didn't get it initially, but after building, I'm seeing the error. At first I thought it was related to .NET 9, but the error is the same on .NET 8. https://github.com/thomhurst/TUnit/pull/1141
Fine for me (after rebasing your PR as was on an old code version)
You say you upgraded to 0.2.176
and rebuilt - Can you try restarting your IDE? I think it might be caching an old analyzer version
I don't think it's related to the TUnit
version, I originally saw this issue on an older version a few days ago. The issue is just still there even after upgrading to 0.2.176
. Could this be related to .NET 9? I installed the preview version of it recently.
My PR also shows this fat errorlog when I build it:
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(18,48): Error CS7036 : There is no argument given that corresponds to the required parameter 'sessionId' of 'ResettableLazy<EnumTest>.ResettableLazy(Func<EnumTest>, string)'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(23,4): Error CS0103 : The name 'TestRegistrar' does not exist in the current context
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(29,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestClassArguments'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(30,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestClassProperties'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(31,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestMethodArguments'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(31,40): Error CS0246 : The type or namespace name 'TestData' could not be found (are you missing a using directive or an assembly reference?)
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(40,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'TestExecutor'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(41,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'ClassConstructor'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(42,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'ParallelLimit'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(43,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'DisplayName'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(23,62): Error CS9035 : Required member 'TestMetadata.DataAttributes' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(23,62): Error CS9035 : Required member 'TestMetadata.ObjectBag' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(51,4): Error CS0103 : The name 'TestRegistrar' does not exist in the current context
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(55,5): Error CS0117 : 'FailedInitializationTest' does not contain a definition for 'DisplayName'
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.TestClass' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.ParameterTypeFullNames' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.ReturnType' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(18,48): Error CS7036 : There is no argument given that corresponds to the required parameter 'sessionId' of 'ResettableLazy<EnumTest>.ResettableLazy(Func<EnumTest>, string)'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(23,4): Error CS0103 : The name 'TestRegistrar' does not exist in the current context
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(29,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestClassArguments'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(30,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestClassProperties'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(31,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestMethodArguments'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(31,40): Error CS0246 : The type or namespace name 'TestData' could not be found (are you missing a using directive or an assembly reference?)
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(40,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'TestExecutor'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(41,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'ClassConstructor'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(42,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'ParallelLimit'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(43,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'DisplayName'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(23,62): Error CS9035 : Required member 'TestMetadata.DataAttributes' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(23,62): Error CS9035 : Required member 'TestMetadata.ObjectBag' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(51,4): Error CS0103 : The name 'TestRegistrar' does not exist in the current context
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(55,5): Error CS0117 : 'FailedInitializationTest' does not contain a definition for 'DisplayName'
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.TestClass' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.ParameterTypeFullNames' must be set in the object initializer or attribute constructor.
2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.ReturnType' must be set in the object initializer or attribute constructor.
2>------- Finished building project: EnumTest. Succeeded: False. Errors: 34. Warnings: 0
I don't think it's related to the
TUnit
version, I originally saw this issue on an older version a few days ago. The issue is just still there even after upgrading to0.2.176
. Could this be related to .NET 9? I installed the preview version of it recently. My PR also shows this fat errorlog when I build it:2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(18,48): Error CS7036 : There is no argument given that corresponds to the required parameter 'sessionId' of 'ResettableLazy<EnumTest>.ResettableLazy(Func<EnumTest>, string)' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(23,4): Error CS0103 : The name 'TestRegistrar' does not exist in the current context 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(29,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestClassArguments' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(30,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestClassProperties' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(31,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestMethodArguments' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(31,40): Error CS0246 : The type or namespace name 'TestData' could not be found (are you missing a using directive or an assembly reference?) 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(40,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'TestExecutor' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(41,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'ClassConstructor' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(42,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'ParallelLimit' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(43,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'DisplayName' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(23,62): Error CS9035 : Required member 'TestMetadata.DataAttributes' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(23,62): Error CS9035 : Required member 'TestMetadata.ObjectBag' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(51,4): Error CS0103 : The name 'TestRegistrar' does not exist in the current context 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(55,5): Error CS0117 : 'FailedInitializationTest' does not contain a definition for 'DisplayName' 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.TestClass' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.ParameterTypeFullNames' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__bf7f34dcbb72488bae9b9bd4c45cff65.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.ReturnType' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(18,48): Error CS7036 : There is no argument given that corresponds to the required parameter 'sessionId' of 'ResettableLazy<EnumTest>.ResettableLazy(Func<EnumTest>, string)' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(23,4): Error CS0103 : The name 'TestRegistrar' does not exist in the current context 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(29,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestClassArguments' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(30,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestClassProperties' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(31,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'InternalTestMethodArguments' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(31,40): Error CS0246 : The type or namespace name 'TestData' could not be found (are you missing a using directive or an assembly reference?) 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(40,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'TestExecutor' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(41,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'ClassConstructor' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(42,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'ParallelLimit' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(43,5): Error CS0117 : 'TestMetadata<EnumTest>' does not contain a definition for 'DisplayName' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(23,62): Error CS9035 : Required member 'TestMetadata.DataAttributes' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(23,62): Error CS9035 : Required member 'TestMetadata.ObjectBag' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(51,4): Error CS0103 : The name 'TestRegistrar' does not exist in the current context 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(55,5): Error CS0117 : 'FailedInitializationTest' does not contain a definition for 'DisplayName' 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.TestClass' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.ParameterTypeFullNames' must be set in the object initializer or attribute constructor. 2>EnumTest__MyEnumTest__75937fd376c649a292fc38fdf94aac15.Generated.cs(51,95): Error CS9035 : Required member 'FailedInitializationTest.ReturnType' must be set in the object initializer or attribute constructor. 2>------- Finished building project: EnumTest. Succeeded: False. Errors: 34. Warnings: 0
Yeah that error is because your repo wasn't up to date with main and using out of date code generators.
Ah, I see. Missed your rebase comment earlier. Hmm .. It's just a minor annoyance since everything works as expected, just shows a red squiggly line 🤷
Did you try restarting rider?
Yeah, a few times. Sometimes it doesn't show and then shows up at random after a few test runs, sometimes it's there immediately. I've been seeing this for a few days, so I've even had full PC restarts (in case that would have any impact?)
What TUnit packages are you referencing? Just "TUnit"?
Yup. This is the complete package list in the test project:
<ItemGroup>
<PackageReference Include="FluentAssertions" Version="7.0.0-alpha.4" />
<PackageReference Include="Microsoft.Extensions.Identity.Core" Version="9.0.0-rc.2.24474.3" />
<PackageReference Include="NSubstitute" Version="5.3.0" />
<PackageReference Include="TUnit" Version="0.2.176" />
</ItemGroup>
Can you make sure you're on 0.2.176
and then try File > Invalidate Caches > Invalidate and restart in Rider.
Still happening. Could it be related to .NET 9?
@rigtigeEmil .NET 9 shouldn't affect it.
I've just pushed a new version - Can you try v0.2.181 ?
Seems to have disappeared, but like before it seems to come and go a bit. Thanks for the attempt, I'll let you know if it reappears
Hoping that's just the old version being cached or something
I have a test that uses
Arguments
. It works great! Except it shows an error in the IDE (Rider).TUnit0002: No data provided for test
. I've tried rebuilding and upgrading to the latest package version0.2.176
, but the issue remains. I'm seeing this error everywhere that I'm using arguments like this.