Giter Club home page Giter Club logo

workbooks's Introduction

Xamarin Workbooks

Gitter

Xamarin Workbooks provide a blend of documentation and code that is perfect for experimentation, learning, and creating guides and teaching aids.

Create a rich C# workbook for .NET Core, Android, iOS, Mac, or WPF, and get instant live results as you learn these APIs. Workbooks also have access to the vast NuGet package ecosystem to make learning new APIs a breeze.

Resources

Download

Documentation

Provide Feedback

Continuous Integration Status

Service macOS Windows Linux
VSTS
AppVeyor
Travis

Build & Run

Ensure git submodules are up-do-date:

git submodule sync
git submodule update --recursive --init

Now simply run:

msbuild /restore

Or for the strict .NET Core subset:

dotnet build

Configuring the Build

The top-level build system can be driven either by the system msbuild or by the installed .NET Core SDK dotnet build. When using dotnet build, only projects that can run on .NET Core will be built.

Additionally, the build can be shaped via profiles. Any number of profiles may be selected. By default, all profiles will be selected.

Profiles

Profiles are specified via the MSBuild Profile property and may be combined with a + delimiter:

msbuild /restore /p:Profile=Console+Web
Name Description Minimum Dependencies
Web Build the ASP.NET Core Workbooks server .NET Core ≥ 2.1, Node.js ≥ 8.10, Yarn ≥ 1.5.1
Console Build the Console client .NET Core ≥ 2.1
Desktop Build the macOS or Windows desktop client Visual Studio 2017 ≥ 15.6

Note: Support for Xamarin platforms will be detected automatically and built if available. On macOS, the "macOS" platform (Xamarin.Mac) must be installed to build the client. Xamarin/mobile is entirely optional on Windows.

Properties

Many properties that can be specified on the command line will be persisted for subsequent runs. For example:

# "Configure" and perform initial build:
msbuild /restore \
  /p:Profile=Web \
  /p:Configuration=Release \
  /p:WithoutXamarin=true

# Rebuild with the same configuration as above, implied
# thanks to _build/Configuration.props:
msbuild

The following properties will persist and do not need to be specified on the command line on subsequent runs:

Name Description Default Value
Profile The set of profiles to build Web+Console+Desktop
Configuration The build configuration (Debug or Release) Debug
Environnment:
WithoutXamarin A shortcut for setting all HaveXamarin* properties below to false unset
HaveXamarinMac Whether or Xamarin.Mac is available to the build auto-detected
HaveXamarinIos Whether or Xamarin.iOS is available to the build auto-detected
HaveXamarinAndroid Whether or Xamarin.Android is available to the build auto-detected
External Tools:
NuGet Path to nuget.exe resolved via PATH
Node Path to node resolved via PATH
Yarn Path to yarn resolved via PATH
Npm Path to npm resolved via PATH

Windows Nuances

If you want to build a Release build on Windows (for example, you want to build an installer), you will need to build in a slightly different fashion. First, make sure that you connect to a Mac build host via Visual Studio at least once. You can do this by doing the following:

  • Open Visual Studio
  • Go to Tools → Options → Xamarin → iOS Settings
  • Click "Find Xamarin Mac Agent"
  • Select a Mac on your network, or add one by name
  • Enter credentials when prompted

Once the connection completes, click OK to close all the dialogs. Then, build the Release configuration by running the following:

msbuild \
  /p:MacBuildHostAddress="<hostname-or-ip-of-your-mac>" \
  /p:MacBuildHostUser="<mac-username>" \
  /p:Configuration=Release /t:Build,Install

This is needed because the installer build now needs a zipped copy of the Xamarin.iOS workbook app from the server. The Xamarin.Workbooks.iOS project will do the build and copy automatically when a Mac build host is used. If you are building in Debug, you can omit those properties unless you need the Workbook app to be copied locally, in which case, include them there as well.

Note: the build will read properties from Build/Local.props as well, for example:

<Project>
  <PropertyGroup>
    <MacBuildHostAddress>porkbelly</MacBuildHostAddress>
    <MacBuildHostUser>aaron</MacBuildHostUser>
  </PropertyGroup>
</Project>

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Notices

Telemetry

Official builds and releases of Xamarin Workbooks & Inspector from Microsoft collect usage data and send it to Microsoft to help improve our products and services. Read our privacy statement to learn more.

Users may opt out of telemetry and usage data collection from the Preferences dialog.

Non-Microsoft builds do not enable telemetry collection at all.

Third Party Code

Xamarin Workbooks & Inspector incorporates open source code from external projects. See ThirdPartyNotices.txt for attribution.

workbooks's People

Contributors

abock avatar bytesguy avatar lewing avatar mrgeoserge avatar sandyarmstrong avatar yamachu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

workbooks's Issues

Add token/key store API and UI

Add some kind of global API like Keystore ["DocumentDB"] that would allow workbook authors a nice way to indicate to Workbooks that the user needs to provide some kind of auth key/token/whatever for the workbook to be functional.

We could use Roslyn to intercept the call to this API and prompt for/look up an already stored key and return it (e.g. the method/indexer/property call would simply be rewritten in the AST as a const string after the user responds to the UI, etc.)

iOS Coordinate Mapper not working with non-5s devices

Steps to Reproduce

  1. Open a Xamarin.iOS app in VSmac.
  2. Deploy to any non-5s simulator.
  3. Try to use view picker.

Expected Behavior

Views highlight as you hover over them. Clicking a view selects it in the Inspector.

Actual Behavior

Total no-op.


Xcode 9 introduced new simulator chrome as well as the ability to run multiple simulators simultaneously.

We updated iOSSimulatorCoordinateMapper to handle these new options, but made a mistake. Although currently Workbooks always uses the iPhone 5s simulator, the Inspector cannot control the device being used and needs to support all devices.

So, we need to not filter out non-5s devices.

Additionally, we should introduce a way for the IDE (or the agent) to communicate to the Inspector client which simulator is being used so we can pick the right one if multiple devices are running.

#r typing is slow on Mac Console workbooks

This needs to be confirmed. Was reported in Slack by @chkn at the end of June:

@chkn I'm trying to build a quick workbook, but every letter I press takes seconds 😞
@chkn Mac, 1.3 alpha 2, console
@chkn I have what appears to be a consistent repro here

@sandyarmstrong I've never seen laggy input on Mac. Consistent repros are awesome if you can give us the steps

@chkn it's while typing the path in #r .. I'm not sure if it's related to the actual directory it's in or not

@sandyarmstrong thanks. when you are typing in #r, we are doing a fair bit of searching for matching assemblies. It's possible we regressed on some of our optimizations there
@sandyarmstrong do you have time to file a bug?
@sandyarmstrong actually I'll just make a trello card

Distribute Inspector with IDE extensions instead of in Workbooks installer

Although Workbooks and Inspector clients are based on the same code, distributing them together is no longer helpful. The Inspector client and necessary agent files should be distributed with the the Inspector extension itself (which is already shipped as part of the Visual Studio Enterprise products), not with the Workbooks installers.

The current plan is to still build the Inspector client and the various agents out of the Workbooks git repo, but the build output for them would change into a NuGet package that the IDE extensions could consume.

Since this would add up to 100MB or so to each IDE's on-disk footprint, we need to get approval from IDE leads.

Additionally, we would want to keep shipping Inspector files in our installers until after the bundled Inspector IDE work hit the stable release channel.

Add File → Quit or File → Close All

Ideally this would merge all save prompts into one dialog. Closing several unsaved workbooks using the taskbar's "close all windows" is not a fun experience.

Handle SubmissionExecutionStatus.Interrupted explicitly

Right now we just show the "agent terminated while evaluating" error message if we abort evaluation. We should instead [again] use/handle SubmissionExecutionStatus.Interrupted and show "evaluation was aborted" or something.

#define NETSTANDARD2_0, IOS, ANDROID, etc on CSharpParseOptions

We should automatically define preprocessor symbols on the submissions that map to the workbook's agent type and also standard target framework symbols:

https://docs.microsoft.com/en-us/dotnet/standard/frameworks

Examples

Agent Type Implicit #define
DotNetCore NETCOREAPP2_0, NETSTANDARD2_0
Console NET461 , NETSTANDARD2_0
iOS __IOS__, __MOBILE__, __UNIFIED__, NETSTANDARD2_0
Android __ANDROID__, __MOBILE__, NETSTANDARD2_0
MacMobile __MACOS__, __MOBILE__, NETSTANDARD2_0
MacDesktop __MACOS__, NETSTANDARD2_0
Wpf __WPF__, NET461, NETSTANDARD2_0

Implicit code-behind `.csx` files per page

Given a .workbook file, implicitly reference a similarly named .csx file if it exists. For example, SomePage.workbook would implicitly #load "SomePage.csx" if it exists.

3D View: cmd/ctrl + mouse scroll for zoom

Currently, you can zoom the 3D view on Mac with trackpad pinch, and on Windows you can use mouse drag plus some modifiers.

It would be nice if cmd+scrollwheel on Mac and ctrl+scrollwheel on Windows worked, like they do in most web browsers.

Audit Xamarin.Mac code for attaching to synthesized events; use full delegate pattern

Upgrading our build to Xcode 9 resulted in a number of surprises - notably every time we save our storyboard, most objects in the storyboard now explicitly instantiate a delegate.

This is problematic in Xamarin.Mac when using synthesized events - subscribing to a synthesized event results in Xamarin.Mac setting a proxy delegate to power the event raising. In the case where Xcode or event Cocoa (targeting the 10.13 SDK) provides a default delegate, Xamarin.Mac will throw an exception on event subscription because it cannot set the backing delegate.

While this seems to be an issue in Xcode/10.13/Xamarin.Mac, we should just avoid using C# events and use our own delegate implementations.

A number of known ones have been fixed, but there may still be more. We should manually audit the Mac code.

Raise SourceTextContainer.TextChanged on the next buffer

Cell 1

var x = 10

Cell 2

Console.WriteLine (x + y)

This results in an editor squiggly in Cell 2 against y. Now go back to Cell 1 and define y. As Cell 1 is being edited and y is defined, Cell 2 should reflect this. We need to chain the SourceTextContainer.TextChanged even to also raise it on the next cell until there are no more cells.

Allow users to pick their preferred iOS/Android device

Users want to be able to pick their preferred device instead of being forced into an iPhone 5s (for example). It should also be possible to change the device for a workbook while it is running.

This work was mostly completed in an old branch, but was put on hold and needs to be rebased and finished.

Need to also make sure that our iOS workbook app works as expected on iPad.

Monaco: fix completion case sensitivity issue

Console.be prefers NumberLock over Beep because of the casing. This is a regression in master compared to 1.1, and is presumably due to the Monaco bump.

@sandyarmstrong I wonder if microsoft/vscode@c02a8d0#diff-c736a6665daa725bb10fa992c14c5f81L152 is the culprit.

@sandyarmstrong Might be able to fix just by changing filtertext and/or sorttext for the completion items.

@sandyarmstrong Maybe related, long and haven't read through yet: microsoft/vscode#26096

Fix WPF inspection

Inspector needs us to ship Xamarin.Interactive.Wpf.dll in the same folder as the client EXE, even though the client no longer depends on that assembly. That's just where the Inspector extension knows to look for the WPF agent assembly.

Fully split individual workbook app support out of the client

There are a few goals here:

  1. Begin defining the API a third party would use to provide their own workbook apps.
  2. Break up our build so that identical components (such as the Android app and iOS app) do not have to take up build time on both Mac and Windows.
  3. Make it possible to ship a smaller installer, and download large workbooks apps on-demand.
  4. Allow us to ship a larger variety of workbook apps without worrying about bloating the installer.

There is a proof-of-concept branch that needs to be updated and migrated to the new repository. It begins the work of bundling workbook apps with their client support assemblies in NuGet packages, which would allow us to use NuGet as our distribution platform for workbook apps.

The proposed layout for such a NuGet package is:

/
  xamarin.workbooks/
    app/
      net45/ (typically able to share app everywhere)
      mac/ (use these if necessary)
      win64/
    client-support/ (AgentProcess, coord mapper, etc)
      net45/ (more likely to have these split)
      mac/
      win64/

The workbookapp.json file would be in xamarin.workbooks/app/{platform}/, and would make use of the appManagerAssembly property to name the client integration assembly that should be loaded from xamarin.workbooks/client-support/{platform}/.

Ideally we would move public API into Xamarin.Interactive.dll from Xamarin.Interactive.Client.dll, to prevent having multiple assemblies with public API.

Meta: NuGet UI Revamp

This is a meta issue that will probably result in several pull requests, and may get split up into additional issues.

It is time to implement a complete NuGet package management experience within Workbooks. We will take our inspiration from Visual Studio, where package management and search all happen from one rich UI.

The idea is to give users more information about the packages they install (before and after installation), to keep their workbooks updated, and to better warn them of package issues that are unique to Workbooks.

Package Manager (to replace current search UI)

Package list

  • Title
  • Author
  • Download stats
  • Installed version
  • Latest available version
  • Description
  • Icon
  • Overlay icon to indicate install/update status

Package details

  • Uninstall button
  • Update/install button
  • Change version dropdown (actionable via Update button)
  • Description
  • Version
  • Authors
  • License
  • Date published
  • Project URL
  • Report Abuse URL
  • Tags
  • Dependency list

Other Changes

Workbooks sidebar changes

  • Show package dependency tree like VS
  • Allow updating packages from sidebar, all or individually (and restart workbook app afterwards)
  • Show package install/load errors in sidebar. Auto-expand nodes when errors occur.

Behavior

  • We allow installing packages that don't bring in any references on this platform, since workbooks can change their target platform at any time. When this happens, warn the user. See https://forums.xamarin.com/discussion/comment/294918/#Comment_294918
    • One suggestion is to add error state to the sidebar tree, and auto-expanding nodes when errors occur.
    • Could also show a warning in the status area
  • Eliminate #r code cells that are currently required to bring in NuGet assembly references.

Under the hood

Inspect view "toolbar" button often missing

@lewing mentions that it might happen if trying to switch from workbook tab to inspect view tab before the visual tree comes in from the agent.

Still happening with master on 6/20/2017. Does not require multiple workbooks. It might be more common if I switch tabs while code is executing but I'm not sure. I usually end up using the view menu to refresh the visual tree @lewing

Allow for not rendering [optional] parameters with default values in `help`

The output of help could use some work when rendering methods with long signatures. Particularly signatures that have parameters with default values. Consider collapsing these. For instance:

public static Task<Image> ImageAsync (Stream stream, CancellationToken cancellationToken = default (CancellationToken))

Might render in help as

Task<Image> ImageAsync (Stream stream,)

IntelliSense will actually show the full member completion.

iOS: default to iPhone X simulator

We currently default to an iPhone 5S simulator. We should move this forward to iPhone X now that we require Xcode 9.

This is independent of device switching (#21).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.