Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The application requested process termination through System.Environment.FailFast(string message). #6

Open
csunkara-ipipeline opened this issue Feb 2, 2021 · 15 comments
Assignees

Comments

@csunkara-ipipeline
Copy link

Has anyone experienced out of memory errors when using this on a very large project?

I tried it multiple times and also closed everything else on my machine but it still crashes with the following error. I don't think the memory went above 75% though overall on the machine so not sure what the reason is.

Any ideas?

The application requested process termination through System.Environment.FailFast(string message).
Message: System.OutOfMemoryException: Exception of type 'System.OutOfMemoryException' was thrown.
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.SyntaxToken.SyntaxIdentifierWithTrivia.<>c.<.cctor>b__5_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.IdentifierNameSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.IdentifierNameSyntax.<>c.<.cctor>b__15_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.MemberAccessExpressionSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.MemberAccessExpressionSyntax.<>c.<.cctor>b__21_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.AssignmentExpressionSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.AssignmentExpressionSyntax.<>c.<.cctor>b__21_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ExpressionStatementSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ExpressionStatementSyntax.<>c.<.cctor>b__21_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList.WithManyChildrenBase..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList.WithManyChildren.<>c.<.cctor>b__0_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.BlockSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.BlockSyntax.<>c.<.cctor>b__24_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.IfStatementSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.IfStatementSyntax.<>c.<.cctor>b__33_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList.WithManyChildrenBase..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList.WithManyChildren.<>c.<.cctor>b__0_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.BlockSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.BlockSyntax.<>c.<.cctor>b__24_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.IfStatementSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.IfStatementSyntax.<>c.<.cctor>b__33_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList.WithManyChildrenBase..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList.WithManyChildren.<>c.<.cctor>b__0_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.BlockSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.BlockSyntax.<>c.<.cctor>b__24_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.MethodDeclarationSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.MethodDeclarationSyntax.<>c.<.cctor>b__45_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList.WithManyChildrenBase..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList.WithLotsOfChildren.<>c.<.cctor>b__0_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ClassDeclarationSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.ClassDeclarationSyntax.<>c.<.cctor>b__45_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.NamespaceDeclarationSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.NamespaceDeclarationSyntax.<>c.<.cctor>b__42_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CompilationUnitSyntax..ctor(ObjectReader reader)
at Microsoft.CodeAnalysis.CSharp.Syntax.InternalSyntax.CompilationUnitSyntax.<>c.<.cctor>b__27_0(ObjectReader r)
at Roslyn.Utilities.ObjectReader.ReadObject()
at Roslyn.Utilities.ObjectReader.ReadValueWorker()
at Roslyn.Utilities.ObjectReader.ReadValue()
at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxNode.DeserializeFrom(Stream stream, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTreeFactoryServiceFactory.CSharpSyntaxTreeFactoryService.DeserializeNodeFrom(Stream stream, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Host.AbstractSyntaxTreeFactoryService.RecoverableSyntaxRoot1.RecoverRoot(Stream stream, CancellationToken cancellationToken) at Microsoft.CodeAnalysis.Host.AbstractSyntaxTreeFactoryService.RecoverableSyntaxRoot1.d__7.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.CodeAnalysis.Host.WeaklyCachedRecoverableValueSource1.<GetValueAsync>d__15.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTreeFactoryServiceFactory.CSharpSyntaxTreeFactoryService.RecoverableSyntaxTree.<GetRootAsync>d__27.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree.<GetRootAsyncCore>d__58.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.SymbolContainment.<GetContainedSyntaxNodesAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.ContainsChildrenGraphQuery.<GetGraphAsync>d__0.MoveNext() --- End of stack trace from previous location where exception was thrown --- at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.GraphQueryManager.<PopulateContextGraphAsync>d__14.MoveNext() Stack: at System.Environment.FailFast(System.String, System.Exception) at Microsoft.CodeAnalysis.FailFast.OnFatalException(System.Exception) at Microsoft.CodeAnalysis.ErrorReporting.WatsonReporter.ReportNonFatal(System.Exception) at Microsoft.CodeAnalysis.ErrorReporting.FatalError.Report(System.Exception, System.Action1<System.Exception>)
at Microsoft.CodeAnalysis.ErrorReporting.FatalError.ReportWithoutCrashUnlessCanceledAndPropagate(System.Exception)
at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.GraphQueryManager+d__14.MoveNext()
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(System.Threading.Tasks.Task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(System.Threading.Tasks.Task)
at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.GraphQueryManager+d__14.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Threading.Tasks.Task+WhenAllPromise1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].Invoke(System.Threading.Tasks.Task)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.ContainsChildrenGraphQuery+d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.VisualStudio.LanguageServices.Implementation.Progression.SymbolContainment+d__0.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTree+d__58.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.CSharp.CSharpSyntaxTreeFactoryServiceFactory+CSharpSyntaxTreeFactoryService+RecoverableSyntaxTree+d__27.MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.RunOrScheduleAction(System.Action, Boolean, System.Threading.Tasks.Task ByRef)
at System.Threading.Tasks.Task.FinishContinuations()
at System.Threading.Tasks.Task.FinishStageThree()
at System.Threading.Tasks.Task.FinishStageTwo()
at System.Threading.Tasks.Task.Finish(Boolean)
at System.Threading.Tasks.Task1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].TrySetException(System.Object) at System.Runtime.CompilerServices.AsyncTaskMethodBuilder1[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].SetException(System.Exception)
at Microsoft.CodeAnalysis.Host.WeaklyCachedRecoverableValueSource`1+d__15[[System.__Canon, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]].MoveNext()
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.InvokeMoveNext(System.Object)
at System.Threading.ExecutionContext.RunInternal(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
at System.Runtime.CompilerServices.AsyncMethodBuilderCore+MoveNextRunner.Run()
at System.Threading.Tasks.AwaitTaskContinuation.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem()
at System.Threading.ThreadPoolWorkQueue.Dispatch()
at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()

@sgiffinlcd
Copy link
Contributor

@csunkara-ipipeline
I am pretty sure I understand what the underlying issue is. This has to do with a performance measure we took early on when authoring this template. We chose the load the entire projects models into ram for fast processing of all steps in the project. If you could give us a bit of information about your project.

  • Number of objects in the project
  • Now much ram are you working with on your computer

This will help me work with @jhannahLCD to give you a work around. Basically Ill work with john to give you a processing loop that loads in batches. This will slow down project processing but will keep us from hitting a ceiling on available ram.

@jhannahLCD
Copy link
Contributor

@csunkara-ipipeline
Just to be clear, was this error showing up when doing the bulk migration from the project and not a single-file migration?

@csunkara-ipipeline
Copy link
Author

@jhannahLCD Yes this was when doing the bulk migration. It's a very large project to try individual files and hence I tried the bulk option first.

@sgiffinlcd The RAM I have is 16GB. There are more than 2500 aspx pages and there's more than 200 user controls.

@sgiffinlcd
Copy link
Contributor

@csunkara-ipipeline Excellent thanks for the information @jhannahLCD and myself will look into this and come up with a plan for bulk processing that doesn't load the entire project. This will slow down processing a bit but will get you what you need.

@jhannahLCD
Copy link
Contributor

jhannahLCD commented Feb 4, 2021

@csunkara-ipipeline @sgiffinlcd

I have identified where the problem is occurring. It is happening in the following method:

/// <summary> /// Starts the migration process from webforms project to a blazor server project. /// </summary> /// <param name="webFormsProject">Source project to read data from.</param> /// <param name="blazorServerProject">Target server blazor project to inject into.</param> /// <param name="steps">The migration steps that are to be run.</param> public async Task StartMigration(VsProject webFormsProject, VsProject blazorServerProject, MigrationSteps steps)

of the WebFormsToServerMigration class.

There is a command at line 100

var webFormProjectData = await webFormsProject.LoadAllProjectData();

Who's original intent was to speed up later loading/processing of individual files. However - on a project as large as yours it is simply running the Visual Studio app instance out of memory (Visual Studio is still limited to 4GB of memory regardless of how much you have installed on your machine).

I am in the process of altering this code, and later dependent calls, to lighten the load for very large projects like the one you are working with.

@csunkara-ipipeline
Copy link
Author

Thank you @jhannahLCD. Looking forward to the changes :)

@csunkara-ipipeline
Copy link
Author

Btw, I have taken up a 30 day trial of CodeFactory to try this out. I know you may be busy with other stuff but any chance the fix can be provided sooner rather than later?

@jhannahLCD
Copy link
Contributor

jhannahLCD commented Feb 9, 2021

@csunkara-ipipeline I have uploaded a partial fix to the memory problem. I'd like you to try this again and see how much further this takes us. There is a drawback however, the memory footprint should have come down - but the individual file performance on the aspx migration now takes a bit longer.

I continue to work the problem - but I am hoping that this clears the memory problem and keeps you moving forward.

-John

@csunkara-ipipeline
Copy link
Author

Thank you John. I am trying the migration today with your change. Will update you the result.

@csunkara-ipipeline
Copy link
Author

csunkara-ipipeline commented Feb 10, 2021

@jhannahLCD The migration of the project completed a bit earlier. It ignored the code behind. So, I only have the razor files with no code behind. Previously, it created a separate Modules folder with the code behind but not after the performance change.

I am going through the errors now.
A few other observations

  1. If the Web Forms website project contains multiple masters in different folders, the migration only imported a single master page. I was able to clone the master to a separate folder though and then replace the layout in all the pages. Good thing is the @layout in the pages was containing the same folder structure as webforms so it was easy to replace it.
  2. After the migration the dependencies appear to have disappeared. I am trying to see why has that happened now and how to reverse it. - NOT AN ISSUE NOW

image

I can provide more feedback once I know more about the remaining errors.

@csunkara-ipipeline
Copy link
Author

csunkara-ipipeline commented Feb 10, 2021

In fact I get the following error when converting the Master pages. Not sure what it means but may be it's because of multiple master pages.

image

Also, the second error in my above comment is no longer an issue. I created another fresh Blazor project and migrated again and it's all good.

Also, the SiteMaster that it copied is empty although the source files have data. I am happy to raise these as a separate issue or discussion point, as it's not related to this issue?

@jhannahLCD
Copy link
Contributor

jhannahLCD commented Feb 10, 2021

@csunkara-ipipeline I'm glad that we got through the memory problem, that's a relief.

As for the Master pages - yes, I can see where this is an issue. The original design was built from WebForms project that only really had a single site.master page.

The relevant code is under the WebFormsToServerMigration.Startup.cs class under the
/// <summary> /// Migrates the site.master layout files from the source WebForms project into the \Shared folder /// in the Blazor target application project. /// </summary> /// <param name="webFormSiteMasterFiles">The flattened list of WebForms project objects/files</param> /// <param name="blazorServerProject">The target Blazor project object</param> /// <returns></returns> /// private async Task ConvertAspxPage(VsDocument sourcePage, VsProject targetProject, VsProjectFolder targetPagesFolder, VsCSharpSource sourceCodeBehind = null) private async Task<string> ConvertLayoutFiles(IEnumerable<VsModel> webFormSiteMasterFiles, VsProject blazorServerProject)

method. I'll review in the meantime and see where the bug is.

Could you give me an example of the structure where you've got a couple master files in folders with other aspx files?

@jhannahLCD
Copy link
Contributor

@csunkara-ipipeline

I almost missed the comment about not pulling over the code-behind. Would you be willing to provide an example screenshot of the *.aspx file (and its associated code-behind *.aspx.cs file) for me? It most definitely should be pulling that over as well.

@csunkara-ipipeline
Copy link
Author

csunkara-ipipeline commented Feb 10, 2021

@jhannahLCD Regarding the master page here is a structure. The red portion is a folder for each client we have and their master is in that folder.

image

I was going through the migration code. The first two lines in the master are the following followed by "<!DOCTYPE" section and then the "html" section starts. The target file stops after <!DOCTYPE line and nothing after that. So, it could be either the migration cannot convert something in the html or it has an issue with writing the second master. I suppose it would have replaced the file anyway as it does not recognize multiple files. May be we can append it with the folder name. Do you think the we get the folder name from the loadAllProjects method?

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="TCP.CopernicusServices.Web.App_Templates.Default.Site" %>

<%@ Register Src="../../UserControls/Navigation.ascx" TagName="Navigation" TagPrefix="uc1" %>

@csunkara-ipipeline
Copy link
Author

csunkara-ipipeline commented Feb 10, 2021

@jhannahLCD Regarding the code-behind issue here is an example. The aspx page has the markup and the code behind is in the AcceptableTerms.aspx.cs file. The code behind contains the call to the webservice to get the data and loading of the data into the controls and the button click events etc.

image

I added the following lines in MigrateAspxFiles method and it now appears to be migrating the code behind.

var aspxChildren = await aspxFile.GetChildrenAsync(true);
var codeBehindFile = aspxChildren
                        .Where(c => (c.IsSourceCode == true) && (c.SourceType == SourceCodeType.CSharp)).FirstOrDefault();

//Converting the aspx page and the code behind file if it was found.
await ConvertAspxPage(aspxFile, blazorServerProject, blazorPagesFolder, aspxCodeBehindSource, codeBehindFile);

instead of

await ConvertAspxPage(aspxFile, blazorServerProject, blazorPagesFolder, aspxCodeBehindSource, codeBehindFile);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants