GithubHelp home page GithubHelp logo

tareqimbasher / netpad Goto Github PK

View Code? Open in Web Editor NEW
1.1K 14.0 60.0 10.64 MB

A cross-platform C# editor and playground.

License: MIT License

C# 39.25% TypeScript 50.88% JavaScript 0.48% HTML 6.27% SCSS 2.91% Dockerfile 0.03% Shell 0.17%
csharp editor playground database dotnet electron ide roslyn aurelia desktop

netpad's Introduction

NetPad

A cross-platform C# editor and playground.

build CodeQL

Get Started

NetPad is a C# playground that lets you run C# code instantly, without the hassle of creating and managing projects. Open NetPad, start coding, hit Run, and see your output immediately. It's that simple.

  • Prototyping and Testing: Quickly prototype and test code snippets before incorporating them into your projects.
  • Data Visualization: Visualize data interactively for better insights and analysis.
  • Database Queries: Query databases using LINQ or SQL effortlessly.
  • Learn and Experiment: Experiment with new C# features or start learning C# in an intuitive and accessible environment.
  • Utility Scripts: Create and save your own utility or administration scripts for repeated use.

See Features.

If you like this project, please star it 🌟 and consider contributing.

Motivation

We love LINQPad, but we miss its tremendous utility when working on non-Windows platforms. This project aims to create an open-source, web-enabled, cross-platform alternative.

The goal isn't to reach 100% feature parity with LINQPad, but to offer an effective alternative that covers features most commonly used and to introduce a few new useful ones.

Requirements

The following must be installed to use NetPad:

Additional requirements only if you plan to create and use database connections:

Download

Download the latest version for free!

For folks on Arch Linux or Manjaro, you can also install it from the AUR.

On macOS see this if you have trouble opening NetPad.

Updates

NetPad automatically checks for updates each time you start the application and will notify you when a new version is available.

Currently, automatic updates are not supported, but this feature will be added to make updating as seamless as possible. Stay tuned for future updates!

The latest version can be downloaded from the Releases page.

Wiki

The Wiki is a great place to find more information about NetPad.

Troubleshooting

See the Troubleshooting section of the Wiki.

Contribution

All Pull Requests, feedback and contributions are welcome!

Also a special thanks to the NetPad's wonderful sponsors. Sponsorships help pay for macOS builds and helps me maintain this project.

mattjcowan    lpreiner    jdonohoo    ChristopherHaws    smashedtoatoms    pelsedyr   

If you enjoy using NetPad and would like to support its continued development, consider sponsoring the project. A small contribution, like the cost of a cup of coffee ($5) per month, helps immensely with maintenance and the addition of new features. Thank you for your support! ❤️

Join our Discord server to collaborate with the community.

Features 🚀

  • The basics:
    • Write, save and run your own scripts
    • Manage namespaces
    • Standard code editor features powered by Monaco editor
    • Auto-open unsaved scripts from previous session on launch
  • Dump complex objects to the results console
  • Export results to Excel or HTML
  • Choose the .NET SDK version you want to use per script
  • Add database connections and query them with LINQ
  • Run SQL queries
  • Add NuGet packages
  • Reference assemblies from disk
  • Syntax Tree Visualizer
  • User-defined results styling
  • Monaco Editor & OmniSharp offer an editor experience similar to Visual Studio Code:
    • Code Completion (Intellisense)
    • Semantic Highlighting
    • CodeLens
    • Inlay Hints
    • Hover for Documentation
    • Go-to implementation
    • Find References
    • Find Symbol
    • Rename Symbol
    • Action Suggestions
    • Diagnostics
    • Document Highlighting
    • Contextual code folding
    • Format document/selection/on-type

Roadmap 🚧

  • Debugging
  • Support for more database providers
  • Hyperlink driven Lazy-loading of results, and a DataGrid view
  • Benchmark your code
  • Referencing other scripts
  • IL Visualizer
  • Export a script as a "ready to run" .NET app
  • Export a script as a C# project
  • Ability to run a script from the command-line
  • Git tracking of script changes
  • Quality of Life:
    • Workspaces/Sessions
  • Plugins & Theming




Tech Stack 💻

How it works

NetPad runs an ASP.NET web app that hosts a web-based user interface. It can be packaged as an Electron desktop app or served and accessed on any browser.

Communication between the user interface and the ASP.NET backend occurs via HTTP and SignalR.

Build

This section describes how to build and run NetPad from source. NetPad can be run as an Electron desktop app or as a web application accessed with a web browser.

Requirements

  • Node v16+ (npm v8+)
  • .NET SDK 7.x
  • EF Core tools 5.x or later

NetPad as an Electron desktop app

1. Run the SPA

# Install dependencies
cd src/Apps/NetPad.Apps.App/ElectronHostHook
npm install

cd ../App
npm install

# Start the development web server
npm start

2. Run the .NET app

Install the Electron.NET CLI tool:

dotnet tool install ElectronNET.CLI -g

Start the app:

cd src/Apps/NetPad.Apps.App

# Start in watch mode (remove '/watch' to run without watch mode)
electronize start /watch /manifest electron.manifest.dev.js

# For macOS ARM, append the following to the 'electronize start' command
/target custom "osx-arm64;mac" /electron-arch arm64
Note

Only the very first electronize start is slow. Later runs are much faster.

NetPad as a Web app (accessed from a browser)

1. Run the SPA

# Install dependencies
cd Apps/NetPad.Apps.App/App
npm install

# Start the development web server
npm run start-web

2. Run the .NET app

cd Apps/NetPad.Apps.App
dotnet watch run --environment Development

and access the app via your web browser, ex: http://localhost:57930

Packaging 📦

The Electron app is built and packaged using electron-builder. Configuration is in the electron.manifest.js file.

Build the app for the desired platform from the root directory of the NetPad.Apps.App project:

# For x64:
electronize build /target win /manifest electron.manifest.js /PublishSingleFile false
electronize build /target osx /manifest electron.manifest.js /PublishSingleFile false
electronize build /target linux /manifest electron.manifest.js /PublishSingleFile false

# For macOS ARM:
electronize build /target custom "osx-arm64;mac" /electron-arch arm64 /manifest electron.manifest.js /PublishSingleFile false

Packaged files can be found in the bin/Desktop folder.

Notes
  1. To build flatpak files the flatpak and flatpak-builder packages need to be installed.
  2. On Linux, the /scripts/package-electron.sh script can be used > to package the Electron app, in which case packaged files can be found in > the /dist/ folder.

See the Electron.NET docs for additional CLI options when packaging the app, and electron-builder for additional configuration options.

Resources 📚:

  • Docs: Go
  • More on SPA app startup and running tests: Go

netpad's People

Contributors

dependabot[bot] avatar jsamse avatar jwallet avatar obaidaalhaasan avatar p-de-jong avatar tareqimbasher 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

netpad's Issues

Is there a way to output raw html to the output window for formatting?

I've tried various things such as:

new RawScriptOutput("<i>asdf</i>").Dump();
new HtmlScriptOutput("<i>asdf</i>").Dump();

But these introspect the object and render as if they were arbitrary objects. I guess this isn't the intended usage.

Looking for something similar to RawHtml() in LP.

Dump not working inside Main Method

I'm Using Netpad 0.4.2 on MacOS

Output from Console.WriteLine works

but Dump is not working

class Tech
{
    public int Id { get; set; }
    public string Name { get; set; }
}

class Startup
{
    public static void Main()
    {
        var t = new Tech
        {
            Id = 1,
            Name = "Test Name"
        };

        Console.WriteLine("Output");
        t.Dump();
    }
}

Any chance of getting pre-built binaries?

Could we get some pre-built binaries? Even if they are artifacts of the github action that would be ok. I can't seem to get the project to build locally.

electronize build /target win /manifest electron.manifest.js /PublishSingleFile false
Build Electron Application...
Arguments:
        target = win
        manifest = electron.manifest.js
        PublishSingleFile = false
Build ASP.NET Core App for win-x64...
Executing dotnet publish in this directory: C:\dev\github\NetPad\src\Apps\NetPad.Apps.App\obj\desktop\win
Build ASP.NET Core App for win-x64 under Release-Configuration...
dotnet publish -r win-x64 -c "Release" --output "C:\dev\github\NetPad\src\Apps\NetPad.Apps.App\obj\desktop\win\bin" /p:PublishReadyToRun=true /p:PublishSingleFile=false --self-contained
dotnet publish -r win-x64 -c "Release" --output "C:\dev\github\NetPad\src\Apps\NetPad.Apps.App\obj\desktop\win\bin" /p:PublishReadyToRun=true /p:PublishSingleFile=false --self-contained
MSBuild version 17.4.0+18d5aef85 for .NET
  Determining projects to restore...
  All projects are up-to-date for restore.
  O2Html -> C:\dev\github\NetPad\src\External\O2Html\bin\Release\net6.0\O2Html.dll
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\Settings.cs(10,12): warning CS8618: Non-nullable property 'Version' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\Settings.cs(10,12): warning CS8618: Non-nullable property 'ScriptsDirectoryPath' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\Settings.cs(10,12): warning CS8618: Non-nullable property 'AutoSaveScriptsDirectoryPath' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\Settings.cs(10,12): warning CS8618: Non-nullable property 'PackageCacheDirectoryPath' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\Settings.cs(10,12): warning CS8618: Non-nullable property 'Appearance' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\Settings.cs(10,12): warning CS8618: Non-nullable property 'Editor' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\Settings.cs(10,12): warning CS8618: Non-nullable property 'Results' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\Settings.cs(10,12): warning CS8618: Non-nullable property 'OmniSharp' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\EditorOptions.cs(7,12): warning CS8618: Non-nullable property 'MonacoOptions' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\OmniSharpOptions.cs(11,12): warning CS8618: Non-nullable property 'Diagnostics' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\Configuration\OmniSharpOptions.cs(11,12): warning CS8618: Non-nullable property 'InlayHints' must contain a non-null value when exiting constructor. Consider declaring the property as nullable. [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
C:\dev\github\NetPad\src\Core\NetPad.Domain\IO\ProcessHandler.cs(94,30): warning CS0168: The variable 'ex' is declared but never used [C:\dev\github\NetPad\src\Core\NetPad.Domain\NetPad.Domain.csproj]
  NetPad.Domain -> C:\dev\github\NetPad\src\Core\NetPad.Domain\bin\Release\net6.0\NetPad.Domain.dll
  NetPad.Compilation -> C:\dev\github\NetPad\src\Core\NetPad.Compilation\bin\Release\net6.0\NetPad.Compilation.dll
  NetPad.InMemoryScriptRuntime -> C:\dev\github\NetPad\src\Infrastructure\ScriptRuntimes\NetPad.InMemoryScriptRuntime\bin\Release\net6.0\NetPad.InMemoryScriptRuntime.dll
  NetPad.Application -> C:\dev\github\NetPad\src\Core\NetPad.Application\bin\Release\net6.0\NetPad.Application.dll
  NetPad.Presentation -> C:\dev\github\NetPad\src\Core\NetPad.Presentation\bin\Release\net6.0\NetPad.Presentation.dll
  NetPad.Infrastructure -> C:\dev\github\NetPad\src\Infrastructure\NetPad.Infrastructure\bin\Release\net6.0\NetPad.Infrastructure.dll
  OmniSharp.NET -> C:\dev\github\NetPad\src\External\OmniSharp.NET\bin\Release\netstandard2.1\OmniSharp.NET.dll
  NetPad.Web -> C:\dev\github\NetPad\src\Infrastructure\NetPad.Web\bin\Release\net6.0\NetPad.Web.dll
C:\dev\github\NetPad\src\Infrastructure\ScriptRuntimes\NetPad.ExternalProcessScriptRuntime\ScriptRuntimeServices.cs(7,31): warning CS8618: Non-nullable field '_defaultConsoleOutput' must contain a non-null value when exiting constructor. Consider declaring the field as nullable. [C:\dev\github\NetPad\src\Infrastructure\ScriptRuntimes\NetPad.ExternalProcessScriptRuntime\NetPad.ExternalProcessScriptRuntime.csproj]
  NetPad.ExternalProcessScriptRuntime -> C:\dev\github\NetPad\src\Infrastructure\ScriptRuntimes\NetPad.ExternalProcessScriptRuntime\bin\Release\net6.0\NetPad.ExternalProcessScriptRuntime.dll
  NetPad.Electron -> C:\dev\github\NetPad\src\Infrastructure\NetPad.Electron\bin\Release\net6.0\NetPad.Electron.dll
  NetPad.Plugins.OmniSharp -> C:\dev\github\NetPad\src\Plugins\NetPad.Plugins.OmniSharp\bin\Release\net6.0\NetPad.Plugins.OmniSharp.dll
  NetPad.Apps.App -> C:\dev\github\NetPad\src\Apps\NetPad.Apps.App\bin\Release\net6.0\win-x64\NetPad.Apps.App.dll

  up to date, audited 1069 packages in 2s

  121 packages are looking for funding
    run `npm fund` for details

  6 high severity vulnerabilities

  To address all issues (including breaking changes), run:
    npm audit fix --force

  Run `npm audit` for details.

  > build
  > rimraf dist && webpack --env production

  Run info:
     Environment: production
     Target: electron
  assets by path *.js 6.57 MiB
    assets by chunk 195 KiB (id hint: vendors)
      asset 665.270ca4fd3552015cefc4.bundle.js 39.6 KiB [emitted] [immutable] [minimized] (id hint: vendors) 1 related asset
      asset 5377.827b384e58cbef5a1308.bundle.js 34.1 KiB [emitted] [immutable] [minimized] (id hint: vendors) 1 related asset
      asset 5288.e1df5ceb341be95433e9.bundle.js 33.5 KiB [emitted] [immutable] [minimized] (id hint: vendors) 1 related asset
      asset 8401.c512ca671f3001b316c2.bundle.js 22.3 KiB [emitted] [immutable] [minimized] (id hint: vendors)
      asset 1156.4486bf557a5dc271495d.bundle.js 18.2 KiB [emitted] [immutable] [minimized] (id hint: vendors) 1 related asset
      + 3 assets
    + 76 assets
  assets by chunk 603 KiB (auxiliary name: entry)
    asset 422cfe2813b03d900c10.ttf 381 KiB [emitted] [immutable] [from: node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.ttf] (auxiliary name: entry)
    asset 64d495f582d4a1590a6c.woff2 151 KiB [emitted] [immutable] [from: node_modules/@fortawesome/fontawesome-free/webfonts/fa-solid-900.woff2] (auxiliary name: entry)
    asset b797181c93b3755f4fa1.ttf 70.8 KiB [emitted] [immutable] [from: node_modules/monaco-editor/esm/vs/base/browser/ui/codicons/codicon/codicon.ttf] (auxiliary name: entry)
  asset favicon.ico 118 KiB [emitted]
  asset index.html 330 bytes [emitted]
  orphan modules 4.34 MiB [orphan] 634 modules
  runtime modules 11.5 KiB 13 modules
  built modules 11.7 MiB (javascript) 603 KiB (asset) [built] 618 modules
  webpack 5.74.0 compiled successfully in 52844 ms
  NetPad.Apps.App -> C:\dev\github\NetPad\src\Apps\NetPad.Apps.App\obj\desktop\win\bin\


Start npm install...
npm install --production
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated [email protected]: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)

added 69 packages, and audited 70 packages in 2s

found 0 vulnerabilities


ElectronHostHook handling started...
Build Electron Desktop Application...
Executing electron magic in this directory: C:\dev\github\NetPad\src\Apps\NetPad.Apps.App\bin\desktop
Create electron-builder configuration file...
node build-helper.js electron.manifest.js


Package Electron App for Platform win...
npx electron-builder --config=./bin/electron-builder.json --win --x64 -c.electronVersion=13.1.5
  • electron-builder  version=23.6.0 os=10.0.22621
  • loaded configuration  file=C:\dev\github\NetPad\src\Apps\NetPad.Apps.App\obj\desktop\win\bin\electron-builder.json
  ⨯ Invalid configuration object. electron-builder 23.6.0 has been initialized using a configuration object that does not match the API schema.
 - configuration.linux.target[2] has an unknown property 'depends'. These properties are valid:
   object { target, arch? }
     How to fix:
     1. Open https://www.electron.build/configuration/linux
     2. Search the option name on the page (or type in into Search to find across the docs).
       * Not found? The option was deprecated or not exists (check spelling).
       * Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.
  failedTask=build stackTrace=ValidationError: Invalid configuration object. electron-builder 23.6.0 has been initialized using a configuration object that does not match the API schema.
 - configuration.linux.target[2] has an unknown property 'depends'. These properties are valid:
   object { target, arch? }
     How to fix:
     1. Open https://www.electron.build/configuration/linux
     2. Search the option name on the page (or type in into Search to find across the docs).
       * Not found? The option was deprecated or not exists (check spelling).
       * Found? Check that the option in the appropriate place. e.g. "title" only in the "dmg", not in the root.



                                                                      at validate (C:\Users\cribs\AppData\Local\npm-cache\_npx\009083ec26dc578f\node_modules\@develar\schema-utils\dist\validate.js:86:11)
    at Object.validateConfig (C:\Users\cribs\AppData\Local\npm-cache\_npx\009083ec26dc578f\node_modules\app-builder-lib\src\util\config.ts:240:3)
    at Packager._build (C:\Users\cribs\AppData\Local\npm-cache\_npx\009083ec26dc578f\node_modules\app-builder-lib\src\packager.ts:342:5)
    at Packager.build (C:\Users\cribs\AppData\Local\npm-cache\_npx\009083ec26dc578f\node_modules\app-builder-lib\src\packager.ts:337:12)
    at Object.executeFinally (C:\Users\cribs\AppData\Local\npm-cache\_npx\009083ec26dc578f\node_modules\builder-util\src\promise.ts:12:14)


... done

error during scaffolding

I just installed netpad version 0.4 on macos, and then installed the .NET7 SDK and later tried installing the 6 as well. In both cases though it fails to scaffold against my postgresql database with the error:

System.Exception: Scaffolding process failed with exit code: 1. Errors: Specify --help for a list of available options and commands.
Unrecognized option '--namespace'
   at NetPad.Data.EntityFrameworkCore.Scaffolding.EntityFrameworkDatabaseScaffolder.RunEfCoreToolsAsync() in /home/tips/Source/TIPS/NetPad/src/Infrastructure/NetPad.Infrastructure/Data/EntityFrameworkCore/Scaffolding/EntityFrameworkDatabaseScaffolder.cs:line 160
   at NetPad.Data.EntityFrameworkCore.Scaffolding.EntityFrameworkDatabaseScaffolder.ScaffoldAsync() in /home/tips/Source/TIPS/NetPad/src/Infrastructure/NetPad.Infrastructure/Data/EntityFrameworkCore/Scaffolding/EntityFrameworkDatabaseScaffolder.cs:line 59
   at NetPad.Data.EntityFrameworkCore.Scaffolding.EntityFrameworkDatabaseScaffolder.ScaffoldAsync() in /home/tips/Source/TIPS/NetPad/src/Infrastructure/NetPad.Infrastructure/Data/EntityFrameworkCore/Scaffolding/EntityFrameworkDatabaseScaffolder.cs:line 69
   at NetPad.Data.EntityFrameworkCore.EntityFrameworkResourcesGenerator.GenerateSourceCodeAsync(DataConnection dataConnection, DotNetFrameworkVersion targetFrameworkVersion) in /home/tips/Source/TIPS/NetPad/src/Infrastructure/NetPad.Infrastructure/Data/EntityFrameworkCore/EntityFrameworkResourcesGenerator.cs:line 61
   at NetPad.Data.DataConnectionResourcesCache.<>c__DisplayClass11_0.<<GetSourceGeneratedCodeAsync>b__0>d.MoveNext() in /home/tips/Source/TIPS/NetPad/src/Core/NetPad.Application/Data/DataConnectionResourcesCache.cs:line 80
--- End of stack trace from previous location ---
   at NetPad.Scripts.ScriptEnvironment.AppendDataConnectionResourcesAsync(RunOptions runOptions, DataConnection dataConnection) in /home/tips/Source/TIPS/NetPad/src/Core/NetPad.Application/Scripts/ScriptEnvironment.cs:line 98
   at NetPad.Scripts.ScriptEnvironment.RunAsync(RunOptions runOptions) in /home/tips/Source/TIPS/NetPad/src/Core/NetPad.Application/Scripts/ScriptEnvironment.cs:line 62

The same seems to be happening on version 0.3.1

uncaught exception on startup - non-standard network interfaces

I just installed the software for the first time. I am using Windows 11. At startup the software is immediately dying with an EACCES exception that appears to be failure to set up a listener.

See image...
2023-11-11_11-31-14

I got to wondering. I run into issues with my own code unless I isolate and use REAL network interfaces. I have VMWare Workstation and Virtual Box installed. Their virtual interfaces for host-only networks cause issues. So I disabled them. Didn't fix it. Then I also disabled the Bluetooth network. The software started right up.
2023-11-11_11-40-54

Just letting you know.

[Resolved] Netpad doesn't open on Mac ARM

I'm trying to run the recent version supporting mac arm but it stuck while opening. Even it doesn't quit when right click and press quit. I need to use force quit.

image

Azure.Identity (azure cli / homebrew) support on Mac OS

When trying to use Azure.Identity it fails to use azure cli

Unhandled exception. Azure.Identity.CredentialUnavailableException: DefaultAzureCredential failed to retrieve a token from the included credentials. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/defaultazurecredential/troubleshoot

  • EnvironmentCredential authentication unavailable. Environment variables are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/environmentcredential/troubleshoot
  • WorkloadIdentityCredential authentication unavailable. The workload options are not fully configured. See the troubleshooting guide for more information. https://aka.ms/azsdk/net/identity/workloadidentitycredential/troubleshoot
  • ManagedIdentityCredential authentication unavailable. Multiple attempts failed to obtain a token from the managed identity endpoint.
  • Visual Studio Token provider can't be accessed at /Users//.IdentityService/AzureServiceAuth/tokenprovider.json
  • Azure CLI not installed
  • PowerShell is not installed.
  • Azure Developer CLI could not be found.

short fix include homebrew bin and sbin in PATH:
Environment.SetEnvironmentVariable("PATH", $"/opt/homebrew/bin:/opt/homebrew/sbin:{Environment.GetEnvironmentVariable("PATH")}");

Maybe add option to Settings to add Homebrew or Azure Cli folder path

Netpad equivalent of "SubmitChanges()"?

Hi @tareqimbasher !

I am so happy I stumbled across NetPad recently. Since moving to Linux, I've dearly missed LINQPad, and your re-implementation makes me feel less homesick :)

I have a dumb question -- what is the equivalent of the global SubmitChanges() in NetPad? How do I save changes after I've made modifications to an entity? There doesn't seem to be a global DbContext instance that I can access.

Thanks again for making this amazing software!

macOS Window Conventions

On macOS, the close, minimise, and maximise buttons appear on the left side of a window's title bar, and menu items appear within the system menu bar rather than within the application's window. It'd be great if NetPad could be made to feel more at-home on macOS by following these conventions.


Image: NetPad above and VS Code below

Thanks for making this though, it's a very useful utility :)

[Linux] Does not launch on Linux with error FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable

Issue

Running NetPad on some Linux environments results in the app crashing with an error:

[300044:0103/022825.743082:FATAL:gpu_data_manager_impl_private.cc(415)] GPU process isn't usable. Goodbye.

This appears to be an issue exhibited by a number of Electron-based apps:

Workaround

Until this is fixed, a workaround is to run with the --no-sandbox option. ie:

netpad --no-sandbox

or you can modify /usr/share/applications/netpad.desktop and add --no-sandbox to Exec like this:

[Desktop Entry]
Name=NetPad
Exec=/opt/NetPad/netpad --no-sandbox %U

Other useful information can be found in the linked issues above.

Note

If you ran NetPad and it crashed because of this, the app might still be running in the background. Kill the app process(es) using your task manager before attempting to run it again.

SqlClient PlatformNotSupported_DataSqlClient

Very excited about this app! Went ahead and installed it on my x86 mac running macOS 13.4.1 with dotnet version 6.0.301 and efcore tools 7.0.9. I'm able to connect to my local Sql Server running in a docker container and can view the db schema in the left hand pane. When I try to run a LINQ query against that database I get the following error. Have I not configured things correctly somehow?

System.PlatformNotSupportedException: Strings.PlatformNotSupported_DataSqlClient
   at Microsoft.Data.SqlClient.SqlConnectionStringBuilder..ctor(String connectionString)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.<>c.<get_IsMultipleActiveResultSetsEnabled>b__7_0(String cs)
   at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
   at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.get_IsMultipleActiveResultSetsEnabled()
   at Microsoft.EntityFrameworkCore.SqlServer.Query.Internal.SqlServerCompiledQueryCacheKeyGenerator.GenerateCacheKey(Expression query, Boolean async)
   at Microsoft.EntityFrameworkCore.Query.Internal.QueryCompiler.Execute[TResult](Expression query)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryProvider.Execute[TResult](Expression expression)
   at Microsoft.EntityFrameworkCore.Query.Internal.EntityQueryable`1.System.Collections.IEnumerable.GetEnumerator()
   at O2Html.Common.LazyEnumerable.Enumerate[T](IEnumerable collection, Nullable`1 maxItemsToEnumerate, Action`2 action)
   at O2Html.Converters.CollectionHtmlConverter.Convert[T](T obj, Type type, SerializationScope serializationScope, HtmlSerializer htmlSerializer)
   at O2Html.Converters.CollectionHtmlConverter.WriteHtml[T](T obj, Type type, SerializationScope serializationScope, HtmlSerializer htmlSerializer)
   at O2Html.HtmlSerializer.Serialize[T](T obj, Type type, SerializationScope serializationScope)
   at O2Html.HtmlConvert.Serialize[T](T obj, HtmlSerializerSettings htmlSerializerSettings)
   at NetPad.Html.HtmlSerializer.Serialize(Object output, String title, Boolean isError)

Omnisharp server fails to start

Just installed NetPad on Pop!_OS, getting an error: "OmniSharp Server failed to start".

image

Message from log file:

2023-09-21T14:23:00.7769721+02:00 [ERR] (PID: 101725|NetPad.Plugins.OmniSharp.Services.OmniSharpServerCatalog) Error occurred starting OmniSharp server
System.PlatformNotSupportedException: OS Architecture 'X64' is not supported. OS: (Linux 6.4.6-76060406-generic #202307241739~1694621917~22.04~ac5e1a8 SMP PREEMPT_DYNAMIC Wed S)
   at NetPad.Utilities.PlatformUtil.IsOsArchitectureSupported(Boolean throwIfNotSupported) in /home/tips/Source/TIPS/NetPad/src/Core/NetPad.Domain/Utilities/PlatformUtil.cs:line 38
   at NetPad.Plugins.OmniSharp.Services.OmniSharpServerDownloader.DownloadAsync(OSPlatform platform) in /home/tips/Source/TIPS/NetPad/src/Plugins/NetPad.Plugins.OmniSharp/Services/OmniSharpServerDownloader.cs:line 50
   at NetPad.Plugins.OmniSharp.Services.OmniSharpServerDownloader.DownloadAsync(OSPlatform platform) in /home/tips/Source/TIPS/NetPad/src/Plugins/NetPad.Plugins.OmniSharp/Services/OmniSharpServerDownloader.cs:line 93
   at NetPad.Plugins.OmniSharp.Services.OmniSharpServerLocator.GetServerLocationAsync() in /home/tips/Source/TIPS/NetPad/src/Plugins/NetPad.Plugins.OmniSharp/Services/OmniSharpServerLocator.cs:line 41
   at NetPad.Plugins.OmniSharp.Services.AppOmniSharpServer.StartOmniSharpServerAsync() in /home/tips/Source/TIPS/NetPad/src/Plugins/NetPad.Plugins.OmniSharp/Services/AppOmniSharpServer.cs:line 132
   at NetPad.Plugins.OmniSharp.Services.AppOmniSharpServer.StartAsync() in /home/tips/Source/TIPS/NetPad/src/Plugins/NetPad.Plugins.OmniSharp/Services/AppOmniSharpServer.cs:line 87
   at NetPad.Plugins.OmniSharp.Services.OmniSharpServerCatalog.<>c__DisplayClass7_1.<<StartOmniSharpServerAsync>b__1>d.MoveNext() in /home/tips/Source/TIPS/NetPad/src/Plugins/NetPad.Plugins.OmniSharp/Services/OmniSharpServerCatalog.cs:line 108

Ctrl+R throws error

Hey there! I am so used to pressing ctrl+r to show/hide the results window in LINQPad, I accidently keep calling it in NetPad (I know it is the reload shortcut). Everytime I press it, I get the following error:

image

Any chance we can get ctrl+r to show/hide the results instead of reloading the browser window?

Thanks! :)

Database Connections

Allow users to add database connections. As a start, we'll support the following database providers. More providers to be added soon after:

  • Microsoft SQL Server
  • PostgreSQL

We want to have the following features available at a minimum:

  • 1. Add, edit, remove and test a database connection
  • 2. Use a database connection in a query and be able to run all common EF Core actions (inserts, delete, selects...etc)
  • 3. Show generated T-SQL in a SQL tab in output console
  • 4. Protect connection passwords so they aren't persisted in an unprotected format
  • 5. Add helper queries to a context menu the user can chose from when right-clicking a connection in the sidebar
  • 6. Allow user to override the OnConfiguring method of the generated DatabaseContext in a script
  • 7. OmniSharp integration

Help!! NetPad fails to launch on my Mac

Machine: MacBook Pro
Chip: Apple M2 Max
Memory: 96GB
OS: Ventura 13.2.1

I have downloaded the latest version of the zip on my Mac (M2).
image

After unzipping and clicking on the app I get the following dialog!!

image

I've tried downloading multiple times in case the zip was corrupted, but get the same dialog.

I have the following .NET SDKs installed
image

Please advise

Unable to find dotnet on Linux

Hey,
I am trying to install NetPad on my linux machine (I am still relatively new to Linux) and i basically have the same problem as described in this issue #42.
I think that everything should be configured correctly (I can run "dotnet" and "dotnet ef" without any problems)
image
image

When i open NetPad I get missing dependencies popup and it tries to run the "dotnet" and "dotnet ef" command in my browser:
image

The dotnet-ef tool is not functioning properly on NetPad on macOS.

I've already set up the .NET SDK and installed the dotnet-ef tool. It runs fine in the local command line. However, on the App Dependencies Check page, it shows that the .NET SDK is installed successfully, but dotnet-ef displays "Entity Framework Core .NET tool is not installed."
image
image
image
image
image

.Dump() causes stack overflow when dumping objects that have long or infinite property chains

Accidentally stumbled on this trying to .Dump() a bad DirectoryInfo:

new DirectoryInfo("boguspath").Dump();  // On Mac if that makes a difference

Similar results can be seen with this arbitrary example.

new Foo().Dump();

public class Foo
{
    public Foo Parent { get { return new Foo(); } }
}

Reference tracking isn't properly catching these cases, and there doesn't appear to be anything limiting .Dump() depth. Output window shows stack overflow with really long stack trace first time but eventually the application hangs. Similar applications has a setting for max depth (default in settings or argument to Dump()).

Example output:
Stack overflow.-------------------------------- at NetPad.Html.HtmlSerializer.Serialize(System.Object, System.String) at O2Html.HtmlConvert.Serialize[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, O2Html.HtmlSerializerSettings)-------------------------------- at ExternalProcessOutputWriter+<WriteAsync>d__4.MoveNext() at O2Html.HtmlSerializer.Serialize[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, System.Type, O2Html.SerializationScope) at ScriptRuntimeServices.ResultWrite(System.Object, System.String) at System.Runtime.CompilerServices.AsyncMethodBuilderCore.Start[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon ByRef) at Extensions.Dump[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, System.String) at ExternalProcessOutputWriter.WriteAsync(System.Object, System.String)Repeat 10235 times: at O2Html.Converters.ObjectHtmlConverter.WriteHtml[[System.__Canon, System.Private.CoreLib, Version=7.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e]](System.__Canon, System.Type, O2Html.SerializationScope, O2Html.HtmlSerializer) at Program.<Main>$(System.String[])

Latest release seems broken

Hi,

I'm new to this project, so please forgive my ignorance.

I've download NetPad for Mac (both versions). The ARM version refused to start ("This app is damaged and cannot be opened").

The x64 version does run but fails on the most basic operation (see screenshot below)

Screenshot 2023-07-25 at 00 56 12

I don't have a lot of other info to share at this moment, just wanted to raise the issue I encountered trying out the project. I have every major .NET SDK installed on this machine.

Regards

Login into a server/ grouping

Any plans to allow login into a server, rather than just a specific DB?
Then just perform the scaffolding when a database within it is selected?

We have a lot of databases, so it's quiet time consuming setting up a new connection for each one.
Also gets quite messy with all the tests and prod database together without the ability sort things in folders.

Azure data studio does a pretty good job at it -
image

Allow running unsafe code

Discussed in #95

Originally posted by carlos-truong October 3, 2023
When I run unsafe code in NetPad, I receive this error:
[Error] Unsafe code may only appear if compiling with /unsafe

Is there any way to allow unsafe code in NetPad?

[Mac] "Meta" / Cmd key not working for keyboard shortcuts

I've tried with Ctrl+Enter on Mac and it works properly. Appears to be a Meta/Cmd button issue.

Based on the below, I think the proper way to handle it in Mac would be to give "Run" (and other commands) proper menu bar support and then map them that way, rather than mapping them in the browser window, which seems to be a shortcoming in mac that doesn't allow Cmd to be registered as a browser window listener.

https://github.com/electron/electron/blob/main/docs/tutorial/keyboard-shortcuts.md

electron/electron#5188 (comment)

Screenshot 2023-11-25 at 9 54 24 AM

Native support?

Does it support natively Silicon chips? It seems there is on x64 version for macs.

Add Blazor support

Would it be possible to support Blazor, so that we can test Blazor pages or components ?
Thank's

Scaffolding postgre database failed: Could not compile data connection assembly

Hello,

It seems that NP cannot compile my database: Postgre 14
If I open my postgre database in LinkPad it works (windows), if I do the same in NetPad (macos) it can't. I also tested my connection and it succeeded. Not sure what I'm missing, maybe this part is failing :

image

[500] PATCH: http://localhost:57930/data-connections/34e80e5e-b87c-4416-b060-ddfa9e9db4e3/database-structure
{
  details: null,
  message: "Could not compile data connection assembly. Compilation failed with the following diagnostics: \n(39,26): error CS0246: The type or namespace name 'Equipment_HIDDEN' could not be found (are you missing a using directive or an assembly reference?)"
}

[Mac] Mac Design Patterns

Some menu item locations are incorrect based on Mac design patterns, as well as default shortcuts.

For example, "Settings" should always be in the named dropdown (ex. "NetPad") and should always have the default shortcut of "Cmd + ," (⌘ ,). This may require registering the Settings (called Preferences until 2 versions ago) in a special way, I'm not sure.

Screenshot 2023-11-25 at 10 23 33 AM

Pop-up choice order should be updated:

Please see the below images (one from VS Code, one from NetPad). Generally on Mac the "confirm" and "deny" are grouped, with "cancel" separate.

Screenshot 2023-11-25 at 10 06 28 AM Screenshot 2023-11-25 at 10 06 21 AM

Here are a few links that I found:

Sorry I got off on a tangent a little bit with the links. Just trying to maybe save you some time by going down the rabbit hole myself :)

Unable to find dotnet on macOS

Hey, I am trying to use NetPad on my M1 macbook pro but it keeps telling me that .NET 6 is not installed or not on my path, but I have verified that it is installed and is in my path.

image

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.