Skip to content

Commit

Permalink
Fixing martasp#6 UseRazorComponentsRuntimeCompilation ReadAllFiles NRE
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Ciechan committed Oct 2, 2020
1 parent aab433f commit 01b0873
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/RazorComponentsPreview/Razor/RuntimeComponentsGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,14 @@ @namespace Test
files.Insert(0, razorImportsFile);

//hack for to get dependencies from Test
var item = files.SingleOrDefault(item => item.FilePath.Contains("App.razor"));
var fixedAPPcontent = item.Content.Replace("@typeof(", "@typeof(Test.").Replace("Program", "Counter"); //Todo change name "Counter" to dynamic type from Test Assemebly
files.Remove(item);
files.Add((item.FilePath, fixedAPPcontent));
var appRazorItem = files.SingleOrDefault(item => item.FilePath.Contains("App.razor"));

if (appRazorItem != default)
{
var fixedAPPcontent = appRazorItem.Content.Replace("@typeof(", "@typeof(Test.").Replace("Program", "Counter"); //Todo change name "Counter" to dynamic type from Test Assemebly
files.Remove(appRazorItem);
files.Add((appRazorItem.FilePath, fixedAPPcontent));
}

return files;
}
Expand Down

0 comments on commit 01b0873

Please sign in to comment.