reactjs.net - 'potential stack overflow detected' error - asp.net-mvc

Since I've decided to switch to server-side rendering from client-side react, I began to create my components and use them in the app.
However I came across this error:
Unknown error (RangeError); potential stack overflow detected
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Microsoft.ClearScript.ScriptEngineException: Unknown error (RangeError); potential stack overflow detected
And this is a part from the stack-trace
[ScriptEngineException: Unknown error (RangeError); potential stack overflow detected]
V8Exception.ThrowScriptEngineException(V8Exception* ) +169
Microsoft.ClearScript.V8.V8ContextProxyImpl.Execute(String gcDocumentName, String gcCode, Boolean evaluate, Boolean discard) +462
Microsoft.ClearScript.V8.<>c__DisplayClass1b.<Execute>b__19() +197
Microsoft.ClearScript.ScriptEngine.ScriptInvoke(Func`1 func) +70
Microsoft.ClearScript.V8.V8ScriptEngine.BaseScriptInvoke(Func`1 func) +49
Microsoft.ClearScript.V8.<>c__DisplayClass25`1.<ScriptInvoke>b__24() +45
Microsoft.ClearScript.V8.?A0x792c8756.LockCallback(Void* pvArg) +9
Microsoft.ClearScript.V8.V8ContextProxyImpl.InvokeWithLock(Action gcAction) +176
Microsoft.ClearScript.V8.V8ScriptEngine.ScriptInvoke(Func`1 func) +118
Microsoft.ClearScript.V8.V8ScriptEngine.Execute(String documentName, String code, Boolean evaluate, Boolean discard) +118
JavaScriptEngineSwitcher.V8.V8JsEngine.InnerEvaluate(String expression) +89
So I don't know what causes this error but I think it is some code that goes in a loop or something similar. Furthermore if I refresh the page this error goes away and if I continue to refresh intensively it shows up again which is very frustrating.

I was getting the same error (web app in azure) and after some investigation and tests, setting SetAllowMsieEngine to true did in fact fixed the issue also to me.
As Luke McGregor said, this seems to be an issue with V8ScriptEngine and using SetAllowMsieEngine does the job, however this method is latest version of react.net is deprecated and is recommended to "managed in the JavaScriptEngineSwitcher configuration".
So the solution I found so far is to switch js engine switcher by setting it directly in code:
JsEngineSwitcher engineSwitcher = JsEngineSwitcher.Instance;
engineSwitcher.EngineFactories
.AddChakraCore()
.AddMsie( new MsieSettings() { EngineMode = JsEngineMode.Auto } );
engineSwitcher.DefaultEngineName = ChakraCoreJsEngine.EngineName;
Like this I'm using ChakraCore engine rather than default V8 which was causing the error.
So far, during our performance tests with around 250 concurrent requests, we do not have this error anymore when previously in the same conditions for sure this error would have occurred.

This is a known issue, see https://github.com/reactjs/React.NET/issues/190
The work around is to not use V8 to do the render ie:
app.UseReact(config =>
{
config
// ..other configuration settings
.SetAllowMsieEngine(true);
});

Related

Xamarin Error XA0009 - Format of Executable or Library is invalid

I am struggling to make an Android App, but it always seems to end in this particular failure:
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets: Error: Exception while loading assemblies: Java.Interop.Tools.Diagnostics.XamarinAndroidException: error XA0009: Error while loading assembly: bin/Debug/(projectname).dll ---> System.BadImageFormatException: Format of the executable (.exe) or library (.dll) is invalid.
at Mono.Cecil.PE.ImageReader.ReadImage () [0x0002d] in <1b827dd2cbec4ef6829dffcefdcd3b01>:0
at Mono.Cecil.PE.ImageReader.ReadImage (Mono.Disposable1[T] stream, System.String file_name) [0x0000a] in <1b827dd2cbec4ef6829dffcefdcd3b01>:0
at Mono.Cecil.ModuleDefinition.ReadModule (Mono.Disposable1[T] stream, System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00007] in <1b827dd2cbec4ef6829dffcefdcd3b01>:0
at Mono.Cecil.ModuleDefinition.ReadModule (System.String fileName, Mono.Cecil.ReaderParameters parameters) [0x00073] in <1b827dd2cbec4ef6829dffcefdcd3b01>:0
--- End of inner exception stack trace ---
at Java.Interop.Tools.Diagnostics.Diagnostic.Error (System.Int32 code, System.Exception innerException, System.String message, System.Object[] args) [0x0000a] in :0
at Java.Interop.Tools.Cecil.DirectoryAssemblyResolver.Load (System.String fileName) [0x00045] in <9ca47d05131d4b8c85910dacd818f0c6>:0
at Xamarin.Android.Tasks.ResolveAssemblies.Execute (Java.Interop.Tools.Cecil.DirectoryAssemblyResolver resolver) [0x00123] in <3f37ea95794e430e91f10accab4cf241>:0 ((projectname))
I am wondering what on earth might be causing the error, as I have tried multiple solutions to avoid the error and it often turns up in such random ways.
Last time I got the error it occurred as follows:
I had a project with only two Activity-files and two Layout files.
I created a gridview in the other layout and tested it on the Android emulator -> all was working well.
I resized the gridview and tested the app with the emulator -> error mentioned above occurred.
I deleted the solution, restored a manual backup saved in an other location, and tested it -> it was working.
I repeated the procedure with the gridview -> error occurred.
Now, as I deleted the project and tried to restore the backup again, even the backup did not work anymore. I tried to build it, then clean it and build but every attempt to build it resulted now as an error.
I seem to get mystic errors from time to time ( like Emulator image stopped working after all I did was just add a button with the designer) but every time troubleshooting eventually comes down to this error and I have to scrap the project. I have been working with Xamarin now 18 hours this weekend and 4 hours have been coding and the rest trying to fix the never-ending errors.
I am using MacBook Pro and have tried running the solution from the default directory and external drive.
So in a nutshell: What causes the error mentioned above and can it be fixed or at least avoided?
I tried to google ( long and hard) but could not find a solution that would be of any help.
Ps. Sorry if the post was not correct, it is my first. Would not have posted in the first place but I am desperate.
Thank you for your patience to read all the way to here.

TFS 2012 Exception Message: TF246021

I'm receiving the following error within TFS
Exception Message: TF246021: An error occurred while processing your
request. Technical information (for administrator): SQL Server Error:
2601 (type VersionControlException) Exception Stack Trace: Server
stack trace: at
Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.HandleReply(TfsClientOperation
operation, TfsMessage message, Object[]& outputs) at
Microsoft.TeamFoundation.VersionControl.Client.Repository5.LabelItem(String
workspaceName, String workspaceOwner, VersionControlLabel label,
LabelItemSpec[] labelSpecs, LabelChildOption children, Int32
maxClientPathLength, Failure[]& failures) at
Microsoft.TeamFoundation.VersionControl.Client.WebServiceLayer.LabelItem(String
workspaceName, String workspaceOwner, VersionControlLabel label,
LabelItemSpec[] labelSpecs, LabelChildOption children, Failure[]&
failures) at
Microsoft.TeamFoundation.VersionControl.Client.VersionControlServer.CreateLabel(VersionControlLabel
label, LabelItemSpec[] itemSpecs, LabelChildOption options, Failure[]&
failures) at
Microsoft.TeamFoundation.Build.Workflow.Activities.TfLabel.TfLabelInternal.RunCommand(VersionControlScope
versionControlScope, String nonFatalError, VersionControlLabel label,
IEnumerable`1 items, LabelChildOption childOption) at
System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr
md, Object[] args, Object server, Object[]& outArgs) at
System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage
msg, IMessageSink replySink)
Exception rethrown at [0]: at
System.Runtime.Remoting.Proxies.RealProxy.EndInvokeHelper(Message
reqMsg, Boolean bProxyCase) at
System.Runtime.Remoting.Proxies.RemotingProxy.Invoke(Object NotUsed,
MessageData& msgData) at System.Func6.EndInvoke(IAsyncResult
result) at
Microsoft.TeamFoundation.Build.Workflow.Activities.TfLabel.TfLabelInternal.EndExecute(AsyncCodeActivityContext
context, IAsyncResult result) at
System.Activities.AsyncCodeActivity1.System.Activities.IAsyncCodeActivity.FinishExecution(AsyncCodeActivityContext
context, IAsyncResult result) at
System.Activities.AsyncCodeActivity.CompleteAsyncCodeActivityData.CompleteAsyncCodeActivityWorkItem.Execute(ActivityExecutor
executor, BookmarkManager bookmarkManager)
Inner Exception Details:
Exception Message: TF246021: An error occurred while processing your
request. Technical information (for administrator): SQL Server Error:
2601 (type SoapException)SoapException Details: Exception
Stack Trace:
I've read a previous post within StackOverflow which points at recreating workspaces, I tried that and it doesn't work.
Also I've tried to clean the cache, again without any luck. One thing I noticed when I go and disable 'Label Sources' and run the a build it works. I believe its to do with creating a branch and then deleting some files from a main branch which then gets TFS into a mess. I'm not sure whats the best way to fix this, it'll be difficult to upgrade to a newer version of TFS.
Make sure your TFS 2012 has been upgraded to the latest edition Update 4.
Make sure the build server has the same edition with TFS Application Tier.
Make sure both client cache and server cache are cleaned. Client cache: C:\Users\username\AppData\Local\Microsoft\Team Foundation\4.0\Cache. Server cache: C:\ProgramData\Microsoft\Team Foundation\Web Access\Cache_v11.0
Check Event log in Event Viewer to see whether there is something helpful.

Could not load type 'ProtocolSupportModule'

I've found a boss-level error that forced me to become an active member of stackoverflow.
I am hosting an MVC app and on root level it works, however css and images are failing. Even when going to the image directly via URL I get the following error:
Could not load type 'ProtocolSupportModule'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Could not load type 'ProtocolSupportModule'.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[HttpException (0x80004005): Could not load type 'ProtocolSupportModule'.]
System.Web.Compilation.BuildManager.GetType(String typeName, Boolean throwOnError, Boolean ignoreCase) +12510809
System.Web.Configuration.HandlerFactoryCache.GetTypeWithAssert(String type) +47
System.Web.Configuration.HandlerFactoryCache.GetHandlerType(String type) +18
System.Web.Configuration.HandlerFactoryCache..ctor(String type) +27
System.Web.HttpApplication.GetFactory(String type) +94
System.Web.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +375
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +288
Okay so I figured this out.
Under handler mappings, the OptionsVerbHandler was set to allow all verbs under the request restrictions section. I set it to only allow the OPTIONS verb and created extra handlers for POST and GET.
UPDATE:
WHEN a GETHandler is specified on a folder with stylesheets or images the ProtocolSupportModule error occurs when the image/stylesheet is called. When no Gethandler is present on dll's views, the MVC app displays a verb rights error.
I got around this by setting the handlers on folder level. This is a bad way of doing it. Are there any better ideas? I am sure the MVC framework should handle this automatically?

Upgrade to Neo4jClient 1.0.0.651 results in NullReferenceException

I have a working solution that is using Neo4jClient 1.0.0.646 with no problem. When I install the nuget package for the latest 1.0.0.651 I receive a NullReferenceException on every attempt to return query results. Given the stack trace details below can someone diagnose the issue for me? I am on Json.NET 5.0.6 if that is relevant. I see the REST calls going out and coming back with the correct data so the Cypher is good.
System.NullReferenceException was unhandled by user code
HResult=-2147467261 Message=Object reference not set to an instance
of an object. Source=Neo4jClient StackTrace:
at Neo4jClient.Cypher.CypherQuery.b__0(String
current, String paramName) in
c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\Cypher\CypherQuery.cs:line
46
at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable1
source, TAccumulate seed, Func3 func)
at Neo4jClient.Cypher.CypherQuery.get_DebugQueryText() in c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\Cypher\CypherQuery.cs:line
43
at Neo4jClient.GraphClient.<>c__DisplayClass1e1.<Neo4jClient.IRawGraphClient.ExecuteGetCypherResultsAsync>b__1d(Task1
responseTask) in
c:\TeamCity\buildAgent\work\5bae2aa9bce99f44\Neo4jClient\GraphClient.cs:line
825
at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
at System.Threading.Tasks.Task.Execute() InnerException:
You haven't provided enough of the exception detail for me to identify exactly where this is occurring.
Please include the full text of the exception in a new issue at https://github.com/readify/Neo4jClient/issues/new
Here are all the changes since 1.0.0.646, if you want to take a peek for anything related to what you're doing: https://github.com/Readify/Neo4jClient/compare/v1.0.0.646...master

Rejected by Server TFS Error

I am building an application but getting an error. Can someone help me to understand how to resolve this?
Exception Message: The request was rejected by the server.Technical
information: HTTP code 400: Bad Request (type
TeamFoundationServerInvalidRequestException)Exception Stack Trace:
at
Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.ReadResponse(HttpWebResponse
webResponse, WebException webException) at
Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.IsAuthenticationChallenge(TfsMessage
requestMessage, HttpWebResponse webResponse, WebException
webException, TfsMessage& responseMessage) at
Microsoft.TeamFoundation.Client.Channels.TfsHttpWebRequest.SendRequest()
at
Microsoft.TeamFoundation.Client.Channels.TfsHttpRequestChannel.Request(TfsMessage
message, TimeSpan timeout) at
Microsoft.TeamFoundation.Client.Channels.TfsHttpRetryChannel.Request(TfsMessage
message, TimeSpan timeout) at
Microsoft.TeamFoundation.Client.Channels.TfsHttpClientBase.Invoke(TfsClientOperation
operation, Object[] parameters, TimeSpan timeout, Object[]& outputs)
at
Microsoft.TeamFoundation.TestImpact.Client.TestImpactServer.Microsoft.TeamFoundation.TestImpact.Client.ITestImpactServer.PublishBuildChanges(Uri
buildUri, CodeChange[] changes) at
Microsoft.TeamFoundation.TestImpact.BuildIntegration.BuildActivities.GetImpactedTests.Execute(CodeActivityContext
context) at
System.Activities.CodeActivity.InternalExecute(ActivityInstance
instance, ActivityExecutor executor, BookmarkManager bookmarkManager)
at
System.Activities.Runtime.ActivityExecutor.ExecuteActivityWorkItem.ExecuteBody(ActivityExecutor
executor, BookmarkManager bookmarkManager, Location
resultLocation)Inner Exception Details:Exception Message: The remote
server returned an error: (400) Bad Request. (type
WebException)Status: ProtocolErrorResponse Status Code:
BadRequestResponse Status Message: Bad RequestException Stack Trace:
at System.Net.HttpWebRequest.GetResponse()
I've just ran into the same issue with TFS2013 and our CI builds.
It seems that the error happens with the Test Impact analyser fails somehow.
You can alter your build configuration to not analyse the test impact.
It depends on which build template you are using, but for Scrum 2013, you'll find it under
It's under: Process > Test > Advanced > Analyze Test Impact - set this to false.
Jaans' "solution" works for me too, obviously. As for the cause I started seeing this error after enabling obfuscation as part of my TFS build.
Doesn't look like it's possible to disable test impact analysis only for the release configuration - debug is not obfuscated. If I really want the test impact analysis I'll need 2 build definitions and don't build the release configuration for the one where the test impact analysis is enabled.
It's also "interesting" that it breaks the build even if there are no UT.
I didn't find why it occurs, but I resolved the error using a loop and a try-catch until get impacted tests succeeded.

Resources