Skip to content

Using 1.x tag helper in net core 3 #14378

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

Closed
Muchiachio opened this issue Sep 24, 2019 · 17 comments
Closed

Using 1.x tag helper in net core 3 #14378

Muchiachio opened this issue Sep 24, 2019 · 17 comments
Assignees
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed
Milestone

Comments

@Muchiachio
Copy link
Contributor

Describe the bug

While upgrading our applications to net core 3 we noticed that none of our tag helper libraries written in core 1.x work on net core 3. Updating them to asp net core 2.2 version seems to fix the problem. Did something changing in how tag helpers are resolved or is this a bug?

To Reproduce

  1. Checkout repro
  2. Run master branch
  3. Email tag helper is not being run
  4. Checkout and run working branch which uses 2.2 packages
  5. Email tag helper is run

Expected behavior

1.x version tag helpers referenced from net core 3 are discovered and run

Additional context

.NET Core SDK (reflecting any global.json):
 Version:   3.0.100
 Commit:    04339c3a26

Runtime Environment:
 OS Name:     Windows
 OS Version:  10.0.18362
 OS Platform: Windows
 RID:         win10-x64
 Base Path:   C:\Program Files\dotnet\sdk\3.0.100\

Host (useful for support):
  Version: 3.0.0
  Commit:  7d57652f33

.NET Core SDKs installed:
  3.0.100 [C:\Program Files\dotnet\sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.NETCore.App]
  Microsoft.WindowsDesktop.App 3.0.0 [C:\Program Files\dotnet\shared\Microsoft.WindowsDesktop.App]
@javiercn javiercn added the area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates label Sep 24, 2019
@javiercn
Copy link
Member

@Muchiachio Thanks for contacting us.

Do the tag helpers light up in visual studio? Have you checked you are using @addTagHelpers to bring them into scope?

Can you provide a minimal repro project so that we can investigate?

@javiercn javiercn added the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Sep 24, 2019
@Muchiachio
Copy link
Contributor Author

They don't light up. I did provide a repro in the first step 👍

@javiercn
Copy link
Member

javiercn commented Sep 24, 2019

Thanks, I missed the repro.

@NTaylorMullen @ajaybhargavb Ideas?

@javiercn javiercn removed the Needs: Author Feedback The author of this issue needs to respond in order for us to continue investigating this issue. label Sep 24, 2019
@mkArtakMSFT
Copy link
Contributor

@ajaybhargavb can you please look into this to understand why this isn't working? Let's have a conversation then.

@mkArtakMSFT mkArtakMSFT added this to the 3.1.0-preview2 milestone Sep 24, 2019
@davidfowl
Copy link
Member

cc @DamianEdwards

@NTaylorMullen
Copy link

@mkArtakMSFT i'm taking a look now, re-assigning.

@NTaylorMullen
Copy link

The gist: So I looked into this and what's happening is that the Roslyn compilation that we're operating on at tooling time and at runtime have two different symbols for ITagHelper, one that comes from the 1.0 version of Microsoft.AspNetCore.Razor.Runtime and another that comes from the 3.0 variant.

Details: When we try to detect that the 1.0 projects(1.0P) TagHelper(Foo) "is a TagHelper" we compare Foo's interfaces against the 3.0 ITagHelper interface. We find that Foo's interface looks like the 1.0 ITagHelper symbol and then fail our "is a TagHelper" check because it's not the 3.0 ITagHelper interface. Foo's ITagHelper interface is definitely odd though because it says that it's containing assembly is the "3.0" assembly; however the properties of Foo's ITagHelper interface say different. For example we added ITagHelperComponent as an implemented interface in 2.0 and that doesn't exist on Foo's ITagHelper symbol leading me to believe it's interpreting the symbol from the 1.0 package.

Also, for what it's worth, the deps.json (not sure how much it has to do at design time) looks to have thrown away the 1.0 projects reference to Razor.Runtime and is using a lifted version (in my case it's lifting it to 2.0 because the parent project is referencing a 1.0 and a 2.0 TagHelper project).

Sooo, it looks like something funky is going on with the way Roslyn's compilation is interpreting the projects? @jasonmalinowski @agocke can you both take a look? If needed I or @ajaybhargavb can help you get yourself setup into a good debugging environment for this.

Lastly, @Muchiachio would you mind pushing the master branch to that repo? I was able to reproduce but had to re-create the 1.0 project. It'd be nice if others looking at this had the master branch to work from.

@NTaylorMullen
Copy link

I forked @Muchiachio's repo and pushed a notworking branch: https://github.com/NTaylorMullen/Taggy

@Muchiachio
Copy link
Contributor Author

Sorry, didn't notice that github client didn't push master branch (it's one commit back), should be fixed now.

@rynowak
Copy link
Member

rynowak commented Sep 25, 2019

@NTaylorMullen - would check if the SDK/RAR is unifying assemblies properly - ie, are there two versions of Microsoft.AspNetCore.Razor.Runtime that are being passed to the compiler.

@mkArtakMSFT
Copy link
Contributor

@JunTaoLuo can you please work with @ajaybhargavb to get your fix validated.

@mkArtakMSFT mkArtakMSFT added bug This issue describes a behavior which is not expected - a bug. Working and removed investigate labels Oct 1, 2019
@ajaybhargavb
Copy link
Contributor

Verified with a private build from @JunTaoLuo that it fixes this issue. 👍

@ajaybhargavb
Copy link
Contributor

@JunTaoLuo assigning this to you. Please close this issue when your fix is in.

@mkArtakMSFT
Copy link
Contributor

@JunTaoLuo I know you've been working on this. What's the latest on this?

@JunTaoLuo
Copy link
Contributor

This was fixed in #14538. We have not yet gotten a build of it for verification though.

@pranavkm
Copy link
Contributor

pranavkm commented Nov 4, 2019

@JunTaoLuo moving this out to 3.0.x for further verification. I verified that TypeForwardedTo attributes show up correctly in ref assemblies of 3.1.0-preview2 builds.

@pranavkm pranavkm modified the milestones: 3.1.0-preview2, 3.0.1 Nov 4, 2019
@JunTaoLuo
Copy link
Contributor

I've verified that the 3.0.1 build's ref pack now contains assemblies with the expected typeforwardedto attributes.

@mkArtakMSFT mkArtakMSFT added Done This issue has been fixed and removed Working labels Nov 11, 2019
@ghost ghost locked as resolved and limited conversation to collaborators Dec 11, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-mvc Includes: MVC, Actions and Controllers, Localization, CORS, most templates bug This issue describes a behavior which is not expected - a bug. Done This issue has been fixed
Projects
None yet
Development

No branches or pull requests

9 participants