You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

HoloLens模拟器中含SharingService的网络应用无法运行求助

Troubleshooting NetworkingHololens App Crash on HoloLens Simulator

Let’s walk through diagnosing and fixing this crash issue with your NetworkingHololens app (and other network-enabled apps) that fails right after the "Made with Unity" screen. Since non-network apps run fine, the problem is almost certainly tied to network-related configuration or your SharingService implementation.

First, Dig Into Your Crash Logs (You mentioned updating logs—let’s use them)

  • Scan logs for keywords like SharingService, NetworkException, Socket, or PermissionDenied. You can access HoloLens simulator logs via the Device Portal: connect to the simulator’s IP, navigate to System > Event Viewer > Applications and Services Logs > Unity.
  • If you spot Access Denied errors, this is likely a missing capability issue—Unity’s SharingService needs specific network permissions to run.

Verify UWP Capabilities in Unity

Your app requires the right network permissions to use SharingService. Here’s how to check:

  1. In Unity, go to Edit > Project Settings > Player > Windows > Publishing Settings > Capabilities.
  2. Make sure these are checked:
    • InternetClient (required for outgoing network connections)
    • PrivateNetworkClientServer (critical if you’re using local network sharing, which is standard for HoloLens collaboration)
    • Add Bluetooth or Proximity if your setup uses those local protocols.
  3. Rebuild your UWP project after enabling these—capabilities only take effect when you generate the package.

Audit SharingService Initialization Code

Common missteps here cause crashes:

  • Initialize the SharingService after the app fully loads (avoid Awake()—use Start() or a coroutine that waits for network readiness).
  • Don’t run blocking network calls on the main thread—wrap them in async/await or use Unity’s non-blocking patterns.
  • Example of safe initialization:
    async void Start()
    {
        // Wait for network connectivity to stabilize
        while (!(NetworkReachability.ReachableViaLocalAreaNetwork || NetworkReachability.ReachableViaInternet))
        {
            await Task.Delay(1000);
        }
        
        try
        {
            SharingService.Instance.Initialize();
            // Add your cube control logic here
        }
        catch (Exception ex)
        {
            Debug.LogError($"SharingService init failed: {ex.Message}");
        }
    }
    

Simulator-Specific Checks

HoloLens simulator has unique network quirks to address:

  • Ensure the simulator is on the same network as your development machine, or enable "Shared Networking" in the simulator’s settings.
  • Temporarily disable firewalls on your dev machine—they often block traffic to/from the simulator.
  • Reset the simulator if state corruption is suspected: Go to HoloLens Simulator > Settings > System > Recovery > Reset This PC (choose to keep your files).

Test with a Minimal Reproducible Project

If the above steps don’t resolve the issue, create a tiny test app:

  • A blank Unity project with only SharingService initialized and a simple cube.
  • Build and run it on the simulator. If it crashes, the problem lies with your Unity/HoloLens SDK setup. If it works, the issue is in your main app’s code (likely conflicting scripts or misconfigured SharingService settings).

Update Your Tools

  • Make sure you’re using the latest versions of Unity Hub, HoloLens SDK, and Visual Studio 2022. Outdated tools often have known network-related bugs that are fixed in newer releases.

内容的提问来源于stack exchange,提问作者Abhijit S

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.19 09:18:40