FastScriptReload icon indicating copy to clipboard operation
FastScriptReload copied to clipboard

Feature : Add original filename to generated filename hash ?

Open builder-main opened this issue 2 years ago • 2 comments

It can become hard to read when you look at stacktraces with a lot of rewritten files. If they could be suffixed with the original filename (and shorter/incremental hash ?) it could be a blast.

C:/Users/../AppData/Local/Temp/04d60cd179c04742b6f4a2f89b2deeba.SourceCodeCombined.cs:800)
MoreLinq.MoreEnumerable:ForEach<System.ValueTuple`2<Commons.Domain.IEquipment, System.ValueTuple`3<int, int, int>>> (System.Collections.Generic.IEnumerable`1<System.ValueTuple`2<Commons.Domain.IEquipment, System.ValueTuple`3<int, int, int>>>,System.Action`2<System.ValueTuple`2<Commons.Domain.IEquipment, System.ValueTuple`3<int, int, int>>, int>) (at C:/projects/morelinq/MoreLinq/ForEach.cs:57)
Characters.View.UnitGameStatsView__Patched_:OnPreviewStat (Characters.View.UnitPreviewStatSignal) (at C:/Users/../AppData/Local/Temp/04d60cd179c04742b6f4a2f89b2deeba.SourceCodeCombined.cs:783)
Characters.View.UnitGameStatsView__Patched_:OnEventObject (Characters.View.UnitPreviewStatSignal) (at C:/Users/../AppData/Local/Temp/04d60cd179c04742b6f4a2f89b2deeba.SourceCodeCombined.cs:747)

into

C:/Users/../AppData/Local/Temp/04d60cd179c0474.UnitGameStatsView.cs:800)
MoreLinq.MoreEnumerable:ForEach<System.ValueTuple`2<Commons.Domain.IEquipment, System.ValueTuple`3<int, int, int>>> (System.Collections.Generic.IEnumerable`1<System.ValueTuple`2<Commons.Domain.IEquipment, System.ValueTuple`3<int, int, int>>>,System.Action`2<System.ValueTuple`2<Commons.Domain.IEquipment, System.ValueTuple`3<int, int, int>>, int>) (at C:/projects/morelinq/MoreLinq/ForEach.cs:57)
Characters.View.UnitGameStatsView__Patched_:OnPreviewStat (Characters.View.UnitPreviewStatSignal) (at C:/Users/../AppData/Local/Temp/04d60cd179c0474.UnitGameStatsView.cs:783)
Characters.View.UnitGameStatsView__Patched_:OnEventObject (Characters.View.UnitPreviewStatSignal) (at C:/Users/../AppData/Local/Temp/04d60cd179c0474.UnitGameStatsView.cs:747)

builder-main avatar May 22 '23 17:05 builder-main

sould be fairly straight forward, it'll be here FastScriptReload.Editor.Compilation.DotnetExeDynamicCompilation.Compile

and that's how names are generated

var asmName = Guid.NewGuid().ToString().Replace("-", "");
var rspFile = _tempFolder + $"{asmName}.rsp";
var assemblyAttributeFilePath = _tempFolder + $"{asmName}.DynamicallyCreatedAssemblyAttribute.cs";
sourceCodeCombinedFilePath = _tempFolder + $"{asmName}.SourceCodeCombined.cs";
var outLibraryPath = $"{_tempFolder}{asmName}.dll";

The only requirement is for the assembly name to be unique so it doesn't collide. It's possible to have more than 1 file in single hot reload compilation (defined in filePathsWithSourceCode argument)

handzlikchris avatar May 23 '23 07:05 handzlikchris

Sorry I didn't saw your answer, I'll take a look at it asap as I'm still in need of this feature. If it works on my side I might do a PR.

builder-main avatar Jan 07 '24 02:01 builder-main