Repository navigation
ResXFileRef special cases - #4607
Conversation
There was a problem hiding this comment.
@ericstj Do I need to check both of these, or would just the desktop-framework flavor be sufficient? I wrote a resx using the Core ResXResourceWriter and it did embed
<data name="ref" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>whatever.txt;System.IO.MemoryStream, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e</value>
</data>There was a problem hiding this comment.
System.Private.CoreLib should not persist to source files. I think there would need to be some affordance for that when writing a resx, even if it were a resx that only needed to work with core.
There was a problem hiding this comment.
I think it should be using TypeForwardedFromAttribute to write out the original identity. That leads me to believe we do not need to support the core identity. Since nothing is writing core-specfic resx files yet in VS, I think we should wait and see how this shakes out. I would not bake System.Private.CoreLib into our code base unless we are told to do so by corefx.
There was a problem hiding this comment.
Ok, removed System.Private.CoreLib from here and #4638.
There was a problem hiding this comment.
Right, we had requested this ResX designer use TypeForwardedFrom.
There was a problem hiding this comment.
NIT: Should you have variables for these strings, like you have on IsMemoryStream?
There was a problem hiding this comment.
For this, I'm preserving the code as it was in the original ResXReader code in the comment above. Would you prefer static strings? I'm not opposed.
There was a problem hiding this comment.
Not super worried about it.
There was a problem hiding this comment.
(Realize this is preserved, but sure is hacky that this is just a couple of indexofs that would have all sorts of false matches in theory.)
There was a problem hiding this comment.
Yeah, its primary purpose these days is to make everyone who looks at it sad :(
|
No tests? |
|
Testing the types of failures this fixes is difficult at the moment. I filed dotnet/sdk#3549 to create some end-to-end tests in a repo that already has good infrastructure to support building and running test projects. |
505cf9b to
589ef2b
Compare
These were handled specially in the WinForms reader, to read in the byte array and wrap a stream around it, then use the primitive-type serialization to deal with that.
589ef2b to
c3717ae
Compare
|
@rainersigwald - I have same issue with byte[] on .NetCore3.0. Could you please help me to fix this?
|
|
@ManoharRT please open a new issue with complete repro details. https://github.com/microsoft/msbuild/issues/new/choose |
Description
Add special cases in build-time resource embedding for the resource types
byte[]andMemoryStream. Fixes #4581.Enable
StronglyTypedResourceBuilderwhen running on .NET Core and ensure that projects built using the .NET Core codepath get code generated using the expected types for resources. Fixes #4588, fixes #2272.Customer Impact
Accessing some resources would throw an exception at runtime instead of returning a resource of type
byte[]orMemoryStream.Projects affected by either problem would have to workaround by:
MSBuild.exe, notdotnet buildRegression
Regression from .NET Framework functionality; bugs in features new to crossplatform .NET Core MSBuild.
Risk
Low--impacts only the new resource codepaths.