-
Notifications
You must be signed in to change notification settings - Fork 198
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
Experiencing "Cannot implicitly convert type 'Microsoft.AspNetCore.Components.ElementReference' to MyComponent" #8931
Comments
Thanks for reporting this. Both 8.0.100-preview.6.23330.14 and 7.0.400-preview.23356.7 should have the fix. Can you please share more details about the component that's giving the error ( |
@jjonescz Here are the two files; If you don't see anything that could be triggering the error I can try to extract to a minimal repo. But there is a ton backing components/etc. that will make it difficult. I have followed this pattern throughout the application and have not run into this issue before. The 'TreatmentDialog is pretty straightforward with a razor & razor.cs file: razor:
and the cs file:
|
Sorry, don't see anything that would suggest why the error happens. If you cannot create a minimal repro and your whole solution is easy to build, you can share it privately via VS Feedback (post a link to the ticket here if you do that). |
@jjonescz Thanks for looking at the code; I will create as small a repository as I can. Building is simple as all you need to do is to load the solution in Visual Studio & then F6... |
@jjonescz -- I ripped apart the solution removing all servers, etc. I zipped the source of the client and it exceeds what I can upload here (File size too big: 25 MB are allowed, 37 MB were attempted to upload.) I can either split the source and do two zips or I can create a private github repository and give you read access. Or, if you have another solution, I am happy to hear that also. |
Have you removed the |
It's a BIG application. Yes, the binaries were removed (at the root of the project there is a file called superclean.cmd that is used to remove artifacts but it looks like it doesn't work for ".artifacts", but that only has 3 Mb). Anyhow, the community portal upload worked: https://developercommunity.visualstudio.com/t/Razor-compilation-failure/10412528 I get the same failure:
|
BTW, I am using the 'DevServer' configuration and the 8.0.0-preview.6.23330.14 sdk |
Hi. This is just a guess, but could the issue be related to long paths? I've come across similar situations in the past when people have shared their reproduction code with me. What if you try moving the |
@MarkStega the problem is in your |
Thanks for finding that -- It is a very annoying Visual Studio 'side effect' to put the '''<Content remove``` items if you copy/rename files. It does so silently. I have often copied an existing component in VS, pasted it, renamed the "- Copy". I am going to post this in VS feedback as a bug unless you think this is a good behavior on the part of VS. |
@ScarletKuro See above for the root cause. The uneven support for long file names in VS is an issue but not the problem this time. I can't open the generated files with VS due to the path being too long so I have to copy them to a shorter path. |
@jjonescz @danroth27
I ran into the issue reported in #8761 which was closed with a reference to issue (#8718) which was closed as complete.
I was using the 8.0.preview.5 SDK. I followed the table reference for 8.0.100-preview.6.23330.14 SDK, installed, and still have the error.
In my component MOIPrimaryTreatment.Razor I have another component defined as:
Instead of having a component defined in the corresponding razor.g.cs I have an element:
And then, of course, when I try to use the component reference I get the "Cannot implicitly convert type 'Microsoft.AspNetCore.Components.ElementReference' to TreatmentDialog"
Other similar embedded components are working as expected. I just don't see the code pattern that is causing the generation to fail.
[Edit] I also tried sdk 7.0.400-preview.23356.7 and have the same error...
The text was updated successfully, but these errors were encountered: