❔ How to fix "Target runtime doesn't support covariant types in overrides?
I have Builder, let's see code:
So implemented code allows use to do this:
22 Replies
The problem is: I can't do the same in netstandard and I don't understand how to fix this.. I should change return type of methods in
UISchemaGroupBuilder
. For example AddText
should return UISchemaBuilderBase
, not UISchemaGroupBuilder
. But if I follow by these advices, my builder wouldn't work. I can't use EndGroup
after AddBoolean
for example. Can someone help me, please?why do you need to change the type exactly?
I can make some changes for netstandard:
but my builder will not work
I can't use
EndGroup
after AddBoolean
so, okay, explain this to me, how can you even override AddBoolean like that
you're adding a parameter
how is that possible?
ero
REPL Result: Failure
Exception: CompilationErrorException
Compile: 473.613ms | Execution: 0.000ms | React with ❌ to remove this embed.
?
one moment
GitHub
GitHub - INTERNALINTERFERENCE/CovariantTest
Contribute to INTERNALINTERFERENCE/CovariantTest development by creating an account on GitHub.
simple repo
it just seems like you're approaching this kinda incorrectly
idk it works on net6
ahh I found how to fix this
public
new
UISchemaGroupBuilder AddBoolean()an interface with
TSelf
might be better
your abstract class doesn't even have any abstract memberscan you show an example?
on it
such that?
ero
REPL Result: Success
Compile: 660.359ms | Execution: 45.369ms | React with ❌ to remove this embed.
hm interesting!
I like the interface usage
@just_ero May I ask an immodest question? how long have you been programming in C#?
i don't think i can answer that very clearly
cause i don't do it professionally
and i have never really completed a project
That's a mood
so i mean, i guess the first time i coded in c# was like 6 years ago or something (maybe more?)
but it's not like i've just been grinding away at my programming skills every day
i've never even read any books or watched tutorials
incredible
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.