I have an asp.net project using web forms.
The aspx page with the Cesium map crashes when you mouse over it but only if the page also contains the asp:ScriptManager element. If the ScriptManager element is removed, the page does not crash on mouse over.
I created a minimal example where this happens:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="TestCesium2.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="https://cesium.com/downloads/cesiumjs/releases/1.131/Build/Cesium/Cesium.js"></script>
<link href="https://cesium.com/downloads/cesiumjs/releases/1.131/Build/Cesium/Widgets/widgets.css" rel="stylesheet" />
</head>
<body>
<form runat="server">
<asp:ScriptManager runat="server" />
</form>
<script type="module">
const viewer = new Cesium.Viewer('cesiumContainer', {
terrain: Cesium.Terrain.fromWorldTerrain(),
});
</script>
<div id="cesiumContainer" />
</body>
</html>
That’s the entire aspx page and there is no code-behind.
When running this, the page loads with the map without error.
However, the instant you move the mouse over the map, it crashes on this code on the “if (e) throw e;” line:
String.prototype.startsWith = function String$startsWith(prefix) {
/// <summary locid="M:J#String.startsWith" />
/// <param name="prefix" type="String"></param>
/// <returns type="Boolean"></returns>
var e = Function._validateParams(arguments, [
{name: "prefix", type: String}
]);
if (e) throw e; // <-- EXCEPTION ON THIS LINE
// Sys.ArgumentTypeException: Sys.ArgumentTypeException: Object of type 'Number' cannot be converted to type 'String'.
// Parameter name: prefix
return (this.substr(0, prefix.length) === prefix);
}
Does anyone know how to avoid this crash?
I am using .net framework 4.7.2 and CesiumJS 1.131.