Skip to content

dotnet-wpf-int builds fail due to ResXCodeFileGenerator regression in recent dev16.3p2 builds #1492

Closed

Description

@vatsan-madhavan

WPF uses ResXFileCodeGenerator it its builds. We have a resx with entries like this (Documents.resx)

  <data name="Invalid_35x35" type="System.Resources.ResXFileRef, System.Windows.Forms">
    <value>Invalid_35x35.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
  </data>

It generates getters that should look like this:

        internal static System.Drawing.Bitmap Invalid_35x35 {
            get {
                object obj = ResourceManager.GetObject("Invalid_35x35", resourceCulture);
                return ((System.DrawingBitmap)(obj));
            }
        }

Suddenly, as of some recent VS build, ResXFileCodeGenerator is starting to emit files with getters that are instead like this (not the return type – they are plain object).

        /// <summary>
        ///   Looks up a localized resource of type System.Object similar to Microsoft.Build.Tasks.ResourceHandling.LiveObjectResource.
        /// </summary>
        internal static object Invalid_35x35 {
            get {
                object obj = ResourceManager.GetObject("Invalid_35x35", resourceCulture);
                return ((object)(obj));
            }
        }

Here is a standalone repro that illustrates the problem. Build with commandline msbuild (not dotnet, use msbuild, VS version dev16.3p2 29128.8.master, Int Preview).

After building, open obj\Debug\netcoreapp3.0\MS.Internal.Documents.Resources.cs and you can see getters that return object instead of specifc types.

resx-codegen-issue.zip

Activity

  1. added
    regression
    on Jul 31, 2019
  2. added this to the 3.0 milestone on Aug 1, 2019
  3. added
    issue-type-tracking-external
    on Aug 1, 2019
  4. rainersigwald commented on Aug 8, 2019

    @rainersigwald
    Member

    dotnet/msbuild#4588 should deliver a fix for this with no change required in WPF.

  5. vatsan-madhavan commented on Aug 10, 2019

    @vatsan-madhavan
    MemberAuthor

    Opened an issue to track undoing the workaround put in here - #1588. closing since the issue has been fixed.

  6. ghost locked as resolved and limited conversation to collaborators on Apr 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-infrastructureissue-type-tracking-externalregression

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions