Search Issue Tracker

Won't Fix

Votes

0

Found in

2022.3.62f1

6000.0.50f1

6000.1.5f1

6000.2.0b3

6000.3.0a1

Issue ID

UUM-107583

Regression

Yes

SimpleWebServer.exe fails to launch with "System.IO.FileNotFoundException" error when running it as standalone executable

-

Reproduction steps:
1. Find the Editor installation folder (Make sure it has WebGL module installed)
2. Navigate to (Specific Editor Version)\Editor\Data\PlaybackEngines\WebGLSupport\BuildTools\
3. Right-click on any empty space
4. Select “Open in Terminal”
5. Type in “.\SimpleWebServer.exe”
6. Press Enter and observe the Console

Expected result: “usage: SimpleWebServer.exe [source_directory] [url?] [pid?]" log is shown
Actual result: “System.IO.FileNotFoundException : The file or assembly “System.Runtime, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” or one of its dependencies was not found. The system cannot find the specified file.” log is shown

Reproducible with: 2022.3.42f1, 2022.3.62f1, 6000.0.50f1, 6000.1.5f1, 6000.2.0b3
Not reproducible with: 2022.3.41f1

Reproducible on: Windows 11
Not reproducible on: No other environment tested

  1. Resolution Note:

    SimpleWebServer.exe is just a simple HTTP server app utilising `public class SimpleWebServer` from `Unity.WebGL.Extensions` assembly. The app was used to serve the Unity Web builds a long time ago, but at some point, we started using the same API directly from the Editor. This means that the app has gone unused by Unity for many years now, but we've kept it around as we've heard some users have found it useful. As an undocumented feature, I don't suggest relying on it for your development workflow.

    SimpleWebServer is not directly related profiling, that would be the `internal class WebsockifyEditorWrapper` in `Unity.WebGL.Extensions` assembly. This class starts node & websockify proxy server when a build is made. In practice this is achieved by calling `UnityEditor.WebGL.WebsockifyEditorWrapper.CreateIfNeeded()` (internal API).
    If you have already figured out how to start websockify on your own, I would recommend replacing `SimpleWebServer.exe` with some another HTTP server (personally I use Node.js's `http-server` or `emrun.py` most of the time), and continue using your workflow.

    Unity 6.3 will have improvements regarding profiling: Autoconnect Profiler build option is no longer required for profiling, and any Development build can be profiled. We will provide an example of how to connect to the Profiler in the Default and PWA Web templates. In addition, we will provide a new Web Profiling dialog which will explicitly (there's no need to make a build) start the websockify proxy server and provide its connection details, which can be easily copy-pasted into your web browser running the Unity Web build you wish to profile.

    If you still wish to continue using `SimpleWebServer.exe`, you can follow these instructions:
    - Make sure you have .NET Runtime 3.0.3 installed (https://dotnet.microsoft.com/en-us/download/dotnet/3.0 or `winget` should work well too if you familiar with that)
    - create a file called `SimpleWebServer.runtimeconfig.json` next to `SimpleWebServer.exe` (Admin rights needed) with the following content:
    ```
    {
    "runtimeOptions": {
    "framework": {
    "name": "Microsoft.NETCore.App",
    "version": "3.0.3"
    }
    }
    }
    ```
    - Start the server with `dotnet SimpleWebServer.exe`

Add comment

Log in to post comment