Changed csharp script compilation algorithm to be best effort.

This commit is contained in:
MapleWheels
2026-04-13 14:19:31 -04:00
parent 344027d757
commit a2c67f7af5
2 changed files with 4 additions and 2 deletions

View File

@@ -335,10 +335,10 @@ public sealed class ModConfigService : IModConfigService
.Select(fp => ContentPath.FromRaw(srcPackage, .Select(fp => ContentPath.FromRaw(srcPackage,
$"%ModDir%/{Path.GetRelativePath(srcPackage.Dir, fp)}".CleanUpPathCrossPlatform())) $"%ModDir%/{Path.GetRelativePath(srcPackage.Dir, fp)}".CleanUpPathCrossPlatform()))
.Concat(sharedFiles).ToImmutableArray(), .Concat(sharedFiles).ToImmutableArray(),
FriendlyName = IAssemblyLoaderService.InternalsAwareAssemblyName, FriendlyName = IAssemblyLoaderService.InternalsAwareAssemblyName, // give the best chance of success (InternalsAware + Publicizer)
IncompatiblePackages = ImmutableArray<Identifier>.Empty, IncompatiblePackages = ImmutableArray<Identifier>.Empty,
RequiredPackages = ImmutableArray<Identifier>.Empty, RequiredPackages = ImmutableArray<Identifier>.Empty,
UseInternalAccessName = true, UseInternalAccessName = false, //compile as public and then fallback to internals
IsScript = true, IsScript = true,
IsReferenceModeOnly = false IsReferenceModeOnly = false
}); });

View File

@@ -677,6 +677,8 @@ public class PluginManagementService : IAssemblyManagementService
// overwrite result with good compilation // overwrite result with good compilation
if (res2.IsSuccess) if (res2.IsSuccess)
{ {
var reasonsStr = res.Reasons.Aggregate("", (accum, reason) => accum + "\n" + reason.Message);
_logger.LogWarning($"Attempted compilation of {scripts.Key} for package {contentPackRes.Key.Name} succeeded. Original errors were: \n {reasonsStr}");
res = res2; res = res2;
} }
} }