You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
GenerateResources task is not incremental on .NET Core #1197
The CoreResGen target is not incremental, because it assumes that the GenerateResources task handles incrementality internally. It does . . . on full framework, when FEATURE_BINARY_SERIALIZATION is enabled and NeedToRebuildSourceFile gets called.
On .NET Core, though, that codepath falls back to the conservative-but-slow "always just rebuild".
IIRC there's a plan to make binary serialization available everywhere (just not portable between .NET Core and Full Framework). If that is already done this might be easy. If not, we might have to devise a new serialization format 👎
I believe binary serialization is coming to .NET Core with netstandard2.0. But that won't be available for a while yet. So we may have to devise a way around this for Dev15.
BinaryFormatter is already implemented for 1.2. It's in master. It works. And most of the core types that should be serializable now are, though there are still a bunch of types across corefx that need some work done to restore their serialization implementations.
@rainersigwald, what gurantees do you need for incremental build? I suppose you don't care about binary serialization having different output between .NET Framework and .NET Core?
ResourceReader/Writer itself will serialize/deserialize types as part of its work. I'm guessing that none of our resx's have such things (it's really a Winforms artefact) so we're getting away without that.
Just realized we can't create AppDomains so that's not an issue. Another reason we shouldn't run on .resx's with serialized user types - we'll lock them.
That could create a behavior difference when using .NET Core MSBuild to build assemblies for Desktop. CLI currently does that, but the plan has been to always use Desktop MSBuild if it's available.
Given this, I think it's ok to do something like #1202.
@danmosemsft and others--is this a reasonable read on the situation?
@rainersigwald yes I think so. BTW I don't have cycles right now to test/commit #1202 ... for some reason I can't get MSBuild to actually build for me right now.
Activity
rainersigwald commentedon Oct 14, 2016
IIRC there's a plan to make binary serialization available everywhere (just not portable between .NET Core and Full Framework). If that is already done this might be easy. If not, we might have to devise a new serialization format 👎
eerhardt commentedon Oct 17, 2016
I believe binary serialization is coming to .NET Core with netstandard2.0. But that won't be available for a while yet. So we may have to devise a way around this for Dev15.
/cc @stephentoub @terrajobst @ericstj
terrajobst commentedon Oct 17, 2016
That's correct, binary serialization will come back.
@danmosemsft, who is working on it and can provide an update where we are with it?
stephentoub commentedon Oct 17, 2016
BinaryFormatter is already implemented for 1.2. It's in master. It works. And most of the core types that should be serializable now are, though there are still a bunch of types across corefx that need some work done to restore their serialization implementations.
terrajobst commentedon Oct 17, 2016
@stephentoub: Sweet!
@rainersigwald, what gurantees do you need for incremental build? I suppose you don't care about binary serialization having different output between .NET Framework and .NET Core?
danmoseley commentedon Oct 18, 2016
@terrajobst it uses BinaryFormatter for 2 purposes
To cache between builds the set of files if any that are linked to from within the .resx: http://index/#Microsoft.Build.Tasks.Core/ResGenDependencies.cs,183 ... cross FX serialization is not important.
To deserialize types found within the resx in order to figure out whether they are in the GAC. If deserialization fails, they aren't, so it needs to process the resx in its own appdomain. It wants to avoid that as it's so slow. http://index/#Microsoft.Build.Tasks.Core/GenerateResource.cs,1821 That would need tobe cross FX, but it can remain ifdeffed out as we don't have resx's with such types. We do want to fix this later because creating an appdomain is slow and as we have it right now, it will always do it.
ResourceReader/Writer itself will serialize/deserialize types as part of its work. I'm guessing that none of our resx's have such things (it's really a Winforms artefact) so we're getting away without that.
danmoseley commentedon Oct 18, 2016
Just realized we can't create AppDomains so that's not an issue. Another reason we shouldn't run on .resx's with serialized user types - we'll lock them.
danmoseley commentedon Oct 18, 2016
I think the ifdef can be narrowed to give us pretty good incremental build. Let me see.
danmoseley commentedon Oct 18, 2016
A sketch (or possibly the actual) fix for incrmentality without BinarySerialization is in the PR #1202
rainersigwald commentedon Oct 18, 2016
Ok, so my current understanding is:
.NET Core assemblies cannot use linked resources (that's what it sounds like from comments @DamianEdwards made on https://github.com/dotnet/corefx/issues/8200 which is now https://github.com/dotnet/cli/issues/3695). This implies that it's fine to drop all of the code in
GenerateResourcesthat parses the resx and check incrementality as is-resx-newer-than-resources.That could create a behavior difference when using .NET Core MSBuild to build assemblies for Desktop. CLI currently does that, but the plan has been to always use Desktop MSBuild if it's available.
Given this, I think it's ok to do something like #1202.
@danmosemsft and others--is this a reasonable read on the situation?
danmoseley commentedon Oct 18, 2016
@rainersigwald yes I think so. BTW I don't have cycles right now to test/commit #1202 ... for some reason I can't get MSBuild to actually build for me right now.
Incrementality for GenerateResource on .NET Core
rainersigwald commentedon Oct 27, 2016
Fixed in xplat packages from
15.1.0-preview-000358-00