Skip to content

ReadyToRun app fails if custom attributes have types with utf8 characters #63481

@vsfeedback

Description

@vsfeedback

Repro steps:

Stack trace:

Unhandled exception. System.TypeLoadException: Could not load type 'c1.Test_Æoå' from assembly 'c1, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.
   at System.Reflection.CustomAttribute._CreateCaObject(RuntimeModule pModule, RuntimeType type, IRuntimeMethodInfo pCtor, Byte** ppBlob, Byte* pEndBlob, Int32* pcNamedArgs)
   at System.Reflection.CustomAttribute.CreateCaObject(RuntimeModule module, RuntimeType type, IRuntimeMethodInfo ctor, IntPtr& blob, IntPtr blobEnd, Int32& namedArgs)
   at System.Reflection.CustomAttribute.AddCustomAttributes(ListBuilder`1& attributes, RuntimeModule decoratedModule, Int32 decoratedMetadataToken, RuntimeType attributeFilterType, Boolean mustBeInheritable, ListBuilder`1 derivedAttributes)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeModule decoratedModule, Int32 decoratedMetadataToken, Int32 pcaCount, RuntimeType attributeFilterType)
   at System.Reflection.CustomAttribute.GetCustomAttributes(RuntimeAssembly assembly, RuntimeType caType)
   at System.Reflection.RuntimeAssembly.GetCustomAttributes(Type attributeType, Boolean inherit)
   at System.Attribute.GetCustomAttributes(Assembly element, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttributes(Assembly element)

Original report

This issue has been moved from a ticket on Developer Community.


[severity:I'm unable to use this version] [regression] [worked-in:16 (asp.net 5)]
This worked in asp.net 5 - now broken in asp.net 6.
I have a website where I use danish letters for many things, including file names, classes and variables. Since .net and Windows is all unicode, this has worked fine till now.

I have now installed Visual Studio 2022 and .net 6. I have converted my projects to target .net6.0-windows
When I compile and run (with or without Visual Studio) on the local IIS, everything is fine. When I publish to IIS, the app won't even start (this is true no matter if I run the published app on local IIS or remote IIS).

I have found out 2 conditions must be true:

  1. 'enable ready to run compilation' publish setting must be checked.
  2. The site must contain a page with a unicode (non-ascii) name.

This is serious, since I use danish letters all over the place and finding this bug has taken days.
I think you have changed the 'readytorun' compiler to support Linux (and Linux can't even spell unicode).
I would like to be able to use the 'enable ready to run compilation' setting again.

Reproducing this is quite easy:

  1. In any WebApplication running .net 6.0 in Visual Studio 2022, add a Razor page with a name like: 'Æøå.cshtml'.
  2. Compile and run - this should work.
  3. Publish the application to IIS. Make sure have checked 'enable ready to run compilation'.

I have attached my other publish settings (in case that matters).

Now the app won't even start!

I hope you get this fixed quickly so the whole world can use 'readytorun' compilation.


Original Comments

live on 11/16/2021, 10:40 PM:

Oops, wrong screen shot, ‘readytorun’ should of course be checked.

Feedback Bot on 11/17/2021, 00:15 AM:

We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.

Feedback Bot on 11/18/2021, 00:20 AM:

Thank you for sharing your feedback! Our teams prioritize action on product issues with broad customer impact. See details at: https://docs.microsoft.com/en-us/visualstudio/ide/report-a-problem?view=vs-2019#faq. In case you need answers to common questions or need assisted support, be sure to use https://visualstudio.microsoft.com/vs/support/. We’ll keep you posted on any updates to this feedback.


Original Solutions

(no solutions)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions