Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

System.MissingMethodException after update to .NET 8 RC 2 #1239

Closed
msynk opened this issue Oct 13, 2023 · 17 comments
Closed

System.MissingMethodException after update to .NET 8 RC 2 #1239

msynk opened this issue Oct 13, 2023 · 17 comments

Comments

@msynk
Copy link
Contributor

msynk commented Oct 13, 2023

after updating to .NET 8 RC 2 our tests fail with the following exception:

System.MissingMethodException: 
Method not found: 'System.String Microsoft.AspNetCore.Components.CascadingParameterAttributeBase.get_Name()'.

Stack trace:

ComponentParameterCollectionBuilder`1.GetParameterInfo[TValue](Expression`1 parameterSelector)
ComponentParameterCollectionBuilder`1.Add[TValue](Expression`1 parameterSelector, TValue value) line 51
@msynk
Copy link
Contributor Author

msynk commented Oct 14, 2023

I think the issue is coming from this line:

var cascadingParamAttr = propertyInfo?.GetCustomAttribute<CascadingParameterAttribute>(inherit: true);

and the fact that the CascadingParameterAttribute now has a base class named CascadingParameterAttributeBase in .NET 8 RC 2

@egil
Copy link
Member

egil commented Oct 14, 2023

Hmm interesting. Wonder why our own tests haven't caught this. Can you provide an example of a test that causes this. Should be a pretty easy fix though, so we should be able to get a fix out soon.

@linkdotnet
Copy link
Collaborator

Even with the new introduction of the new base class, that shouldn't much interfere with the usage.

As @egil mentioned, it would be really helpful to have a minimal reproducible example for us.
We have many tests in combination with cascading parameters and not of them experienced such an exception.

@msynk
Copy link
Contributor Author

msynk commented Oct 14, 2023

here is the sample repo: https://github.com/msynk/bUnitNet8RC2

It seems this exception throws only for the components with parameters.

@linkdotnet
Copy link
Collaborator

Interesting - the same test passes when moved inside our test suite.

@msynk
Copy link
Contributor Author

msynk commented Oct 14, 2023

@linkdotnet really interesting.
I've run the tests in both stable and preview versions of bUnit (1.23.9, 1.24.3-preview) with the same results.

@linkdotnet
Copy link
Collaborator

Sorry - I meant I moved the test inside the bUnit code and let it run there. No issue at all. Even if I check out 1.23.9 and let the test run.

@egil
Copy link
Member

egil commented Oct 14, 2023

Is it a mstest thing?

@linkdotnet
Copy link
Collaborator

Thought so too and "migrated" the given example to xUnit with the same outcome - still failing tests with the given exception.

@linkdotnet
Copy link
Collaborator

With 1.22 (where we don't explicitly support net8.0) it works like a charm (which makes sense given the context).

@egil
Copy link
Member

egil commented Oct 14, 2023

Doing a new preview release now that will build against RC2. Perhaps that fixes the issue. Guessing the package on nuget.org is build against rc1 and that is causing the failure. We cannot replicate when adding the tests and running against bunit sources.

@linkdotnet
Copy link
Collaborator

Ah fair - I also run rc.2 locally.
But that bit is anyway interesting. Why should it fail with a type that is provided by the framework and not us.

@egil
Copy link
Member

egil commented Oct 14, 2023

Upgrading to <PackageReference Include="bunit" Version="1.24.8-preview" /> fixes the problem for me.

@egil
Copy link
Member

egil commented Oct 14, 2023

Ah fair - I also run rc.2 locally. But that bit is anyway interesting. Why should it fail with a type that is provided by the framework and not us.

Guessing it is because rc1 and rc2 are not binary compatible.

@linkdotnet
Copy link
Collaborator

Okay - @msynk can you confirm that it also works on your side?

@msynk
Copy link
Contributor Author

msynk commented Oct 14, 2023

@linkdotnet Thanks a lot. the latest preview version (1.24.9-preview) is working fine for me 👏.

@linkdotnet
Copy link
Collaborator

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants