Code Monkey home page Code Monkey logo

try's Introduction

Try .NET dotnet bot in space

|| Contribution Guidelines || Table of contents || Customers & Partners ||

Try_.NET Enabled

Build Status

Welcome to the Try .NET repo.

Try .NET provides developers and content authors with tools to create interactive experiences.

There are two different Try .NET interactive experiences:

Online, powered by Blazor

Microsoft Learn uses Try .NET to create interactive documentation. Users can run and edit code all in the browser.

Please Note: At the moment, the Try .NET online (trydotnet.js API) is currently only used internally at Microsoft as seen on Learn and .NET page.

Interactive .NET Core documentation with the dotnet try global tool

Try .NET enables .NET developers to create interactive markdown files. To make your markdown files interactive, you will need the .NET Core 3.0 SDK, the dotnet try global tool and Visual Studio / VS Code (or any other editor of your choice).

Table of Contents

Contribution Guidelines

As we are still in the early stages of our development, we are unable to take any feature PRs at the moment, but we intend to do so in the future. If you find an issue or have a feature suggestion, please open an issue. And if you have any feature suggestions, please submit them using the "community suggestions" label.

Customers & Partners

Microsoft Learn

Microsoft Learn uses Try .NET to create interactive documentation. Users can run and edit .NET code in the browser.

Community Showcase

NCache Live by Alachisoft

NCache Live uses Try .NET to let the user experience NCache APIs with the help of executable and editable .NET code in the browser.

try's People

Contributors

abhitejjohn avatar akoeplinger avatar akshita31 avatar ax0l0tl avatar billwagner avatar brettfo avatar cartermp avatar colombod avatar dalehhirt avatar daxian-dbw avatar dependabot[bot] avatar dotnet-bot avatar dotnet-maestro[bot] avatar dsyme avatar eerhardt avatar jonsequitur avatar jwmunn avatar kevinransom avatar ladynaggaga avatar morganwm avatar msynk avatar ocalles avatar ocallesp avatar snebdev avatar talanc avatar thomaslevesque avatar tihan avatar yamachu avatar zawhtut avatar zhiliangxu 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  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

try's Issues

Working in Firefox but not in Chrome

Here is what the console says when I try the first example in https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/foreach-in

{type: "HIDE_EDITOR"}
mscomdocs.style.app.css:14 {type: "CONFIGURE_CLIENT", client: t}
mscomdocs.style.app.css:14 {type: "NOTIFY_HOST_PROVIDED_CONFIGURATION", configuration: {…}}
mscomdocs.style.app.css:14 {type: "NOTIFY_HOST_LISTENER_READY"}
mscomdocs.style.app.css:14 {type: "LOAD_CODE_REQUEST", from: "default"}
mscomdocs.style.app.css:14 {type: "LOAD_CODE_SUCCESS", sourceCode: "using System;??public class Program?{? public sta…ole.WriteLine("Hello!");? }?}??Program.Main();??"}
mscomdocs.style.app.css:14 {type: "SET_CODE", sourceCode: "int[] fibarray = new int[] { 0, 1, 1, 2, 3, 5, 8, … Output:?// 0?// 1?// 1?// 2?// 3?// 5?// 8?// 13"}
mscomdocs.style.app.css:14 {type: "CONFIGURE_MONACO_EDITOR", editorOptions: {…}, theme: "vs-light"}
mscomdocs.style.app.css:14 {type: "SHOW_EDITOR"}
mscomdocs.style.app.css:14 {type: "NOTIFY_MONACO_READY", editor: t}
mscomdocs.style.app.css:14 {type: "RUN_CODE_REQUEST"}

mscomdocs.style.app.css:14 POST https://try.dot.net/workspace/workspaceId/compile?hostOrigin=https%3A%2F%2Fdocs.microsoft.com 400 (Bad Request)
(anonymous) @ mscomdocs.style.app.css:14
t.fetch @ mscomdocs.style.app.css:14
value @ mscomdocs.style.app.css:14
(anonymous) @ mscomdocs.style.app.css:14
(anonymous) @ mscomdocs.style.app.css:14
(anonymous) @ mscomdocs.style.app.css:14
postMessage (async)
DotNetOnline.run @ global.min.js?v=276:4791
(anonymous) @ global.min.js?v=276:4685
Promise resolved (async)
activateCodeBlock @ global.min.js?v=276:4678
activateCodeBlock @ global.min.js?v=276:4625
(anonymous) @ global.min.js?v=276:3712
mscomdocs.style.app.css:14 {type: "RUN_CODE_FAILURE", ex: Error: FetchError: {"type":"default","status":400,"ok":false,"statusText":"Bad Request","headers":{"…}
global.min.js?v=276:4822 timeout
(anonymous) @ global.min.js?v=276:4822
Promise rejected (async)
DotNetOnline.run @ global.min.js?v=276:4817
(anonymous) @ global.min.js?v=276:4685
Promise resolved (async)
activateCodeBlock @ global.min.js?v=276:4678
activateCodeBlock @ global.min.js?v=276:4625
(anonymous) @ global.min.js?v=276:3712

{type: "RUN_CODE_FAILURE", ex: Error: FetchError: {"type":"default","status":400,"ok":false,"statusText":"Bad Request","headers":{"…}
global.min.js?v=276:4822 timeout
(anonymous) @ global.min.js?v=276:4822
Promise rejected (async)
DotNetOnline.run @ global.min.js?v=276:4817
(anonymous) @ global.min.js?v=276:4685
Promise resolved (async)
activateCodeBlock @ global.min.js?v=276:4678
activateCodeBlock @ global.min.js?v=276:4625
(anonymous) @ global.min.js?v=276:3712

global.min.js?v=276:4822 timeout
(anonymous) @ global.min.js?v=276:4822
Promise rejected (async)
DotNetOnline.run @ global.min.js?v=276:4817
(anonymous) @ global.min.js?v=276:4685
Promise resolved (async)
activateCodeBlock @ global.min.js?v=276:4678
activateCodeBlock @ global.min.js?v=276:4625
(anonymous) @ global.min.js?v=276:3712

.Net Editor

I can't run nor edit code, the system says...

The service is temporarily unavailable. We are working on it.

Save code

Hi,

Please add support for save/rebase code, preferably adding accounts code are associated with.

Provide clear feedback for code timeouts

Currently, long-running code snippets can time out without any apparent user feedback. The response code is a 503. This should be replaced with some clear indication of a timeout and a response code that distinguishes this from a service availability issue.

Service temporarily unavailable

when I was trying to run my code on C# online compiler then it not running and says that ""This service is temporarily unavailable"

Code Modification

There is a problem after running the code, if you want to modify the code e.g add or remove code, you cant write anything, its blocked, the only way to activate the code editor is by right clicking and and cut, that activates code editor to keep adding or removing code. So might want to fix that.

Increase page margin

The web interface only takes advantage of half the height of the screen.

image

Please expand it to the actual window size.

Numbers in C# Step 5

Hi!
Whilst doing Numbers in C#, step 5.

The question is to calculate the area of a circle.

i've got the following code:
`double radius=2.15;
double pi = Math.PI;
double oppervlakte = pi * (radius * radius);
Console.WriteLine("De oppervlakte van de circel is: {0}", oppervlakte);

when i submit this code, it gives an invalid value.
Because the IDE on the web gives me as answer:
De oppervlakte van de circel is: 14.5220120412188

Whilst, i submit this code in my VStudio it gives the answer:
De oppervlakte van de circel is: 19,6349540849362

`

503 on every invocation of a specific program

#r "System.Security.Cryptography.X509Certificates"
using System;
using System.Security.Cryptography.X509Certificates;
using System.Security.Cryptography;

var key = ECDsa.Create();
var request = new CertificateRequest("CN=Test", key, HashAlgorithmName.SHA256);
var cert = request.CreateSelfSigned(DateTimeOffset.Now, DateTimeOffset.Now.AddMinutes(50));

Console.WriteLine("Cert:" + System.Convert.ToBase64String(cert.Export(X509ContentType.Pfx)));

C# Intellisense

Would it be viable to get proper C# Intellisense like in VS Code? Assuming you're building this on the Monaco editor, wouldn't it be adding the language service?

code is not editable

Once i run a code in editor it runs...but after that when i need to run other code old code doesn't edit

C# Quick starts fail on Safari

I tried to run the first hello World quick start using Safari on Mac. It consistently fails.

One try had this request ID: Request-Id: |29027195-4d151a5e318c6cd6.1.2.106.1.

The failures are consistent for any of the examples.

/cc @LadyNaggaga @piotrpMSFT @jonsequitur

Chrome: Editor is unresponsive to highlighting after first action

Selecting text does not work in Chrome 63.0.3239.132 (macOS) after you do it once.

Repro steps:

  • Highlight a line of text in web editor
  • Change focus from highlighted line (to another area in text editor or outside of the editor scope, doesn't make a difference)
  • Not able to highlight another line of text or cursor actions begin to behave sporadically in editor

"error" in the In-Browser Tutorial

In the In-Browser Tutorial I encounter the following "error"
Code :
int what = max + 3;
Console.WriteLine($"An example of overflow: {what}");

Error message:
(1,12): error CS0103: The name 'max' does not exist in the current context

Do more with strings

Copy and paste, if the user has not cleared the .NET Editor do more with strings section of the tutorial there is a conflict in the variable declaration message it is duplicated with the past operation. When exploring additional methods we should just need the additional Writelines .

Site is not crawler friendly

No description when I search for "try dot net" in Bing. Which will put some folks off trying it.

image

Google the same

image

I assume this is because of https://try.dot.net/robots.txt blanket disallow:

User-agent: *
Disallow: /

Perhaps there's a way to "Allow" some file that the search engines would use for a description: or possibly you could just stop disallowing them?

Suggestion: Allow users to specify which .net version they want to work in

You should allow users to specify the .net version they wish to work in.

The wide matrix of ,net versions will be confusing to new users. You should allow users to specify whether they wish to work in .net core, standard, 4.5, etc.

You can make this choice unobtrusive so that novice users can just try stuff, but you should also allow users to specify a .net version

Type Casting Error (decimal)Math.PI

double radius = 2.50;
double area = Math.PI * radius * radius;
Console.WriteLine(area);

This error occurred when I want to solve problem in decimal "error CS0019: Operator '*' cannot be applied to operands of type 'decimal' and 'double"

decimal radius = 2.50M;
decimal area = (decimal)Math.PI * radius * radius;
Console.WriteLine(area);

See what library namespaces are available - valid usings

It would be nice to know what valid library namespaces are available. For example I tried using System.Net.Http but it was not available. Instead of having to try what I can use and can't use it would be useful to have a searchable list somewhere.

Add namespaces needed for globalization

As I add reference docs, I find that a couple additional namespaces should be imported for ease of use:

using System.Threading; // For Thread.CurrentThread.CurrentCulture
using System.Globalization; // for lots of globalization types

Calling certain methods break output

Paste this code into the editor. No output at all.
Comment out the "var c = t.GetConstructor" line. Now there's output.

There are React errors in the console.

class C {
  public string T;
  public string F;
}

var t = typeof (C);

foreach (var m in t.GetMembers()) {
  if (m.MemberType == System.Reflection.MemberTypes.Field) {
    System.Console.WriteLine(m.Name);
    System.Console.WriteLine(t.GetField(m.Name).FieldType);
  }
}

var c = t.GetConstructor(new Type[]{});

Include `System.Threading.Tasks` to the standard namespaces

It's not convenient to create samples that use modern TAP based async work because the System.Threading.Tasks namespace is not included by default. That could lead people to use older APIs instead of the async and await based protocol.

I had a conversation on email about this with @TheRealPiotrP that this change would make the default interactive experience different than the local experience for Visual Studio or dotnet CLI users. Should this concept be expanded to update the default list of imported namespaces in the C# templates for Visual Studio and dotnet new. /cc @KathleenDollard @Pilchie

Error squiggles are not cleared when error is corrected

When squiggles indicate a compile error, correcting the error doesn't always clear the issue. In the example shown in the screen shot, I typed:

var x = hello();
Console.WriteLine(x);

and hit the Run button. This caused the squiggle to appear under the hello invocation. Adding the method declaration allowed the code to execute successfully but the squiggle remained.

image

Enable cache-busting for try.dot.net assets

try.dot.net takes advantage of browser caching to speed up load times, but does not have a cache busting strategy in place. Some changes now require Ctrl+F5 in order to load on client machines. This should be done automatically through version strings in resource request URLs or some similar mechanism.

Keyboard shortcuts

Please introduce some keyboard shortcuts for basic actions, such as run (preferably F5 - overriding browsers behavior to avoid accidental refresh), etc.

Suggestion: Provide help for people coming from different languages

Allow users to specify that they are coming from another language java, javascript, etc, Then provide language specify pointers when users language features that are different in their language. This would be especially helpful when the same syntax yield different results or where there is a way to do something in one language that is easy but different in another.

For example:

the || javascript operator is roughly equivalent to the C# ?? operator.

If someone indicates they are coming from JS, and they make write something like
Console.WriteLine(firstName || lastName)

recognize the issue and suggest ??.

Horizontal scrollbar is nonfunctional

As I create a lengthy line, I can see my text as I write off the page (with the window scrolling to the right as it should), but the start of the line cannot be viewed by moving the horizontal scrollbar as expected. Arrow keying my cursor to the left is a workaround.
Microsoft Edge 41.16299.15.0
Zoom at 150%

Default code snippet has inconsistent brace placement

The initial code snippet uses { both on the same line and on a separate line. Feel like it should be consistent here.

Full snippet:

using System;
using System.Linq;

public class Program
{
  public static void Main()
  {
    // !!! NEW LINE !!!
    foreach (var i in Fibonacci().Take(20))
    {
      Console.WriteLine(i);
    }
  }

  private static IEnumerable<int> Fibonacci()
  {
    int current = 1, next = 1;

    // !!! SAME LINE !!!
    while (true) {
      yield return current;
      next = current + (current = next);
    }
  }
}

EDIT Url is https://try.dot.net/

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.