Skip to content
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

Adding conditional compiler symbol to support .NET 3.5 #1713

Merged
merged 3 commits into from
Jun 28, 2016

Conversation

detlevschwabe
Copy link
Contributor

No description provided.

@grpc-kokoro
Copy link

Thanks for your pull request. The automated tests will run as soon as one of the admins verifies this change is ok to test.

@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll verify. Thanks.


  • If you've already signed a CLA, it's possible we don't have your GitHub username or you're using a different email address. Check your existing CLA data and verify that your email is set on your git commits.
  • If you signed the CLA as a corporation, please let us know the company's name.

@detlevschwabe
Copy link
Contributor Author

I signed it!

On Fri, Jun 24, 2016 at 9:26 AM, googlebot notifications@github.com wrote:

Thanks for your pull request. It looks like this may be your first
contribution to a Google open source project. Before we can look at your
pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/
https://cla.developers.google.com/ to sign.

Once you've signed, please reply here (e.g. I signed it!) and we'll

verify. Thanks.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#1713 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/ATLiQvU5lr33WL3t5Kr7jRrfC2d_UwpZks5qPAU6gaJpZM4I965N
.

Detlev Schwabe
13230 Fiji Way Unit #B
https://www.google.com/maps?q=13230+Fiji+Way,+Marina+del+Rey,+CA&hl=en&sll=33.979499,-118.433686&sspn=0.040391,0.0527&oq=home&hnear=13230+Fiji+Way,+Marina+del+Rey,+Los+Angeles,+California+90292&t=m&z=17
Marina del Rey, CA 90292
https://www.google.com/maps?q=13230+Fiji+Way,+Marina+del+Rey,+CA&hl=en&sll=33.979499,-118.433686&sspn=0.040391,0.0527&oq=home&hnear=13230+Fiji+Way,+Marina+del+Rey,+Los+Angeles,+California+90292&t=m&z=17
United States

Cell: +1 310 699 8693

@googlebot
Copy link

CLAs look good, thanks!

#if DOTNET35
private static Dictionary<object, string> GetNameMapping(System.Type enumType) =>
enumType.GetFields(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static)
.Where(f => f.IsStatic)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can get rid of BindingFlags.Instance above and this Where clause.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jskeet
Copy link
Contributor

jskeet commented Jun 27, 2016

Thanks for this. A few nits, and we need ReadOnlyDictionary before it'll work.
I'll update the readme to explain the state of play at some point.

@detlevschwabe
Copy link
Contributor Author

Since this is my very first time working with GitHub, how will I get my additional local changes up into my branch that I created on my fork, and then from there into the current PR?

@jskeet
Copy link
Contributor

jskeet commented Jun 27, 2016

You should commit your changes locally on the same branch, push to the same branch in your fork, and then they'll become part of this pull request. When everything looks okay, we'll squash the multiple commits down to a single one to merge onto this repo.

@@ -49,6 +49,11 @@ internal static class TypeExtensions
/// Returns true if the target type is a value type, including a nullable value type or an enum, or false
/// if it's a reference type (class, delegate, interface - including System.ValueType and System.Enum).
/// </summary>
#if DOTNET35
internal static bool IsValueType(this Type target) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gah, I missed the brace-at-end-of-line here. Not to worry - will fix that up later myself.

@jskeet
Copy link
Contributor

jskeet commented Jun 28, 2016

Looks like the Travis failure is unrelated to this. Squashing and merging now.

@jskeet jskeet merged commit dc0aeaa into protocolbuffers:master Jun 28, 2016
@JohnHBrock
Copy link
Contributor

@detlevschwabe I was only able to get this to work with .NET 3.5 after changing the DOTNET35 symbols to NET35. Are you sure DOTNET35 is correct?

@JohnHBrock
Copy link
Contributor

Valid preprocessor symbols are listed at https://docs.microsoft.com/en-us/dotnet/articles/core/tutorials/libraries

.NET Framework 2.0 --> NET20
.NET Framework 3.5 --> NET35
.NET Framework 4.0 --> NET40
.NET Framework 4.5 --> NET45
.NET Framework 4.5.1 --> NET451
.NET Framework 4.5.2 --> NET452
.NET Framework 4.6 --> NET46
.NET Framework 4.6.1 --> NET461
.NET Framework 4.6.2 --> NET462
.NET Standard 1.0 --> NETSTANDARD1_0
.NET Standard 1.1 --> NETSTANDARD1_1
.NET Standard 1.2 --> NETSTANDARD1_2
.NET Standard 1.3 --> NETSTANDARD1_3
.NET Standard 1.4 --> NETSTANDARD1_4
.NET Standard 1.5 --> NETSTANDARD1_5
.NET Standard 1.6 --> NETSTANDARD1_6

@jskeet
Copy link
Contributor

jskeet commented Feb 11, 2017

@JohnHBrock: Those are just the automatically-applied symbols. It's valid to make a build define others.

@JohnHBrock
Copy link
Contributor

Since NET35 is automatically defined, I ended up creating a PR (#2715) to change the DOTNET35 symbols to NET35 in the interest of making things work out-of-the-box (the PR also includes some other fixes for enabling .NET 3.5 support).

@detlevschwabe
Copy link
Contributor Author

detlevschwabe commented Feb 21, 2017 via email

@JohnHBrock
Copy link
Contributor

I actually already fixed that Stream.CopyTo(...) issue as part of my pull request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants