"[97808] dotnet.exe" terminated with Code -1073741819 (0xc0000005) 'Access violation' on browser refresh #993

Closed
opened 2025-08-09 17:18:28 +00:00 by fergalmoran · 0 comments
Owner

Originally created by @HaraldMuehlhoffCC on 2/22/2017

As it turned out the issue was caused by an endless recursion in the initial implementation of my TenantService (returning Current instead of current ... arghhh). While receiving an access violation as the only feedback wasn't very helpful I'm closing this issue because it's not really related to JavaScriptServices.


I'm currently working on adding multi-tenancy support to my ReactReduxSPA based website project (Visual Studio 2017RC, Node.js 7.6.0).

For hours I'm having trouble with an "access violation" in dotnet.exe. It happens after I REFRESH Internet Explorer (or Chrome); the initial rendering is OK, changing routes on client is working.
I've gone back to an older version of my site and the error disappeared; now I'm slowly bringing back the changes.

I'm using Prerenderer.RenderToString in my HomeController:

public async Task<IActionResult> Index(
            [FromServices] IHostingEnvironment hostEnv,
            [FromServices] INodeServices nodeServices /*,
            [FromServices] TenantService tenantService */)
        {
            // Instead of using the asp-prerender-module tag helper, we'll invoke Prerenderer.RenderToString
            // in the controller so we can get additional info to pass to the view
            var requestFeature = Request.HttpContext.Features.Get<IHttpRequestFeature>();
            var unencodedPathAndQuery = requestFeature.RawTarget;
            var unencodedAbsoluteUrl = $"{Request.Scheme}://{Request.Host}{unencodedPathAndQuery}";
            var prerenderResult = await Prerenderer.RenderToString(
                hostEnv.ContentRootPath,
                nodeServices,
                new JavaScriptModuleExport("ClientApp/dist/main-server"),
                unencodedAbsoluteUrl,
                unencodedPathAndQuery,
                /* custom data parameter */
                new
                {
                    cookies = HttpContext.Request.Cookies /*,
                    tenantName = tenantService.Current.Name */
                },
                /* timeout milliseconds */ 15 * 1000,
                Request.PathBase.ToString()
            );

When I commented out the function argument tenantService and the tenantName in the custom data parameter the trouble ended (for a while). I was using this mechanism to pass data to boot-server.tsx.

I have been looking into the Prerenderer source but found nothing; also the error reappeared after commenting the above code in again and is NOT going away commenting it out - after I added some variables to hold the tenantName and the custom data parameter ...

If I remove the [FromServices] TenantService tenantService AND the tenantName from the custom data parameter I CAN refresh. Looks like the issue is service / dependency injection related ...

Still mysterious ... any light shed on this issue would be very much appreciated!

PS: I further simplified my service and then the issue went away ... since I was doing no dark magic I'm still wondering what was going on. Well for now I'm calling it a day. Multi-tenancy support is on it's way and it's late over here in Germany.

PPS: Both IE and Chrome show Bad Gateway - but I'm pretty sure that's because of the dying dotnet.exe.

image
image

*Originally created by @HaraldMuehlhoffCC on 2/22/2017* As it turned out the issue was caused by an endless recursion in the initial implementation of my `TenantService` (returning `Current` instead of `current` ... arghhh). While receiving an access violation as the only feedback wasn't very helpful I'm closing this issue because it's not really related to JavaScriptServices. ---- I'm currently working on adding multi-tenancy support to my ReactReduxSPA based website project (Visual Studio 2017RC, Node.js 7.6.0). For hours I'm having trouble with an "access violation" in `dotnet.exe`. It happens after I REFRESH Internet Explorer (or Chrome); the initial rendering is OK, changing routes on client is working. I've gone back to an older version of my site and the error disappeared; now I'm slowly bringing back the changes. I'm using `Prerenderer.RenderToString` in my `HomeController`: ``` public async Task<IActionResult> Index( [FromServices] IHostingEnvironment hostEnv, [FromServices] INodeServices nodeServices /*, [FromServices] TenantService tenantService */) { // Instead of using the asp-prerender-module tag helper, we'll invoke Prerenderer.RenderToString // in the controller so we can get additional info to pass to the view var requestFeature = Request.HttpContext.Features.Get<IHttpRequestFeature>(); var unencodedPathAndQuery = requestFeature.RawTarget; var unencodedAbsoluteUrl = $"{Request.Scheme}://{Request.Host}{unencodedPathAndQuery}"; var prerenderResult = await Prerenderer.RenderToString( hostEnv.ContentRootPath, nodeServices, new JavaScriptModuleExport("ClientApp/dist/main-server"), unencodedAbsoluteUrl, unencodedPathAndQuery, /* custom data parameter */ new { cookies = HttpContext.Request.Cookies /*, tenantName = tenantService.Current.Name */ }, /* timeout milliseconds */ 15 * 1000, Request.PathBase.ToString() ); ``` When I commented out the function argument `tenantService` and the `tenantName` in the custom data parameter the trouble ended (for a while). I was using this mechanism to pass data to `boot-server.tsx`. I have been looking into the `Prerenderer` source but found nothing; also the error reappeared after commenting the above code in again and is NOT going away commenting it out - after I added some variables to hold the tenantName and the custom data parameter ... If I remove the `[FromServices] TenantService tenantService` AND the `tenantName` from the custom data parameter I CAN refresh. Looks like the issue is service / dependency injection related ... Still mysterious ... any light shed on this issue would be very much appreciated! PS: I further simplified my service and then the issue went away ... since I was doing no dark magic I'm still wondering what was going on. Well for now I'm calling it a day. Multi-tenancy support is on it's way and it's late over here in Germany. PPS: Both IE and Chrome show `Bad Gateway` - but I'm pretty sure that's because of the dying dotnet.exe. ![image](https://cloud.githubusercontent.com/assets/2997561/23226073/9b149fa4-f934-11e6-8db2-f97583b9aa04.png) ![image](https://cloud.githubusercontent.com/assets/2997561/23226443/dd02af36-f935-11e6-8619-8a315de8d0fc.png)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/JavaScriptServices#993
No description provided.