-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Enable cache for RAR #2792
Enable cache for RAR #2792
Conversation
src/Directory.BeforeCommon.targets
Outdated
@@ -10,7 +10,7 @@ | |||
</PropertyGroup> | |||
|
|||
<PropertyGroup> | |||
<DefineConstants>$(DefineConstants);STANDALONEBUILD</DefineConstants> | |||
<DefineConstants>$(DefineConstants);STANDALONEBUILD;FEATURE_BINARY_SERIALIZATION</DefineConstants> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Remove it from the net4* pile? Or is the pile intent to document what's on net4*. In which case there should be a similar pile for .net core?
@@ -361,13 +361,8 @@ public void TestTranslationWithValueTypesInDictionary() | |||
1, | |||
Directory.GetCurrentDirectory(), | |||
null, | |||
#if FEATURE_THREAD_CULTURE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe it's not worth doing this until we get the green light for removing ns13? If we can't remove ns13, we'll have to put this back. Same goes for the other removed flags.
|
||
public void GetObjectData(SerializationInfo info, StreamingContext context) | ||
{ | ||
if (asAssemblyName != null) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably nice to have it sync with https://github.com/Microsoft/msbuild/blob/master/src/Shared/AssemblyUtilities.cs#L62
@@ -2012,7 +2012,8 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |||
expensive to write the newly created cache file. | |||
--> | |||
<PropertyGroup> | |||
<ResolveAssemblyReferencesStateFile Condition="'$(BuildingProject)'=='true'">$(IntermediateOutputPath)$(MSBuildProjectFile)ResolveAssemblyReference.cache</ResolveAssemblyReferencesStateFile> | |||
<ResolveAssemblyReferencesStateFile Condition="'$(BuildingProject)'=='true' and '$(MSBuildRuntimeType)' != 'Core'">$(IntermediateOutputPath)$(MSBuildProjectFile)ResolveAssemblyReference.cache</ResolveAssemblyReferencesStateFile> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to leave a comment saying why there's two
3f701d1
to
6712ca1
Compare
src/Shared/AssemblyNameExtension.cs
Outdated
{ | ||
if (asAssemblyName != null) | ||
{ | ||
info.AddValue("asAssemblyName", true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It probably doesn't matter a lot but these could just be something like "AN" not "asAssemblyName" which adds up, with 100 assembly names that's about 15KB of extra writes, 30KB if it's written out as UTF16 (not sure).
For similar reasons you might consider "interning" some well known values like the 3 or 4 common PK and PKT almost all our assemblies have -- writing out a marker for those instead would save a lot of bytes if you write out many of these assembly names.
@@ -2012,7 +2012,9 @@ Copyright (C) Microsoft Corporation. All rights reserved. | |||
expensive to write the newly created cache file. | |||
--> | |||
<PropertyGroup> | |||
<ResolveAssemblyReferencesStateFile Condition="'$(BuildingProject)'=='true'">$(IntermediateOutputPath)$(MSBuildProjectFile)ResolveAssemblyReference.cache</ResolveAssemblyReferencesStateFile> | |||
<!-- Note: Binary serialization not guaranteed to be consistent across full framework and .NET Core, so we need to use a different cache file. --> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.NET Framework and .NET Core do promise to interchange serialized data (if the type is binary serializable in both). What you mean is your special AssemblyName serializatoin scheme is not shared by older MSBuild's.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only necessary if you expect both MSBuild's to build the same projectwith the same obj folder. Neither side crash if they can't deserialize, they just warn and overwrite it.
src/Shared/AssemblyNameExtension.cs
Outdated
var hasAsAssemblyName = info.GetBoolean("asAssemblyName"); | ||
if (hasAsAssemblyName) | ||
{ | ||
var name = info.GetString("asAssemblyName.Name"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hopefully there are unit tests that would fail if there was a mistake in the serializatoin/deserialization? it's very easy to have a tpyo or suchlike.
6712ca1
to
2add5c2
Compare
e6cfe84
to
c84668d
Compare
c84668d
to
e35d71b
Compare
2add5c2
to
e1b491c
Compare
b51b7e1
to
16c640c
Compare
@dotnet-bot test Ubuntu16.04 Build for CoreCLR please |
All the tests are green here, ready for final review. |
16c640c
to
76356ff
Compare
One thing to note I removed the split to use a different cache for the Core version. I don't think we need that, but I could be wrong. They should cache the same things and the serialization changes to support Core are for both (I updated the format version). |
76356ff
to
6dec148
Compare
@dotnet-bot test Windows_NT Build for Full please |
1 similar comment
@dotnet-bot test Windows_NT Build for Full please |
4046222
to
7f07bb3
Compare
0c37aeb
to
db5b029
Compare
Some types are dependent on WinForms
* Enable FEATURE_BINARY_SERIALIZATION for .NET Core build. * Add custom serialization for types not marked Serializable in .NET Core.
If a custom build event does not implement a serialization method, the timestamp field may get serialized as an Unspecified kind. To fix this, EventArgs will now always serialize Utc format and not convert when observed. If the event kind is Unspecified, assume it's UTC and convert when the property is accessed.
Renaming the file to avoid issues with breaking changes between 15.6 and 15.7. This is generally not an issue, but 15.6 and below will warn with a cryptic error message. If users (esp. internal users) switch back and forth in the same repo this would result in many harmless but concerning warnings.
This was used in binary serialization and supported on .NET Core 2.0.
8e8014b
to
9d88e82
Compare
Yay! |
Preliminary numbers on a basic netcoreapp2.0 -> netstandard2.0 library sln:
Tip of
exp/update-toolset
branch rebuild:This branch with RAR *.Core.cache file:
This branch after deleting *.Core.cache:
So even without the cache file it's still after with binary serialization turned on. Not sure why (there's a lot of code that differs). Also haven't done anything other than manual testing.