Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
Started a new Blazor WebAssembly project (Windows 10, Visual Studio 2019),
trying to get a simple list via HttpClient from the server side.
Error:
00755c3a:0xa3a0 Uncaught (in promise) RuntimeError: memory access out of bounds
at malloc (<anonymous>:wasm-function[359]:0xa3a0)
at monoeg_malloc (<anonymous>:wasm-function[161]:0x3c71)
at stack_frag_new (<anonymous>:wasm-function[2019]:0x59758)
at add_frag (<anonymous>:wasm-function[1430]:0x3ccf2)
at interp_exec_method (<anonymous>:wasm-function[1120]:0x2f609)
at interp_runtime_invoke (<anonymous>:wasm-function[5655]:0xf7391)
at mono_jit_runtime_invoke (<anonymous>:wasm-function[5109]:0xddb3d)
at do_runtime_invoke (<anonymous>:wasm-function[1410]:0x3ba85)
at mono_runtime_try_invoke (<anonymous>:wasm-function[418]:0xcfdb)
at mono_runtime_invoke (<anonymous>:wasm-function[1610]:0x44b39)
Server side (this returns properly):
[HttpGet]
public async Task<IEnumerable<UserDetailsRM>> Get()
var users = await UserService.GetUsers();
return users;
client side: doesn't render anything despite getting results back.
<div class="userListWrapper">
@if (Users != null)
<table class="table table-borderless" style="font-size:12px; font-family:arial; height:
500px; display:block; overflow-y:scroll">
<thead>
<th scope="col">Profile</th>
<th scope="col">Full Name</th>
<th scope="col">Gender</th>
<th scope="col">Age</th>
</thead>
@foreach (var user in Users)
<tbody class="scrollableTable" style="border-radius:15px;">
<tr class="userRow" >
<td><img src="@user.ProfileImageUrl" style="width:30px;border-
radius:30px" /></td>
<td>@user.FullName</td>
<td>@user.Gender</td>
<td>@user.Age</td>
</tbody>
</table>
@code{
private IEnumerable<UserDetailsRM> Users;
string LoggedEmail;
string UserId;
string UserActionMessage = "No Logged User";
string Wanted = "";
protected async override Task OnInitializedAsync()
Users = await Http.GetFromJsonAsync<IEnumerable<UserDetailsRM>>("user");
client project file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework>
<RazorLangVersion>3.0</RazorLangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="5.0.0-preview.6.20312.15" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0-rc.2.20475.17" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Net.Http.Json" Version="3.2.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\Domain\Domain.csproj" />
</ItemGroup>
</Project>
server project file:
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="3.2.1" />
<PackageReference Include="NetTopologySuite" Version="2.1.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\DataAccess\DataAccess.csproj" />
<ProjectReference Include="..\Client\TeamAppManager.Client.csproj" />
</ItemGroup>
</Project>
Would appreciate any help. Thanks.
Edit: Models:
public class UserDetailsRM : IIntEntity
public int Id { get; set; }
public int UserDetailsId { get; set; }
public string UserId { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public DateTime Birthdate { get; set; }
public int UserGenderOptionId { get; set; }
private string gender;
public string Gender
get { return gender; }
if (value == "1")
gender = "Male";
else if (value == "2")
gender = "Female";
gender = "Other";
public string FullName
return $"{FirstName} {LastName}";
FullName = value;
public int Age
var today = DateTime.Today;
var age = today.Year - Birthdate.Year;
if (Birthdate.Date > today.AddYears(-age)) age--;
return age;
public string ProfileImageUrl { get; set; }
–
–
–
–
–
5.0.0-rc.2.20475.17
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="5.0.0-preview.6.20312.15" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0-rc.2.20475.17" PrivateAssets="all" />
For 3.2.1
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="3.2.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Build" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="3.2.1" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Net.Http.Json" Version="3.2.0" />
For 5.0 rc2
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="5.0.0-rc.2.20475.17" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="5.0.0-rc.2.20475.17" PrivateAssets="all" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="System.Net.Http.Json" Version="5.0.0-rc.2.20475.5" />
As WASM runs in your browser you should clear the applications cache as well, between dll changes.
–
Adding to @enet answer for future similar cases, it requires to define local variable like this, otherwise it is a circular reference which eventually lead to out of memory issue:
private string _Name
public string Name
//...
return this._Name;
this._Name = value;
//...
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.