C
C#2y ago
Ruttie

✅ Missing compiler required member, .NET 4.7.2

For some reason I can't use dynamics in .net 4.7.2, I've reinstalled the framework to no avail. Project: Target frameworks: net7.0;net472 Packages: BenchmarkDotNet (0.13.2) Language version: latest
22 Replies
Thinker
Thinker2y ago
Why are you using dynamic
Ruttie
RuttieOP2y ago
...why not?
Thinker
Thinker2y ago
Because C# is a statically typed language dynamic removes literally all static safety DO NOT USE IT unless you have a very good reason to.
Ruttie
RuttieOP2y ago
regardless, why I'm using it is not important (also, what about reflection?)
Thinker
Thinker2y ago
In any case, ignoring the fact you shouldn't use it, the mechanisms required for dynamic to work are dependent on types in the standard library, types which aren't available in Framework. Reflection has legitimate uses. Also why are you using Framework catsip
Ruttie
RuttieOP2y ago
unity so dynamic is just not usable in .net framewok?
Thinker
Thinker2y ago
Nope huh, thought Unity ran on a higher version than that And if you're creating a game then the performance impacts dynamic has are even less worth it.
Ruttie
RuttieOP2y ago
I mean it isn't that bad
Thinker
Thinker2y ago
For accessing a member, yes it is Accessing a field should be practically instant dynamic has to do a lot of computation and magic behind the scenes.
Angius
Angius2y ago
You know it's a Program() so... why use dynamic at all It's not like C++'s auto That'd be var in C#
Ruttie
RuttieOP2y ago
I know, the code I showed was only for demonstration purposes
ero
ero2y ago
That's wrong, you can use dynamic in framework
Ruttie
RuttieOP2y ago
wha
Thinker
Thinker2y ago
really? welp, sorry then But you still shouldn't use it catsip
ero
ero2y ago
That's 14 times slower. I'd say that's pretty fucking bad
Ruttie
RuttieOP2y ago
if you can, then how?
Angius
Angius2y ago
Maybe Unity specifically disallows it, since they run some weird fork of Mono
ero
ero2y ago
Probably that
Angius
Angius2y ago
If so, rare Unity W
Ruttie
RuttieOP2y ago
in the example code I'm not using unity, I just have a benchmarking project (and I'm on windows)
Angius
Angius2y ago
Well, whatever it is that breaks dynamic we should all, collectively, thank it
Accord
Accord2y ago
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.
Want results from more Discord servers?
Add your server