Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Producing contract reference assemblies for .NET Framework 4.6 #291

Merged
merged 1 commit into from
Jan 26, 2016
Merged

Producing contract reference assemblies for .NET Framework 4.6 #291

merged 1 commit into from
Jan 26, 2016

Conversation

fedotovalex
Copy link
Contributor

This pull request adds compiling and installing contract reference assemblies specific for .NET Framework 4.6. This pull request does not add any new system contracts for .NET Framework 4.6, but it would be a prerequisite for adding any such contracts.

Why do we need 4.6-specific assemblies?

.NET Framework 4.6 adds new overloads to frequently used methods. For example, there are now

static string String.Format(IFormatProvider, string, object)
static string String.Format(IFormatProvider, string, object, object)
static string String.Format(IFormatProvider, string, object, object, object)

in addition to

static string String.Format(IFormatProvider, string, object[])

This causes innocently looking code like this:

string str = String.Format(CultureInfo.InvariantCulture, "Value: {0}", x);
Contract.Assert(str != null);

to fail static contract verification when targeting .NET Framework 4.6 because the specific overload is not present in .NET 4.5 CRAs.

Caveats

Building new contract reference assemblies requires .NET Framework 4.6 and .NET Framework 4.6 Targeting Pack to be installed on the build machine.

An alternative would be to stuff another 100MB of reference assemblies into Microsoft.Research\Imported\ReferenceAssemblies, but we seem to feel strongly about not doing so.

@SergeyTeplyakov
Copy link
Contributor

Looks good for me, but I would glad to hear more opinions on this topic.

//cc @sharwell, @tom-englert, @hubuk

@tom-englert
Copy link
Contributor

👍

@SergeyTeplyakov
Copy link
Contributor

LGTM.

@sharwell: would like to hear your opinion.

SergeyTeplyakov added a commit that referenced this pull request Jan 26, 2016
Producing contract reference assemblies for .NET Framework 4.6
@SergeyTeplyakov SergeyTeplyakov merged commit 531c71b into microsoft:master Jan 26, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants