.NET Core Hackathon

Kickoff - Saturday June 2nd 2018 - Jonathan Mezach

Who am I?

IT Architect @ Info Support

.NET Developer for 12+ years

Focus on .NET Core

.NET Core Hackathon 2017

Over 10 PR's merged

Topics

  • Getting started
  • Finding something to work on
  • Cloning and building the repo
  • Writing and testing code
  • Submitting a PR
  • Staying up to date

Getting Started

Finding something to work on

It's not easy

Labels & Milestones

Tips

  • Make sure you understand the issue or feature you want to work on
  • If you have questions about the issue/feature, don't hesitate to ask
  • Once you're a "collaborator" you can ask to get issues assigned to you
  • New features usually require an API review which takes time

Cloning and building the repo

Step 0 - Install prereqs

Depends on your platform:

Step 1a - Fork

Step 1b - Clone

git clone https://github.com/<username>/corefx.git

Step 2 - Build

build.cmd
./build.sh
./build.sh

Step 3 - Run tests

build-tests.cmd
./build-tests.sh
./build-tests.sh

Keep in mind

  • In my experience, there's usually a couple of tests that fail (at least on OSX)
  • Depending on the assembly you want to work on, this may or may not be a problem

Writing and testing code

Editor support

My workflow

  • Open assembly folder (eg. src/System.Xml) in VS Code
  • Open two terminals
cd src
../../../Tools/msbuild.sh

Build succeeded.
    0 Warning(s)
    0 Error(s)
cd tests
../../../Tools/msbuild.sh /t:BuildAndTest

  xUnit.net console test runner (64-bit .NET Core)
  Copyright (C) 2014 Outercurve Foundation.

  Discovering: System.Json.Tests
  Discovered:  System.Json.Tests
  Starting:    System.Json.Tests
  Finished:    System.Json.Tests

  === TEST EXECUTION SUMMARY ===
     System.Json.Tests  Total: 184, Errors: 0, Failed: 0, Skipped: 0, Time: 0.318s
  ~/Projects/open-source/dotnet/corefx/src/System.Json/tests
  Finished running tests. End time=21:47:36. Return value was 0

Code, Build, Test, Repeat...

Some tips

  • Create a new branch for your feature or fix
  • Keep your forks master clean so you can easily pull in changes from the main repo

 

  • BuildAndTest only builds the test code, not the actual implementation
  • If test code hasn't changed, BuildAndTest does nothing

Submitting a PR

Click the magic button...

... and prepare to be amazed!

  • Creating the PR kicks-off about 18 different builds
  • Expect to receive quite a few comments on your code
  • Some might seem a bit picky, but with good reason
  • Overall its a surprisingly speedy process

Staying up to date

Updating the code

git checkout master
git remote add upstream https://github.com/dotnet/corefx.git
git fetch upstream
git pull upstream master

remote: Counting objects: 1229, done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 1229 (delta 801), reused 804 (delta 801), pack-reused 425
Receiving objects: 100% (1229/1229), 334.41 KiB | 0 bytes/s, done.
Resolving deltas: 100% (832/832), completed with 228 local objects.
From https://github.com/dotnet/corefx
 * [new branch]            release/2.0.0           -> upstream/release/2.0.0

then clean and build again

./clean.sh -all
./build.sh
./build-tests.sh
clean.cmd -all
build.cmd
build-tests.cmd

and push to your forks master

git push

Counting objects: 475, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (134/134), done.
Writing objects: 100% (475/475), 78.06 KiB | 0 bytes/s, done.
Total 475 (delta 376), reused 413 (delta 320)
remote: Resolving deltas: 100% (376/376), completed with 206 local objects.
To https://github.com/jmezach/corefx.git
   7e3b0db289..94f284a30a  master -> master

What's happening?

  • After submitting your first PR you become a "collaborator"
  • This also signs you up for notifications on everything (DDoS on your mailbox), so you disable that
  • But what's happening in the repo?

Questions?

Resources

Contributing to .NET Core

By Jonathan Mezach

Contributing to .NET Core

A set of slides talking about my experience contributing to .NET Core.

  • 1,301