BornToBeRoot/NETworkManager · error · FileNotFoundException
Embedded resource…
Error message
Embedded resource "NETworkManager.Resources.Maps.world-cities.json" not found.
What it means
TracerouteMapControl loads city coordinates from the embedded resource "NETworkManager.Resources.Maps.world-cities.json" via GetManifestResourceStream. When that resource is not present in the executing assembly, the null stream triggers a FileNotFoundException with this message, so the traceroute map cannot plot city locations.
Solutions
- Ensure the csproj embeds the file (<EmbeddedResource Include="Resources\Maps\world-cities.json" />) and rebuild.
- Check the exact resource name (default namespace + folder path) matches the constant; fix either the path or the resourceName.
- Debug with assembly.GetManifestResourceNames() to see which names actually exist and align them.
- Restore the missing world-cities.json from the repository and rebuild/redeploy the complete output.
Example fix
// csproj before <None Remove="Resources\Maps\world-cities.json" /> // after <EmbeddedResource Include="Resources\Maps\world-cities.json" />
Defensive patterns
Strategy: fallback
Validate before calling
var names = Assembly.GetExecutingAssembly().GetManifestResourceNames();
bool ok = names.Contains("NETworkManager.Resources.Maps.world-cities.json"); Try / catch
try
{
var cities = LoadCities();
}
catch (FileNotFoundException ex)
{
logger.Error("world-cities.json embedded resource missing", ex);
MessageBox.Show("City data is missing from this installation. Please reinstall.");
} Prevention
- Ensure the csproj marks world-cities.json as EmbeddedResource.
- Add a CI smoke test that enumerates manifest resources and checks both map JSON files.
- Keep resource folder structure aligned with the default namespace so names stay stable.
- Deploy full build outputs; verify resources after any packaging changes.
When it happens
Trigger: The resource loader is invoked (TracerouteMapControl construction) while the assembly lacks a manifest resource named exactly "NETworkManager.Resources.Maps.world-cities.json" — missing EmbeddedResource entry in the csproj, renamed/moved file, or a build that excluded the Resources/Maps folder.
Common situations: Custom or CI builds that did not embed the JSON; the file moved to another folder so the default-namespace-derived resource name changed; resource-stripping publish profiles; a locally modified repo missing the data file.
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
- Embedded resource…
- Specified argument was out of the range of valid values…
- Could not load PSDiscoveryProtocol.psm1
- Process could not be started!
- Process could not be started!
AI-assisted analysis of BornToBeRoot/NETworkManager@2780d65469 (2026-09-12).
Data as JSON: /api/errors/de80e65fb4885b33.
Report an issue: GitHub.
Appendix: source
Thrown at Source/NETworkManager/Controls/TracerouteMapControl.xaml.cs:1681
/// 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()
{
const string resourceName = "NETworkManager.Resources.Maps.world-cities.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<CityData>>(reader.ReadToEnd()) ?? [];
}
/// <summary>
/// Minimal representation of a major city (national capital or population above the script's threshold).
/// </summary>
private sealed class CityData
{
[JsonPropertyName("n")]
public string N { get; set; }
[JsonPropertyName("lat")]
public double Lat { get; set; }
[JsonPropertyName("lon")]
public double Lon { get; set; }View on GitHub (pinned to 2780d65469)