tjanczuk / edge

Run .NET and Node.js code in-process on Windows, MacOS, and Linux
http://tjanczuk.github.io/edge
Other
5.42k stars 639 forks source link

System.AccessViolationException occurs the first time after I rebuild and restart a debug session in visual studio 2015 #399

Open MonkeyJumps opened 8 years ago

MonkeyJumps commented 8 years ago

It happens in my following Asp.Net MVC 5 Controller class.

private static Func<object, Task<object>> render = Edge.Func(@"
        var app=require('../../Scripts/DocumentQueue.js');
        var ReactDOMServer = require('react-dom/server');

        return function(documentList, callback){
        var list= app.getDocumentList(documentList);
        callback(null, ReactDOMServer.renderToString(list));
        }
    ");
        // GET: Queue
        [SessionExpireFilter]        
        public async Task<ActionResult> Index()
        {
.......             var queueDocuments = (from DB);
                    ViewBag.List = (string)await render(queueDocuments);
                    ViewBag.QueueDocuments = queueDocuments;                   
                    return View();
                }
drgrieve commented 8 years ago

Ditto

MonkeyJumps commented 8 years ago

Does this also happen to you in production or only when you are recompiling?

Zache commented 8 years ago

I also have had this problem, and because of it haven't dared to deploy to production. But what did solve it for me was changing the user running the ApplicationPool from a local user to ApplicationPoolIdentity.

MonkeyJumps commented 8 years ago

@Zache what did you use as an alternative to Edge?

tjanczuk commented 8 years ago

Note: this may be related to https://github.com/tjanczuk/edge/issues/383

Zache commented 8 years ago

@MonkeyJumps nothing, we wanted it for server-side rendering of React but just had to manage without.

MonkeyJumps commented 8 years ago

@Zache Have you looked at ReactJs.Net? I started with that but then moved to Edge, but now am at a fork whether to go back, proceed or like you remove Edge.

MonkeyJumps commented 8 years ago

@tjanczuk what are the secondary effects of this error? How do you suggest I proceed?

This example of using Edge is pretty standard. I took it from the Edge site.

onethread commented 8 years ago

@MonkeyJumps I've been using reactjs.net for several months and am now looking at edge. Rjn is pretty stable but we've been getting performance issues with it (it adds about 100-150 ms per request if you turn off engine pooling, but with pooling it has memory management issues).

zenglo commented 6 years ago

I also encountered this problem, it encountered in the asp.net mvc, I indirectly through a console program calls the edge, to circumvent the AccessViolationException, I wrote a demo, if you want to know, can see EdgeJsDemo. Of course, the hope is that author can fundamentally solve the problem.

agracio commented 6 years ago

The fix requires https://github.com/tjanczuk/edge/pull/573, I have merged it to my fork at https://github.com/agracio/edge-js, take a look at https://github.com/tjanczuk/edge/issues/586 for reference.