Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
8e08b36
Bump js-yaml in /src/ElectronNET.WebApp/ElectronHostHook
dependabot[bot] Sep 10, 2026
03e6e87
Bump image-size from 1.2.1 to 2.0.3 in /src/ElectronNET.Host
dependabot[bot] Sep 25, 2026
d7f02d7
Merge pull request #1112 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Sep 25, 2026
c98e1b4
Bump image-size from 1.2.1 to 2.0.3 in /src/ElectronNET.Host
dependabot[bot] Sep 25, 2026
3e7e99e
Merge pull request #1110 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Sep 25, 2026
2887f66
Merge pull request #1113 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Sep 25, 2026
ef46ea1
Bump image-size from 1.2.1 to 2.0.3 in /src/ElectronNET.Host
dependabot[bot] Sep 25, 2026
2b54521
Merge pull request #1114 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Sep 26, 2026
a9070c0
Bump engine.io from 6.6.9 to 6.6.11 in /src/ElectronNET.Host
dependabot[bot] Oct 1, 2026
96207c5
Bump brace-expansion from 1.1.16 to 1.1.21 in /src/ElectronNET.Host
dependabot[bot] Oct 1, 2026
4be4465
Bump engine.io in /src/ElectronNET.WebApp/ElectronHostHook
dependabot[bot] Oct 1, 2026
08b7521
Bump electron from 39.8.10 to 41.10.6 in /src/ElectronNET.Host
dependabot[bot] Oct 1, 2026
fa7c6d9
Merge pull request #1117 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Oct 1, 2026
426d983
Merge pull request #1115 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Oct 1, 2026
6751468
Merge branch 'develop' into dependabot/npm_and_yarn/src/ElectronNET.H…
FlorianRappl Oct 1, 2026
536a03e
Bump brace-expansion in /src/ElectronNET.WebApp/ElectronHostHook
dependabot[bot] Oct 18, 2026
2ec2292
Merge pull request #1119 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Oct 18, 2026
255e3cf
Fix dev launches passing the script file instead of the app directory
Denny09310 Oct 22, 2026
905e1bb
Merge pull request #1121 from Denny09310/feature/fix-dev-userdata-app…
FlorianRappl Oct 22, 2026
a7f14ff
fix(deps): drop deprecated Microsoft.SourceLink.GitHub 8.0.0
DYH1319 Oct 27, 2026
8ae9d6c
Merge pull request #1122 from DYH1319/fix/drop-deprecated-sourcelink
FlorianRappl Oct 27, 2026
cbcdaf6
Merge pull request #1116 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Oct 27, 2026
05aa92e
Merge pull request #1118 from ElectronNET/dependabot/npm_and_yarn/src…
FlorianRappl Oct 27, 2026
b6df028
fix(runtime): stop the socket bridge when it never connected
DYH1319 Nov 4, 2026
1a0f287
test(runtime): add lifecycle tests for the socket bridge and Lifetime…
DYH1319 Nov 4, 2026
12ca068
fix(host): restore image-size 1.x and repair the Host lockfile
DYH1319 Nov 5, 2026
6384f23
Merge pull request #1125 from DYH1319/fix/host-image-size-lock
FlorianRappl Nov 5, 2026
2e61124
Merge branch 'develop' into fix/socket-bridge-stop-unconnected
DYH1319 Nov 5, 2026
b8cf0c5
Merge pull request #1124 from DYH1319/fix/socket-bridge-stop-unconnected
FlorianRappl Nov 5, 2026
543dfd5
Update GitHub Actions to Node.js 24 versions
icnocop Nov 9, 2026
104e1b8
Fixed typo in Electron.cs
icnocop Aug 21, 2025
be79d54
Merge pull request #1126 from icnocop/patch-1
FlorianRappl Nov 10, 2026
52d42b8
Merge pull request #1127 from icnocop/update-actions-node24
FlorianRappl Nov 10, 2026
4eeb98a
Use nuget.org Trusted Publishing in Build and Publish workflow (#1129)
icnocop Nov 10, 2026
37f0aaa
Improved runners
FlorianRappl Nov 10, 2026
867a339
Fix dead Electron locales link in GetLocaleAsync docs
farisbasha Nov 18, 2026
68870f4
Merge pull request #1130 from farisbasha/docs/fix-locales-link
FlorianRappl Nov 18, 2026
ab21201
Implemented uspport for WebContentsView #957
FlorianRappl Nov 25, 2026
bb56c7c
Prepared for 0.7
FlorianRappl Nov 25, 2026
7ffe6f1
Merge pull request #1131 from ElectronNET/feature/webcontentsview
FlorianRappl Nov 25, 2026
98ba8b6
Updated changelog
FlorianRappl Nov 25, 2026
e957c6c
Added 3 more samples
FlorianRappl Nov 25, 2026
ef725de
Added enum converter to respect EnumMemberAttribute
AeonSake Nov 26, 2026
1c58cda
Update visibility and accessibility in sample files
FlorianRappl Nov 26, 2026
4a675cc
Added support for file drop #1002
FlorianRappl Nov 26, 2026
ee7bb60
Merge pull request #1133 from ElectronNET/feature/more-samples
FlorianRappl Nov 26, 2026
14c8e05
Enhance enum serialization in EnumMemberStringEnumConverter
FlorianRappl Nov 26, 2026
a72aeb0
Merge pull request #1132 from AeonSake/enum-fix
FlorianRappl Nov 26, 2026
b4fdaaf
Merge pull request #1134 from ElectronNET/feature/file-drop
FlorianRappl Nov 26, 2026
2d7cb78
Added download policy to Session to block or redirect downloads (#434)
FlorianRappl Nov 26, 2026
ac83ca4
Merge branch 'develop' of https://github.com/ElectronNET/Electron.NET…
FlorianRappl Nov 26, 2026
3fa1057
Updated sourcemap
FlorianRappl Nov 26, 2026
7dc571e
Fix JavaScript execution in SessionTests
FlorianRappl Nov 26, 2026
eeff0d0
Addressed review comments on download policy (#434)
FlorianRappl Nov 26, 2026
37bffe8
Merge branch 'feature/download-policy' of https://github.com/Electron…
FlorianRappl Nov 27, 2026
44ba85b
Merge pull request #1135 from ElectronNET/feature/download-policy
FlorianRappl Nov 27, 2026
81af869
Refactor CreateWebContentsViewAsync for better task handling
FlorianRappl Nov 27, 2026
5f0354c
Addressed review comments
FlorianRappl Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ Most parts in the Electron.NET project are fairly straight forward. Among these
7. Update the documentation to reflect any changes. (or document such changes in the original issue)
8. Push to your fork or push your issue-specific branch to the main repository, then submit a pull request against `develop`.

PR validation runs integration tests on Linux, Windows, and macOS (Intel and ARM64). A failing test marks its matrix job as failed; test results are still uploaded and aggregated, and the PR comment is published even when tests fail. Failed matrix jobs are automatically retried once.

Just to illustrate the git workflow for Electron.NET a little bit more we've added the following graphs.

Initially, Electron.NET starts at the `main` branch. This branch should contain the latest stable (or released) version.
Expand Down
17 changes: 14 additions & 3 deletions .github/workflows/Build and Publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}

concurrency:
group: build-publish-${{ github.ref }}
Expand All @@ -23,18 +22,30 @@ jobs:
timeout-minutes: 10
name: '2 / Publish'

permissions:
contents: write
id-token: write

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Setup dotnet
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.0.x
8.0.x
10.0.x

- name: NuGet login
id: nuget-login
uses: NuGet/login@v1
with:
user: ${{ secrets.NUGET_USER }}

- name: Build
env:
NUGET_API_KEY: ${{ steps.nuget-login.outputs.NUGET_API_KEY }}
run: |
if ($env:GITHUB_REF -eq "refs/heads/main") {
.\build.ps1 -Target Publish
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/PR Validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ jobs:
name: '3 / Build'

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Setup dotnet
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
6.0.x
Expand Down
27 changes: 11 additions & 16 deletions .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, macos-14, macos-15-intel, macos-26]
os: [ubuntu-22.04, ubuntu-24.04, windows-2022, windows-2025, macos-15-intel, macos-26]
electronVersion: ['30.4.0', '38.2.2']
include:
- os: ubuntu-22.04
Expand All @@ -26,8 +26,6 @@ jobs:
rid: win-x64
- os: windows-2025
rid: win-x64
- os: macos-14
rid: osx-arm64
- os: macos-15-intel
rid: osx-x64
- os: macos-26
Expand All @@ -41,15 +39,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup .NET
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'

- name: Setup Node.js
uses: actions/setup-node@v4
uses: actions/setup-node@v5
with:
node-version: '22'

Expand All @@ -72,7 +70,6 @@ jobs:

- name: Run tests (Linux)
if: runner.os == 'Linux'
continue-on-error: true
timeout-minutes: 15
run: |
mkdir -p test-results
Expand All @@ -85,23 +82,21 @@ jobs:

- name: Run tests (Windows)
if: runner.os == 'Windows'
continue-on-error: true
timeout-minutes: 15
run: |
New-Item -ItemType Directory -Force -Path test-results | Out-Null
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" --logger "console;verbosity=detailed" --blame-hang --blame-hang-timeout 5min --results-directory test-results

- name: Run tests (macOS)
if: runner.os == 'macOS'
continue-on-error: true
timeout-minutes: 15
run: |
mkdir -p test-results
dotnet test src/ElectronNET.IntegrationTests/ElectronNET.IntegrationTests.csproj -c Release --no-build -r ${{ matrix.rid }} -p:RuntimeIdentifier=${{ matrix.rid }} -p:ElectronVersion=${{ matrix.electronVersion }} --logger "trx;LogFileName=${{ matrix.os }}-electron-${{ matrix.electronVersion }}.trx" --logger "console;verbosity=detailed" --blame-hang --blame-hang-timeout 5min --results-directory test-results

- name: Upload raw test results
if: always()
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@v6
with:
name: test-results-${{ matrix.os }}-electron-${{ matrix.electronVersion }}
path: test-results/*.trx
Expand All @@ -122,12 +117,12 @@ jobs:

steps:
- name: Download all test results
uses: actions/download-artifact@v4
uses: actions/download-artifact@v7
with:
path: test-results

- name: Setup .NET (for CTRF conversion)
uses: actions/setup-dotnet@v4
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'

Expand Down Expand Up @@ -200,17 +195,17 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}

- name: Save PR Number
if: github.event_name == 'pull_request'
if: always() && github.event_name == 'pull_request'
run: echo "PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV

- name: Write PR Number to File
if: github.event_name == 'pull_request'
if: always() && github.event_name == 'pull_request'
run: echo "$PR_NUMBER" > pr_number.txt
shell: bash

- name: Upload PR Number Artifact
if: github.event_name == 'pull_request'
uses: actions/upload-artifact@v4
if: always() && github.event_name == 'pull_request'
uses: actions/upload-artifact@v6
with:
name: pr_number
path: pr_number.txt
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ jobs:

steps:
- name: Download CTRF artifact
uses: dawidd6/action-download-artifact@v8
uses: dawidd6/action-download-artifact@v17
with:
github_token: ${{ github.token }}
run_id: ${{ github.event.workflow_run.id }}
name: ctrf-report
path: ctrf

- name: Download PR Number Artifact
uses: dawidd6/action-download-artifact@v8
uses: dawidd6/action-download-artifact@v17
with:
github_token: ${{ github.token }}
run_id: ${{ github.event.workflow_run.id }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-wiki.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
publish-wiki:
runs-on: windows-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v5
- name: Remove level 1 headings from Markdown files
shell: bash
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/retry-test-jobs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
rerun-failed-matrix-jobs-once:
if: >
if: >-
${{
github.event.workflow_run.conclusion == 'failure' &&
github.event.workflow_run.run_attempt == 1
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trailing-whitespace-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0

Expand Down
20 changes: 20 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
# 0.7.0

## ElectronNET.Core

- Updated dependencies
- Updated infrastructure (#1127, #1129) @icnocop
- Improved documentation (#1130) @farisbasha
- Fixed typo in documentation (#1126) @icnocop
- Fixed startup failure with host lockfile (#1125) @DYH1319
- Fixed hanging host when Electron exists before bridge (#1124) @DYH1319
- Fixed dev mode launches passing the script file instead of the app directory (#1121) @Denny09310
- Added `window.electronNET.getPathForFile` to retrieve the path of dropped files in the renderer (#1002)
- Added support for `WebContentsView` as an alternative to `BrowserWindow` (#1131)
- Added `WebContentsView.DestroyAsync` / `Dispose` to close a view's web contents and release its resources
- Added `WindowManager.MainWindowRecreated` event, raised when the main window is recreated on macOS activation
- Added `Enum` converter to respect `EnumMemberAttributeenhancement` (#1132) @AeonSake
- Added support for file drop (#1134)
- Added `Session.SetDownloadPolicy` and events (`OnDownloadStarted`, `OnDownloadBlocked` and `OnDownloadDone`) to block or redirect downloads (#434)

# 0.6.0

## ElectronNET.Core
Expand All @@ -7,6 +26,7 @@
- Improved migration checks to honor custom output paths and to detect `ProjectGuid` in publish profiles (#946)
- Fixed single instance handling on macOS (#1040)
- Fixed slow socket bridge startup by binding to an explicit loopback address (#1103)
- Fixed local debugging launching the host `main.js` as a script file, which made Electron run its default app and resolve app name and userData to "Electron" instead of the app's `productName` (dev launch now points at the `.electron` app directory)
- Fixed socket bridge connection when a system proxy is configured (#1105)
- Fixed electron-builder using the host RID instead of the target RID (#1097)
- Fixed cross-compilation behavior on same platform (#1098) @epsnm
Expand Down
2 changes: 1 addition & 1 deletion docs/API/App.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Jump List settings for the application.
Jump List settings.

#### 🧊 `Task<string> GetLocaleAsync(CancellationToken cancellationToken = default)`
The current application locale. Possible return values are documented [here](https://www.electronjs.org/docs/api/locales).
The current application locale. Possible return values are documented [here](https://www.electronjs.org/docs/latest/api/app#appgetlocale).

Note: When distributing your packaged app, you have to also ship the locales folder.

Expand Down
19 changes: 19 additions & 0 deletions docs/API/WebContents.md
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,25 @@ webContents.OnMediaStartedPlaying += () => Console.WriteLine("Media playing");
webContents.OnMediaPaused += () => Console.WriteLine("Media paused");
```

### Controlling Downloads

`Session.SetDownloadPolicy` blocks downloads by file extension and can store allowed downloads in a fixed directory without a save dialog. The rules are evaluated inside the Electron host, so they apply to every download without a round trip to .NET. The policy belongs to the underlying Electron session, which by default is shared by all windows. Pass `null` to restore the default behavior.

```csharp
var session = browserWindow.WebContents.Session;

session.SetDownloadPolicy(new DownloadPolicy
{
BlockedExtensions = new[] { ".exe", ".msi", ".bat" },
// AllowedExtensions = new[] { ".pdf" }, // optional allow-list
SaveDirectory = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Downloads"),
});

session.OnDownloadBlocked += info => Console.WriteLine($"Blocked {info.Filename}");
session.OnDownloadStarted += info => Console.WriteLine($"Saving {info.Filename} to {info.SavePath}");
session.OnDownloadDone += info => Console.WriteLine($"{info.Filename}: {info.State}");
```

## Related APIs

- [Electron.WindowManager](WindowManager.md) - Windows containing web contents
Expand Down
2 changes: 1 addition & 1 deletion docs/GettingStarted/Console-App.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Add the Electron.NET configuration to your `.csproj` file:
</PropertyGroup>

<ItemGroup>
<PackageReference Include="ElectronNET.Core" Version="0.6.0" />
<PackageReference Include="ElectronNET.Core" Version="0.7.0" />
</ItemGroup>
```

Expand Down
4 changes: 2 additions & 2 deletions docs/Using/Debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Debug the Electron process when you need to inspect native Electron APIs:
"Electron (unpackaged)": {
"commandName": "Executable",
"executablePath": "node",
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron",
"commandLineArgs": "node_modules/electron/cli.js . -unpackedelectron",
"workingDirectory": "$(TargetDir).electron",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand Down Expand Up @@ -99,7 +99,7 @@ Add the debugging profiles to `Properties/launchSettings.json`:
"Electron (unpackaged)": {
"commandName": "Executable",
"executablePath": "node",
"commandLineArgs": "node_modules/electron/cli.js main.js -unpackedelectron",
"commandLineArgs": "node_modules/electron/cli.js . -unpackedelectron",
"workingDirectory": "$(TargetDir).electron",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
Expand Down
89 changes: 89 additions & 0 deletions docs/Using/File-Drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Getting File Paths (File Drop)

For security reasons, browsers do not expose the file system path of a `File` object, e.g., one obtained via drag and drop or an `<input type="file">` element. Electron provides [`webUtils.getPathForFile`](https://www.electronjs.org/docs/latest/api/web-utils#webutilsgetpathforfilefile) for this, but it is only accessible from a preload script.

Electron.NET registers a small preload script for every session, which exposes this function as `window.electronNET.getPathForFile`. It works regardless of the `NodeIntegration`, `ContextIsolation`, and `Sandbox` settings of the window, and it runs side by side with your own `WebPreferences.Preload` script.

`getPathForFile` returns an empty string for files that are not backed by the file system (e.g., created via `new File()`).

## Plain JavaScript

```html
<div id="drop-zone">Drop files here</div>

<script>
const dropZone = document.getElementById('drop-zone');

dropZone.addEventListener('dragover', (e) => e.preventDefault());

dropZone.addEventListener('drop', (e) => {
e.preventDefault();

for (const file of e.dataTransfer.files) {
const path = window.electronNET.getPathForFile(file);
console.log(path);
}
});
</script>
```

To process the paths in .NET, send them to the main process, e.g., via `ipcRenderer.send` (with node integration) and `Electron.IpcMain.On`, or post them to an endpoint of your ASP.NET Core app.

## Blazor

In Blazor, the `drop` event does not give you access to the `File` objects, so a small JavaScript helper is used to forward the paths to .NET:

```javascript
// wwwroot/js/fileDrop.js
window.registerFileDrop = (element, dotNetRef) => {
element.addEventListener('dragover', (e) => e.preventDefault());
element.addEventListener('drop', (e) => {
e.preventDefault();
const paths = Array.from(e.dataTransfer.files)
.map((file) => window.electronNET.getPathForFile(file))
.filter((path) => path);
dotNetRef.invokeMethodAsync('OnFilesDropped', paths);
});
};
```

```razor
@inject IJSRuntime JS
@implements IDisposable

<div @ref="dropZone" class="drop-zone">Drop files here</div>

<ul>
@foreach (var path in paths)
{
<li>@path</li>
}
</ul>

@code {
private ElementReference dropZone;
private DotNetObjectReference<FileDropZone>? selfRef;
private string[] paths = [];

protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
selfRef = DotNetObjectReference.Create(this);
await JS.InvokeVoidAsync("registerFileDrop", dropZone, selfRef);
}
}

[JSInvokable]
public void OnFilesDropped(string[] droppedPaths)
{
paths = droppedPaths;
StateHasChanged();
}

public void Dispose() => selfRef?.Dispose();
}
```

> [!NOTE]
> Dropping a file anywhere outside an element that calls `preventDefault()` on `dragover` / `drop` makes Electron navigate to that file. Handle these events on `document` if you want to prevent this globally.
Loading
Loading