diff --git a/src/IKVM.MSBuild.Tasks.Tests/IkvmFileIdentityUtilTests.cs b/src/IKVM.MSBuild.Tasks.Tests/IkvmFileIdentityUtilTests.cs index 0aeb97c997..56a56505c4 100644 --- a/src/IKVM.MSBuild.Tasks.Tests/IkvmFileIdentityUtilTests.cs +++ b/src/IKVM.MSBuild.Tasks.Tests/IkvmFileIdentityUtilTests.cs @@ -21,7 +21,7 @@ public async Task CanSaveState() var f = Path.GetTempFileName(); File.WriteAllText(f, "TEST"); - var i = await u.GetIdentityForFileAsync(f, CancellationToken.None); + var i = await u.GetIdentityForFileAsync(f, null, CancellationToken.None); var x = new XElement("Test"); await u.SaveStateXmlAsync(x); diff --git a/src/IKVM.MSBuild.Tasks/IkvmAssemblyInfoUtil.cs b/src/IKVM.MSBuild.Tasks/IkvmAssemblyInfoUtil.cs index b9b03ce53c..1a77da9b5d 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmAssemblyInfoUtil.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmAssemblyInfoUtil.cs @@ -165,7 +165,7 @@ public async System.Threading.Tasks.Task SaveStateXmlAsync(XElement root) try { - log.LogMessage(MessageImportance.Low, "Loading assembly info from '{0}'.", path); + log?.LogMessage(MessageImportance.Low, "Loading assembly info from '{0}'.", path); using var fsstm = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read); using var perdr = new PEReader(fsstm); var mrdr = perdr.GetMetadataReader(); @@ -173,13 +173,13 @@ public async System.Threading.Tasks.Task SaveStateXmlAsync(XElement root) } catch (Exception e) { - log.LogWarning("Exception loading assembly info from '{0}': {1}", path, e.Message); + log?.LogWarning("Exception loading assembly info from '{0}': {1}", path, e.Message); return (lastWriteTimeUtc, null); } } catch (Exception e) { - log.LogWarning("Exception loading assembly info from '{0}': {1}", path, e.Message); + log?.LogWarning("Exception loading assembly info from '{0}': {1}", path, e.Message); return (default, null); } }); diff --git a/src/IKVM.MSBuild.Tasks/IkvmFileIdentityUtil.cs b/src/IKVM.MSBuild.Tasks/IkvmFileIdentityUtil.cs index 979659875f..967ee1ad70 100644 --- a/src/IKVM.MSBuild.Tasks/IkvmFileIdentityUtil.cs +++ b/src/IKVM.MSBuild.Tasks/IkvmFileIdentityUtil.cs @@ -91,8 +91,6 @@ public async Task GetIdentityForFileAsync(string path, TaskLoggingHelper { if (string.IsNullOrWhiteSpace(path)) throw new ArgumentException($"'{nameof(path)}' cannot be null or whitespace.", nameof(path)); - if (log is null) - throw new ArgumentNullException(nameof(log)); return (await cache.GetOrAdd(path, path => CreateIdentityForFileAsync(path, log, cancellationToken))).Identity; }