BornToBeRoot/NETworkManager · error · FileNotFoundException

Embedded resource…

Error message

Embedded resource "NETworkManager.Resources.Maps.world-map.json" not found.

What it means

TracerouteMapControl loads the world-map GeoJSON from an embedded resource named "NETworkManager.Resources.Maps.world-map.json" via Assembly.GetManifestResourceStream. If the resource is absent from the executing assembly (build misconfiguration, wrong resource name, or stripped resources), the null stream is converted into a FileNotFoundException with this message.

Solutions

  1. Verify Source/NETworkManager.csproj contains <EmbeddedResource Include="Resources\Maps\world-map.json" /> (or equivalent glob) and rebuild the NETworkManager project.
  2. Confirm the resource name matches the default namespace + folder path (NETworkManager.Resources.Maps.world-map.json); rename the file/folder or the resourceName constant accordingly.
  3. List actual resources at runtime with assembly.GetManifestResourceNames() to compare names and fix the mismatch.
  4. Restore the original world-map.json if it was deleted, then rebuild and redeploy the full build output.

Example fix

// csproj before
<None Include="Resources\Maps\world-map.json" />
// after
<EmbeddedResource Include="Resources\Maps\world-map.json" />
Defensive patterns

Strategy: fallback

Validate before calling

var names = Assembly.GetExecutingAssembly().GetManifestResourceNames();
bool ok = names.Contains("NETworkManager.Resources.Maps.world-map.json");

Try / catch

try
{
    var countries = LoadCountries();
}
catch (FileNotFoundException ex)
{
    logger.Error("world-map.json embedded resource missing", ex);
    MessageBox.Show("Map data is missing from this installation. Please reinstall.");
}

Prevention

When it happens

Trigger: Calling the private resource loader in TracerouteMapControl (constructor path) when the assembly has no manifest resource with the exact name "NETworkManager.Resources.Maps.world-map.json" — e.g. the .csproj lacks the EmbeddedResource entry, the file lives under a different folder namespace, or a custom/partial build omitted it.

Common situations: Hand-compiled or modified builds where world-map.json was not included as EmbeddedResource; resource file moved/renamed in the repo without updating the csproj; custom packaging tools stripping resources; running a trimmed/published output that dropped the resource.

Understand the failure class

Background: 'Could not be found', 'does not exist', 'not found in database': the resource-not-found family when an ID, slug, key, or URI lookup comes back empty — this error's family across 20 libraries.

Related errors


AI-assisted analysis of BornToBeRoot/NETworkManager@2780d65469 (2026-09-12). Data as JSON: /api/errors/96b76249fa9b3ba3. Report an issue: GitHub.

Appendix: source

Thrown at Source/NETworkManager/Controls/TracerouteMapControl.xaml.cs:1656

                bestBoundsArea = boundsArea;
                bestCenter = new Point((minX + maxX) / 2, (minY + maxY) / 2);
            }

            if (bestBoundsArea >= 0)
                labels.Add((country.N, bestCenter));
        }

        return labels;
    }

    private static List<CountryData> LoadCountries()
    {
        const string resourceName = "NETworkManager.Resources.Maps.world-map.json";

        var assembly = Assembly.GetExecutingAssembly();

        using var stream = assembly.GetManifestResourceStream(resourceName) ??
                            throw new FileNotFoundException($"Embedded resource \"{resourceName}\" not found.");
        using var reader = new StreamReader(stream);

        return System.Text.Json.JsonSerializer.Deserialize<List<CountryData>>(reader.ReadToEnd()) ?? [];
    }

    /// <summary>
    /// Minimal representation of a simplified country outline (name + outer ring coordinates as [lon, lat] pairs).
    /// </summary>
    private sealed class CountryData
    {
        [JsonPropertyName("n")]
        public string N { get; set; }

        [JsonPropertyName("r")]
        public List<List<List<double>>> R { get; set; }
    }

    private static List<CityData> LoadCities()

View on GitHub (pinned to 2780d65469)