diff --git a/Directory.Build.props b/Directory.Build.props index b21c579650..4f2a24665d 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -7,6 +7,10 @@ win-x64;win-x86;win-arm64;linux-x64;linux-arm;linux-arm64;linux-musl-x64;linux-musl-arm;linux-musl-arm64;osx-x64;osx-arm64 $(SupportedImageRuntimes) + win-x64;win-x86 + win-x64;win-x86 + win-x64;win-x86 + <_SupportedRuntimes>;$(SupportedRuntimes); <_EnabledRuntimes>;$(EnabledRuntimes); <_SupportedToolRuntimes>;$(SupportedToolRuntimes); diff --git a/IKVM.deps.targets b/IKVM.deps.targets index c0b7c73b92..dfcb661107 100644 --- a/IKVM.deps.targets +++ b/IKVM.deps.targets @@ -15,6 +15,7 @@ + diff --git a/src/IKVM.ConsoleApp/IKVM.ConsoleApp.csproj b/src/IKVM.ConsoleApp/IKVM.ConsoleApp.csproj index d8e11e329e..eeb7909130 100644 --- a/src/IKVM.ConsoleApp/IKVM.ConsoleApp.csproj +++ b/src/IKVM.ConsoleApp/IKVM.ConsoleApp.csproj @@ -6,13 +6,14 @@ Exe net481;net6.0;net8.0 - 11 x64 + + diff --git a/src/IKVM.ConsoleApp/Program.cs b/src/IKVM.ConsoleApp/Program.cs index ef839d3604..4772ff69cc 100644 --- a/src/IKVM.ConsoleApp/Program.cs +++ b/src/IKVM.ConsoleApp/Program.cs @@ -1,5 +1,6 @@ -using System; -using System.Diagnostics.Tracing; +using System.Threading; + +using IKVM.JTReg.TestAdapter.Core; namespace IKVM.ConsoleApp { @@ -7,21 +8,29 @@ namespace IKVM.ConsoleApp public class Program { - public static void Main(string[] args) + class MyDiscoverycontext : IJTRegDiscoveryContext { - var l = new Listener(); - var o = new java.lang.Object(); - java.lang.System.loadLibrary("hi"); - } - } + public JTRegTestOptions Options => new JTRegTestOptions() + { - class Listener : EventListener - { + }; + + public void SendMessage(JTRegTestMessageLevel level, string message) + { - protected override void OnEventWritten(EventWrittenEventArgs eventData) + } + + public void SendTestCase(JTRegTestCase testCase) + { + + } + + } + + public static void Main(string[] args) { - Console.WriteLine(eventData); + JTRegTestManager.Instance.DiscoverTests(@"D:\ikvm\src\IKVM.JTReg.TestAdapter.Tests\bin\Debug\net478\IKVM.JTReg.TestAdapter.Tests.dll", new MyDiscoverycontext(), CancellationToken.None); } } diff --git a/src/IKVM.CoreLib.Tests/Collections/IndexRangeDictionaryTests.cs b/src/IKVM.CoreLib.Tests/Collections/IndexRangeDictionaryTests.cs new file mode 100644 index 0000000000..04f64fc0cc --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Collections/IndexRangeDictionaryTests.cs @@ -0,0 +1,116 @@ +using FluentAssertions; + +using IKVM.CoreLib.Collections; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Collections +{ + + [TestClass] + public class IndexRangeDictionaryTests + { + + [TestMethod] + public void AlignTowardsInfinity() + { + IndexRangeDictionary.AlignTowardsInfinity(0).Should().Be(0); + IndexRangeDictionary.AlignTowardsInfinity(1).Should().Be(8); + IndexRangeDictionary.AlignTowardsInfinity(7).Should().Be(8); + IndexRangeDictionary.AlignTowardsInfinity(8).Should().Be(8); + IndexRangeDictionary.AlignTowardsInfinity(9).Should().Be(16); + + IndexRangeDictionary.AlignTowardsInfinity(-0).Should().Be(-0); + IndexRangeDictionary.AlignTowardsInfinity(-1).Should().Be(-8); + IndexRangeDictionary.AlignTowardsInfinity(-7).Should().Be(-8); + IndexRangeDictionary.AlignTowardsInfinity(-8).Should().Be(-8); + IndexRangeDictionary.AlignTowardsInfinity(-9).Should().Be(-16); + } + + [TestMethod] + public void AlignTowardsZero() + { + IndexRangeDictionary.AlignTowardsZero(0).Should().Be(0); + IndexRangeDictionary.AlignTowardsZero(1).Should().Be(0); + IndexRangeDictionary.AlignTowardsZero(7).Should().Be(0); + IndexRangeDictionary.AlignTowardsZero(8).Should().Be(8); + IndexRangeDictionary.AlignTowardsZero(9).Should().Be(8); + + IndexRangeDictionary.AlignTowardsZero(-0).Should().Be(-0); + IndexRangeDictionary.AlignTowardsZero(-1).Should().Be(-0); + IndexRangeDictionary.AlignTowardsZero(-7).Should().Be(-0); + IndexRangeDictionary.AlignTowardsZero(-8).Should().Be(-8); + IndexRangeDictionary.AlignTowardsZero(-9).Should().Be(-8); + } + + [TestMethod] + public void CanAddBasicItem() + { + var d = new IndexRangeDictionary(); + d[0] = "Item1"; + d[0].Should().Be("Item1"); + d._minKey.Should().Be(0); + d._maxKey.Should().Be(0); + d._items.Length.Should().Be(8); + } + + [TestMethod] + public void CanAddOffsetItem() + { + var d = new IndexRangeDictionary(); + d[10] = "Item1"; + d[10].Should().Be("Item1"); + d._minKey.Should().Be(8); + d._maxKey.Should().Be(16); + d._items.Length.Should().Be(16); + } + + [TestMethod] + public void CanAddSparseRange() + { + var d = new IndexRangeDictionary(); + d[10] = "Item1"; + d[10].Should().Be("Item1"); + d._minKey.Should().Be(8); + d._maxKey.Should().Be(16); + d._items.Length.Should().Be(16); + d[20] = "Item2"; + d[10].Should().Be("Item1"); + d[20].Should().Be("Item2"); + d._minKey.Should().Be(8); + d._maxKey.Should().Be(24); + d._items.Length.Should().Be(32); + d[5].Should().BeNull(); + d[10].Should().Be("Item1"); + d[15].Should().BeNull(); + d[19].Should().BeNull(); + d[20].Should().Be("Item2"); + d[21].Should().BeNull(); + } + + [TestMethod] + public void CanAddMaxBeforeMin() + { + var d = new IndexRangeDictionary(); + d[20] = "Item1"; + d[20].Should().Be("Item1"); + d[10] = "Item2"; + d[10].Should().Be("Item2"); + d[20] = "Item1"; + d[20].Should().Be("Item1"); + } + + [TestMethod] + public void ShiftShouldBeEmpty() + { + var d = new IndexRangeDictionary(); + d[2] = "Item2"; + d[2].Should().Be("Item2"); + d[0] = "Item0"; + d[0].Should().Be("Item0"); + d[1].Should().BeNull(); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/AssemblySymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/AssemblySymbolTests.cs new file mode 100644 index 0000000000..75f223a39b --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/AssemblySymbolTests.cs @@ -0,0 +1,25 @@ +using FluentAssertions; + +using IKVM.CoreLib.Symbols; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols +{ + + public abstract class AssemblySymbolTests + where TInit : SymbolTestInit, new() + where TSymbols : SymbolContext + { + + protected TInit Init { get; } = new TInit(); + + [TestMethod] + public void SystemObjectShouldNotBeNull() + { + Init.Symbols.ResolveCoreType("System.Object").Should().NotBeNull(); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Emit/AssemblySymbolBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Emit/AssemblySymbolBuilderTests.cs new file mode 100644 index 0000000000..c92c0ff216 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Emit/AssemblySymbolBuilderTests.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Immutable; + +using FluentAssertions; + +using IKVM.CoreLib.Symbols; +using IKVM.CoreLib.Symbols.Emit; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Emit +{ + + public abstract class AssemblySymbolBuilderTests + where TInit : SymbolTestInit, new() + where TSymbols: SymbolContext + { + + protected TInit Init { get; } = new TInit(); + + [TestMethod] + public void ThrowsOnFreeze() + { + var a = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + a.Freeze(); + a.Invoking(_ => _.DefineModule("Test.dll", "Test.dll")).Should().ThrowExactly(); + } + + [TestMethod] + public void CanDefineModule() + { + var a = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + a.FullName.Should().Be("Test, Version=0.0.0.0, PublicKeyToken=null"); + var m = a.DefineModule("Test.dll", "Test.dll"); + m.Name.Should().Be("Test.dll"); + m.ScopeName.Should().Be("Test.dll"); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Emit/ModuleSymbolBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Emit/ModuleSymbolBuilderTests.cs new file mode 100644 index 0000000000..e49d52063b --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Emit/ModuleSymbolBuilderTests.cs @@ -0,0 +1,61 @@ +using System; +using System.Reflection; +using System.Reflection.Emit; + +using FluentAssertions; + +using IKVM.CoreLib.Symbols; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Emit +{ + + public abstract class ModuleSymbolBuilderTests + where TInit : SymbolTestInit, new() + where TSymbols: SymbolContext + { + + protected TInit Init { get; } = new TInit(); + + [TestMethod] + public void ThrowsOnFreeze() + { + var a = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = a.DefineModule("Test.dll", "Test.dll"); + m.Freeze(); + m.Invoking(_ => _.DefineType("Namespace.TestType", TypeAttributes.Public)).Should().ThrowExactly(); + } + + [TestMethod] + public void CanDefineGlobalMethod() + { + var a = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = a.DefineModule("Test.dll", "Test.dll"); + var f = m.DefineGlobalMethod("TestMethod", MethodAttributes.Public | MethodAttributes.Static, null, []); + f.Name.Should().Be("TestMethod"); + f.Module.Should().Be(m); + f.Assembly.Should().Be(a); + f.Attributes.Should().HaveFlag(MethodAttributes.Public); + f.Attributes.Should().HaveFlag(MethodAttributes.Static); + var il = f.GetILGenerator(); + il.Emit(OpCodes.Ret); + } + + [TestMethod] + public void CanDefineType() + { + var a = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = a.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType", TypeAttributes.Public); + t.Assembly.Should().Be(a); + t.Module.Should().Be(m); + t.Name.Should().Be("TestType"); + t.FullName.Should().Be("Namespace.TestType"); + t.Attributes.Should().HaveFlag(TypeAttributes.Public); + t.Attributes.Should().HaveFlag(TypeAttributes.Class); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Emit/TypeSymbolBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Emit/TypeSymbolBuilderTests.cs new file mode 100644 index 0000000000..1ea71977bb --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Emit/TypeSymbolBuilderTests.cs @@ -0,0 +1,64 @@ +using System; +using System.Reflection; +using System.Reflection.Emit; + +using FluentAssertions; + +using IKVM.CoreLib.Symbols; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Emit +{ + + public abstract class TypeSymbolBuilderTests + where TInit : SymbolTestInit, new() + where TSymbols: SymbolContext + { + + protected TInit Init { get; } = new TInit(); + + [TestMethod] + public void ThrowsOnFreeze() + { + var a = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = a.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Test"); + t.Freeze(); + t.Invoking(_ => _.SetParent(null)).Should().ThrowExactly(); + } + + [TestMethod] + public void CanDefineMethod() + { + var a = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = a.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Test"); + var f = t.DefineMethod("TestMethod", MethodAttributes.Public | MethodAttributes.Static, null, []); + f.Name.Should().Be("TestMethod"); + f.Module.Should().Be(m); + f.Assembly.Should().Be(a); + f.Attributes.Should().HaveFlag(MethodAttributes.Public); + f.Attributes.Should().HaveFlag(MethodAttributes.Static); + var il = f.GetILGenerator(); + il.Emit(OpCodes.Ret); + } + + [TestMethod] + public void CanDefineNestedType() + { + var a = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = a.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType", TypeAttributes.Public); + var n = t.DefineNestedType("NestedType"); + n.Assembly.Should().Be(a); + n.Module.Should().Be(m); + n.Name.Should().Be("NestedType"); + n.FullName.Should().Be("Namespace.TestType+NestedType"); + n.Attributes.Should().HaveFlag(TypeAttributes.Public); + n.Attributes.Should().HaveFlag(TypeAttributes.Class); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionAssemblyBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionAssemblyBuilderTests.cs new file mode 100644 index 0000000000..4edbf8c993 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionAssemblyBuilderTests.cs @@ -0,0 +1,58 @@ +using FluentAssertions; + +using IKVM.CoreLib.Symbols; +using IKVM.CoreLib.Symbols.IkvmReflection; +using IKVM.CoreLib.Tests.Symbols.Emit; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.IkvmReflection.Emit +{ + + [TestClass] + public class IkvmReflectionAssemblyBuilderTests : AssemblySymbolBuilderTests + { + + [TestMethod] + public void CanDeclareAssembly() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + b.FullName.Should().Be("Test, Version=0.0.0.0, PublicKeyToken=null"); + var a = Init.Symbols.ResolveAssembly(b, IkvmReflectionSymbolState.Declared); + a.FullName.Should().Be("Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"); + a.GetName().Name.Should().Be("Test"); + a.GetName().FullName.Should().Be("Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"); + a.GetName().Version.Should().Be(new System.Version("0.0.0.0")); + a.GetName().CultureName.Should().Be(""); + a.GetName().GetPublicKeyToken().Should().BeEmpty(); + } + + [TestMethod] + public void CanFinishAssembly() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + b.FullName.Should().Be("Test, Version=0.0.0.0, PublicKeyToken=null"); + var a = Init.Symbols.ResolveAssembly(b, IkvmReflectionSymbolState.Finished); + a.FullName.Should().Be("Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"); + a.GetName().Name.Should().Be("Test"); + a.GetName().FullName.Should().Be("Test, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"); + a.GetName().Version.Should().Be(new System.Version("0.0.0.0")); + a.GetName().CultureName.Should().Be(""); + a.GetName().GetPublicKeyToken().Should().BeEmpty(); + } + + [TestMethod] + public void ShouldDeclareModuleOnFinish() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + b.FullName.Should().Be("Test, Version=0.0.0.0, PublicKeyToken=null"); + b.DefineModule("Test.dll", "Test.dll"); + var a = Init.Symbols.ResolveAssembly(b, IkvmReflectionSymbolState.Finished); + var m = a.GetModule("Test.dll"); + m.Assembly.Should().BeSameAs(a); + m.Name.Should().Be("Test.dll"); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionModuleBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionModuleBuilderTests.cs new file mode 100644 index 0000000000..465e1031ff --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionModuleBuilderTests.cs @@ -0,0 +1,32 @@ +using FluentAssertions; + +using IKVM.CoreLib.Symbols; +using IKVM.CoreLib.Symbols.IkvmReflection; +using IKVM.CoreLib.Tests.Symbols.Emit; +using IKVM.Reflection.Emit; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.IkvmReflection.Emit +{ + + [TestClass] + public class IkvmReflectionModuleBuilderTests : ModuleSymbolBuilderTests + { + + [TestMethod] + public void ShouldReturnTypeBuilderOnFinish() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = b.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType"); + var z = Init.Symbols.ResolveType((TypeSymbol)t, IkvmReflectionSymbolState.Finished); + z.Should().BeOfType(); + z.Namespace.Should().Be("Namespace"); + z.Name.Should().Be("TestType"); + z.FullName.Should().Be("Namespace.TestType"); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionTypeBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionTypeBuilderTests.cs new file mode 100644 index 0000000000..a8ef2778bc --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/Emit/IkvmReflectionTypeBuilderTests.cs @@ -0,0 +1,123 @@ +using FluentAssertions; + +using IKVM.CoreLib.Symbols; +using IKVM.CoreLib.Symbols.IkvmReflection; +using IKVM.CoreLib.Tests.Symbols.Emit; +using IKVM.Reflection; +using IKVM.Reflection.Emit; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +using Type = IKVM.Reflection.Type; + +namespace IKVM.CoreLib.Tests.Symbols.IkvmReflection.Emit +{ + + [TestClass] + public class IkvmReflectionTypeBuilderTests : TypeSymbolBuilderTests + { + + [TestMethod] + public void ShouldReturnTypeBuilderOnFinish() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = b.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType"); + var z = Init.Symbols.ResolveType((TypeSymbol)t, IkvmReflectionSymbolState.Finished); + z.Should().BeAssignableTo(); + z.Namespace.Should().Be("Namespace"); + z.Name.Should().Be("TestType"); + z.FullName.Should().Be("Namespace.TestType"); + } + + [TestMethod] + public void ShouldReturnTypeOnComplete() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = b.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType"); + var z = Init.Symbols.ResolveType((TypeSymbol)t, IkvmReflectionSymbolState.Completed); + z.Should().BeAssignableTo(); + z.Namespace.Should().Be("Namespace"); + z.Name.Should().Be("TestType"); + z.FullName.Should().Be("Namespace.TestType"); + } + + [TestMethod] + public void ShouldReturnMethodBuilderOnDeclare() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = b.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType"); + var j = t.DefineMethod("TestMethod", System.Reflection.MethodAttributes.Public); + var z = Init.Symbols.ResolveMethod((MethodSymbol)j, IkvmReflectionSymbolState.Declared); + z.Should().BeOfType(); + z.Name.Should().Be("TestMethod"); + } + + [TestMethod] + public void ShouldReturnMethodBuilderOnFinish() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = b.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType"); + var j = t.DefineMethod("TestMethod", System.Reflection.MethodAttributes.Public); + var z = Init.Symbols.ResolveMethod((MethodSymbol)j, IkvmReflectionSymbolState.Finished); + z.Should().BeOfType(); + z.Name.Should().Be("TestMethod"); + } + + [TestMethod] + public void ShouldReturnMethodInfoOnComplete() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = b.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType"); + var j = t.DefineMethod("TestMethod", System.Reflection.MethodAttributes.Public); + var z = Init.Symbols.ResolveMethod((MethodSymbol)j, IkvmReflectionSymbolState.Completed); + z.Should().BeAssignableTo(); + z.Should().NotBeSameAs(j); + z.Name.Should().Be("TestMethod"); + } + + [TestMethod] + public void ShouldDeclareFieldsInOrder() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = b.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType"); + var m1 = t.DefineField("TestField2", Init.Symbols.ResolveCoreType("System.Int32"), System.Reflection.FieldAttributes.Public); + var m2 = t.DefineField("TestField3", Init.Symbols.ResolveCoreType("System.Int32"), System.Reflection.FieldAttributes.Public); + var m3 = t.DefineField("TestField1", Init.Symbols.ResolveCoreType("System.Int32"), System.Reflection.FieldAttributes.Public); + var m4 = t.DefineField("TestField4", Init.Symbols.ResolveCoreType("System.Int32"), System.Reflection.FieldAttributes.Public); + var z = Init.Symbols.ResolveType(t, IkvmReflectionSymbolState.Finished); + var l = z.__GetDeclaredFields(); + l.Should().Satisfy( + i => i.Name == "TestField2", + i => i.Name == "TestField3", + i => i.Name == "TestField1", + i => i.Name == "TestField4"); + } + + [TestMethod] + public void ShouldDeclareMethodsInOrder() + { + var b = Init.Symbols.DefineAssembly(new AssemblyIdentity("Test"), []); + var m = b.DefineModule("Test.dll", "Test.dll"); + var t = m.DefineType("Namespace.TestType"); + var m1 = t.DefineMethod("TestMethod2", System.Reflection.MethodAttributes.Public); + var m2 = t.DefineMethod("TestMethod3", System.Reflection.MethodAttributes.Public); + var m3 = t.DefineMethod("TestMethod1", System.Reflection.MethodAttributes.Public); + var m4 = t.DefineMethod("TestMethod4", System.Reflection.MethodAttributes.Public); + var z = Init.Symbols.ResolveType(t, IkvmReflectionSymbolState.Finished); + var l = z.__GetDeclaredMethods(); + l.Should().Satisfy( + i => i.Name == "TestMethod2", + i => i.Name == "TestMethod3", + i => i.Name == "TestMethod1", + i => i.Name == "TestMethod4"); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionAssemblySymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionAssemblySymbolTests.cs new file mode 100644 index 0000000000..ca332693a1 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionAssemblySymbolTests.cs @@ -0,0 +1,83 @@ +using System.Linq; + +using FluentAssertions; + +using IKVM.CoreLib.Symbols.IkvmReflection; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.IkvmReflection +{ + + [TestClass] + public class IkvmReflectionAssemblySymbolTests : AssemblySymbolTests + { + + [TestMethod] + public void ResolvedAssemblyShouldBeSame() + { + var a = Init.Universe.Load(typeof(TestClassAttribute).Assembly.GetName().Name); + var s = Init.Symbols.ResolveAssemblySymbol(a); + var s1 = Init.Symbols.ResolveAssemblySymbol(a); + s.Should().BeSameAs(s1); + } + + [TestMethod] + public void AssemblyPropertiesShouldMatch() + { + var a = Init.Universe.Load(typeof(TestClassAttribute).Assembly.GetName().Name); + var s = Init.Symbols.ResolveAssemblySymbol(a); + s.FullName.Should().Be(a.FullName); + s.Location.Should().Be(a.Location); + s.IsMissing.Should().BeFalse(); + } + + [TestMethod] + public void AssemblyIdentityShouldMatch() + { + var a = Init.Universe.Load(typeof(TestClassAttribute).Assembly.GetName().Name); + var s = Init.Symbols.ResolveAssemblySymbol(a); + s.Identity.Name.Should().Be(a.GetName().Name); + s.Identity.Version.Should().Be(a.GetName().Version); + s.Identity.CultureName.Should().Be(a.GetName().CultureName); + s.Identity.PublicKeyToken.Should().BeEquivalentTo(a.GetName().GetPublicKeyToken()); + } + + [TestMethod] + public void CanGetAssemblyModules() + { + var a = Init.Universe.Load(typeof(TestClassAttribute).Assembly.GetName().Name); + var s = Init.Symbols.ResolveAssemblySymbol(a); + var l = s.GetModules(); + l.Length.Should().Be(1); + l[0].Should().NotBeNull(); + l[0].Name.Should().Be("Microsoft.VisualStudio.TestPlatform.TestFramework.dll"); + } + + [TestMethod] + public void CanGetTypes() + { + var a = Init.Universe.Load(typeof(TestClassAttribute).Assembly.GetName().Name); + var s = Init.Symbols.ResolveAssemblySymbol(a); + var l = s.GetTypes(); + } + + [TestMethod] + public void CanGetCustomAttributes() + { + var a = Init.Universe.Load(typeof(TestClassAttribute).Assembly.GetName().Name); + var s = Init.Symbols.ResolveAssemblySymbol(a); + var l = s.GetCustomAttributes(true); + l.Should().HaveCountGreaterThan(5); + + var companyAttributeType = Init.Symbols.ResolveCoreType("System.Reflection.AssemblyCompanyAttribute"); + var companyAttribute = l.Single(e => e.AttributeType == companyAttributeType); + companyAttribute.NamedArguments.Should().HaveCount(0); + companyAttribute.ConstructorArguments.Should().HaveCount(1); + companyAttribute.ConstructorArguments[0].ArgumentType.Should().Be(Init.Symbols.ResolveCoreType("System.String")); + ((string?)companyAttribute.ConstructorArguments[0].Value).Should().Be("Microsoft Corporation"); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionModuleSymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionModuleSymbolTests.cs new file mode 100644 index 0000000000..c181886ef5 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionModuleSymbolTests.cs @@ -0,0 +1,16 @@ +using IKVM.CoreLib.Symbols.IkvmReflection; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.IkvmReflection +{ + + [TestClass] + public class IkvmReflectionModuleSymbolTests : ModuleSymbolTests + { + + + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionSymbolTestInit.cs b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionSymbolTestInit.cs new file mode 100644 index 0000000000..589822265d --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionSymbolTestInit.cs @@ -0,0 +1,79 @@ +using System.IO; +using System.Threading; + +using IKVM.CoreLib.Symbols.IkvmReflection; +using IKVM.Reflection; + +using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; + +namespace IKVM.CoreLib.Tests.Symbols.IkvmReflection +{ + + public class IkvmReflectionSymbolTestInit : SymbolTestInit + { + + Universe? _universe; + IkvmReflectionSymbolContext? _symbols; + + /// + /// Gets the universe of types. + /// + public Universe Universe + { + get + { + if (_universe == null) + { + var universe = new Universe(typeof(object).Assembly.GetName().Name); + universe.AssemblyResolve += Universe_AssemblyResolve; + Interlocked.CompareExchange(ref _universe, universe, null); + } + + return _universe; + } + } + + /// + /// Gets the symbol context. + /// + public override IkvmReflectionSymbolContext Symbols + { + get + { + if (_symbols == null) + { + var coreAssembly = Universe.LoadFile(typeof(object).Assembly.GetAssemblyLocation()); + var thisAssembly = Universe.LoadFile(typeof(IkvmReflectionModuleSymbolTests).Assembly.GetAssemblyLocation()); + var symbols = new IkvmReflectionSymbolContext(Universe!, new IkvmReflectionSymbolOptions(true)); + Interlocked.CompareExchange(ref _symbols, symbols, null); + } + + return _symbols; + } + } + + /// + /// Attempt to load assembly from system. + /// + /// + /// + /// + Assembly? Universe_AssemblyResolve(object sender, ResolveEventArgs args) + { + try + { + var asm = System.Reflection.Assembly.Load(args.Name); + if (asm != null && File.Exists(asm.Location)) + return _universe!.LoadFile(asm.Location); + } + catch + { + + } + + return null; + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionSymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionSymbolTests.cs deleted file mode 100644 index c683fdbb12..0000000000 --- a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionSymbolTests.cs +++ /dev/null @@ -1,199 +0,0 @@ -using System.IO; - -using FluentAssertions; - -using IKVM.CoreLib.Symbols.IkvmReflection; -using IKVM.Reflection; - -using Microsoft.VisualStudio.TestPlatform.PlatformAbstractions; -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace IKVM.CoreLib.Tests.Symbols.IkvmReflection -{ - - [TestClass] - public class IkvmReflectionSymbolTests - { - - class Foo - { - - T? field; - - bool Method(int p1) => true; - - } - - Universe? universe; - Assembly? coreAssembly; - Assembly? thisAssembly; - - [TestInitialize] - public void Setup() - { - universe = new Universe(typeof(object).Assembly.GetName().Name); - universe.AssemblyResolve += Universe_AssemblyResolve; - coreAssembly = universe.LoadFile(typeof(object).Assembly.GetAssemblyLocation()); - thisAssembly = universe.LoadFile(typeof(IkvmReflectionSymbolTests).Assembly.GetAssemblyLocation()); - } - - /// - /// Attempt to load assembly from system. - /// - /// - /// - /// - Assembly? Universe_AssemblyResolve(object sender, ResolveEventArgs args) - { - try - { - var asm = System.Reflection.Assembly.Load(args.Name); - if (asm != null && File.Exists(asm.Location)) - return universe!.LoadFile(asm.Location); - } - catch - { - - } - - return null; - } - - [TestMethod] - public void SameTypeShouldBeSame() - { - var c = new IkvmReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(universe!.GetBuiltInType("System", "Object")); - var s2 = c.GetOrCreateTypeSymbol(universe!.GetBuiltInType("System", "Object")); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void GenericTypeDefinitionShouldBeSame() - { - var t = thisAssembly!.GetType("IKVM.CoreLib.Tests.Symbols.IkvmReflection.IkvmReflectionSymbolTests+Foo`1"); - var c = new IkvmReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(t); - var s2 = c.GetOrCreateTypeSymbol(t); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void GenericTypeShouldBeSame() - { - var t = thisAssembly!.GetType("IKVM.CoreLib.Tests.Symbols.IkvmReflection.IkvmReflectionSymbolTests+Foo`1").MakeGenericType(universe!.GetBuiltInType("System", "Int32")); - var c = new IkvmReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(t); - var s2 = c.GetOrCreateTypeSymbol(t); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void ArrayTypeShouldBeSame() - { - var t = universe!.GetBuiltInType("System", "Object").MakeArrayType(2); - var c = new IkvmReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(t); - var s2 = c.GetOrCreateTypeSymbol(t); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void SZArrayTypeShouldBeSame() - { - var t = universe!.GetBuiltInType("System", "Object").MakeArrayType(); - var c = new IkvmReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(t); - var s2 = c.GetOrCreateTypeSymbol(t); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public unsafe void PointerTypeShouldBeSame() - { - var t = universe!.GetBuiltInType("System", "Int32").MakePointerType(); - var c = new IkvmReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(t); - var s2 = c.GetOrCreateTypeSymbol(t); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public unsafe void ByRefTypeShouldBeSame() - { - var t = universe!.GetBuiltInType("System", "Int32").MakeByRefType(); - var c = new IkvmReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(t); - var s2 = c.GetOrCreateTypeSymbol(t); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void EnumTypeShouldBeSame() - { - var a = universe!.Load(typeof(System.AttributeTargets).Assembly.FullName); - var t = a.GetType("System.AttributeTargets"); - var c = new IkvmReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(t); - var s2 = c.GetOrCreateTypeSymbol(t); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void CanGetType() - { - var t = universe!.GetBuiltInType("System", "Object"); - var c = new IkvmReflectionSymbolContext(); - var s = c.GetOrCreateTypeSymbol(t); - s.Name.Should().Be("Object"); - s.FullName.Should().Be("System.Object"); - } - - [TestMethod] - public void CanGetFieldOfGenericTypeDefinition() - { - var t = thisAssembly!.GetType("IKVM.CoreLib.Tests.Symbols.IkvmReflection.IkvmReflectionSymbolTests+Foo`1"); - var c = new IkvmReflectionSymbolContext(); - var s = c.GetOrCreateTypeSymbol(t); - s.IsGenericType.Should().BeTrue(); - s.IsGenericTypeDefinition.Should().BeTrue(); - var f = s.GetField("field", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - f.Name.Should().Be("field"); - f.FieldType.IsGenericType.Should().BeFalse(); - f.FieldType.IsGenericParameter.Should().BeTrue(); - } - - [TestMethod] - public void CanGetFieldOfGenericType() - { - var t = thisAssembly!.GetType("IKVM.CoreLib.Tests.Symbols.IkvmReflection.IkvmReflectionSymbolTests+Foo`1").MakeGenericType(universe!.GetBuiltInType("System", "Int32")); - var c = new IkvmReflectionSymbolContext(); - var s = c.GetOrCreateTypeSymbol(t); - s.IsGenericType.Should().BeTrue(); - s.IsGenericTypeDefinition.Should().BeFalse(); - var f = s.GetField("field", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - f.Name.Should().Be("field"); - f.FieldType.IsGenericType.Should().BeFalse(); - f.FieldType.IsGenericParameter.Should().BeFalse(); - f.FieldType.Should().BeSameAs(c.GetOrCreateTypeSymbol(universe!.GetBuiltInType("System", "Int32"))); - } - - [TestMethod] - public void CanGetMethod() - { - var t = universe!.GetBuiltInType("System", "Object"); - var c = new IkvmReflectionSymbolContext(); - var s = c.GetOrCreateTypeSymbol(t); - var m = s.GetMethod("ToString"); - m.Name.Should().Be("ToString"); - m.ReturnType.Should().BeSameAs(c.GetOrCreateTypeSymbol(universe!.GetBuiltInType("System", "String"))); - m.ReturnParameter.ParameterType.Should().BeSameAs(c.GetOrCreateTypeSymbol(universe!.GetBuiltInType("System", "String"))); - m.IsGenericMethod.Should().BeFalse(); - m.IsGenericMethodDefinition.Should().BeFalse(); - m.IsPublic.Should().BeTrue(); - m.IsPrivate.Should().BeFalse(); - } - - } - -} diff --git a/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionTypeSymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionTypeSymbolTests.cs new file mode 100644 index 0000000000..5263731301 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/IkvmReflection/IkvmReflectionTypeSymbolTests.cs @@ -0,0 +1,20 @@ +using IKVM.CoreLib.Symbols.IkvmReflection; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.IkvmReflection +{ + + [TestClass] + public class IkvmReflectionTypeSymbolTests : TypeSymbolTests + { + + [TestMethod] + public void DoNothing() + { + + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/ModuleSymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/ModuleSymbolTests.cs new file mode 100644 index 0000000000..f676950b50 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/ModuleSymbolTests.cs @@ -0,0 +1,77 @@ +using FluentAssertions; + +using IKVM.CoreLib.Symbols; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols +{ + + [TestClass] + public abstract class ModuleSymbolTests + where TInit : SymbolTestInit, new() + where TSymbols : SymbolContext + { + + protected TInit Init { get; } = new TInit(); + + [TestMethod] + public void CanResolve() + { + var m = Init.Symbols.ResolveCoreType("System.Object").Module; + m.Name.Should().Be(typeof(object).Module.Name); + } + + [TestMethod] + public void ShouldBeSame() + { + var s1 = Init.Symbols.ResolveCoreType("System.Object").Module; + var s2 = Init.Symbols.ResolveCoreType("System.Object").Module; + s1.Should().BeSameAs(s2); + } + + [TestMethod] + public void PropertiesShouldMatch() + { + var m = typeof(object).Module; + var s = Init.Symbols.ResolveCoreType("System.Object").Module; + s.Name.Should().Be(m.Name); + s.IsMissing.Should().BeFalse(); + s.FullyQualifiedName.Should().Be(m.FullyQualifiedName); + } + + [TestMethod] + public void CanGetFields() + { + var m = typeof(object).Module; + var s = Init.Symbols.ResolveCoreType("System.Object").Module; + var l = s.GetFields(); + } + + [TestMethod] + public void CanGetMethods() + { + var m = typeof(object).Module; + var s = Init.Symbols.ResolveCoreType("System.Object").Module; + var l = s.GetMethods(); + } + + [TestMethod] + public void CanGetTypes() + { + var m = typeof(object).Module; + var s = Init.Symbols.ResolveCoreType("System.Object").Module; + var l = s.GetTypes(); + } + + [TestMethod] + public void CanGetCustomAttributes() + { + var m = typeof(object).Module; + var s = Init.Symbols.ResolveCoreType("System.Object").Module; + var l = s.GetCustomAttributes(true); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionAssemblyBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionAssemblyBuilderTests.cs new file mode 100644 index 0000000000..6ea6718dc0 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionAssemblyBuilderTests.cs @@ -0,0 +1,17 @@ +using IKVM.CoreLib.Symbols.Reflection; +using IKVM.CoreLib.Tests.Symbols.Emit; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Reflection.Emit +{ + + [TestClass] + public class ReflectionAssemblyBuilderTests : AssemblySymbolBuilderTests + { + + + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionModuleBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionModuleBuilderTests.cs new file mode 100644 index 0000000000..7252b59c10 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionModuleBuilderTests.cs @@ -0,0 +1,17 @@ +using IKVM.CoreLib.Symbols.Reflection; +using IKVM.CoreLib.Tests.Symbols.Emit; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Reflection.Emit +{ + + [TestClass] + public class ReflectionModuleBuilderTests : ModuleSymbolBuilderTests + { + + + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionTypeBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionTypeBuilderTests.cs new file mode 100644 index 0000000000..0e278511d0 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Reflection/Emit/ReflectionTypeBuilderTests.cs @@ -0,0 +1,17 @@ +using IKVM.CoreLib.Symbols.Reflection; +using IKVM.CoreLib.Tests.Symbols.Emit; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Reflection.Emit +{ + + [TestClass] + public class ReflectionTypeBuilderTests : TypeSymbolBuilderTests + { + + + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionAssemblySymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionAssemblySymbolTests.cs new file mode 100644 index 0000000000..0c78b17e42 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionAssemblySymbolTests.cs @@ -0,0 +1,83 @@ +using System.Linq; + +using FluentAssertions; + +using IKVM.CoreLib.Symbols.Reflection; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Reflection +{ + + [TestClass] + public class ReflectionAssemblySymbolTests : AssemblySymbolTests + { + + [TestMethod] + public void ResolvedAssemblyShouldBeSame() + { + var a = typeof(TestClassAttribute).Assembly; + var s = Init.Symbols.ResolveAssemblySymbol(a); + var s1 = Init.Symbols.ResolveAssemblySymbol(a); + s.Should().BeSameAs(s1); + } + + [TestMethod] + public void AssemblyPropertiesShouldMatch() + { + var a = typeof(TestClassAttribute).Assembly; + var s = Init.Symbols.ResolveAssemblySymbol(a); + s.FullName.Should().Be(a.FullName); + s.Location.Should().Be(a.Location); + s.IsMissing.Should().BeFalse(); + } + + [TestMethod] + public void AssemblyIdentityShouldMatch() + { + var a = typeof(TestClassAttribute).Assembly; + var s = Init.Symbols.ResolveAssemblySymbol(a); + s.Identity.Name.Should().Be(a.GetName().Name); + s.Identity.Version.Should().Be(a.GetName().Version); + s.Identity.CultureName.Should().Be(a.GetName().CultureName); + s.Identity.PublicKeyToken.Should().BeEquivalentTo(a.GetName().GetPublicKeyToken()); + } + + [TestMethod] + public void CanGetAssemblyModules() + { + var a = typeof(TestClassAttribute).Assembly; + var s = Init.Symbols.ResolveAssemblySymbol(a); + var l = s.GetModules(); + l.Length.Should().Be(1); + l[0].Should().NotBeNull(); + l[0].Name.Should().Be("Microsoft.VisualStudio.TestPlatform.TestFramework.dll"); + } + + [TestMethod] + public void CanGetTypes() + { + var a = typeof(TestClassAttribute).Assembly; + var s = Init.Symbols.ResolveAssemblySymbol(a); + var l = s.GetTypes(); + } + + [TestMethod] + public void CanGetCustomAttributes() + { + var a = typeof(TestClassAttribute).Assembly; + var s = Init.Symbols.ResolveAssemblySymbol(a); + var l = s.GetCustomAttributes(true); + l.Should().HaveCountGreaterThan(5); + + var companyAttributeType = Init.Symbols.ResolveCoreType("System.Reflection.AssemblyCompanyAttribute"); + var companyAttribute = l.Single(e => e.AttributeType == companyAttributeType); + companyAttribute.NamedArguments.Should().HaveCount(0); + companyAttribute.ConstructorArguments.Should().HaveCount(1); + companyAttribute.ConstructorArguments[0].ArgumentType.Should().Be(Init.Symbols.ResolveCoreType("System.String")); + ((string?)companyAttribute.ConstructorArguments[0].Value).Should().Be("Microsoft Corporation"); + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionModuleSymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionModuleSymbolTests.cs new file mode 100644 index 0000000000..c442528857 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionModuleSymbolTests.cs @@ -0,0 +1,16 @@ +using IKVM.CoreLib.Symbols.Reflection; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Reflection +{ + + [TestClass] + public class ReflectionModuleSymbolTests : ModuleSymbolTests + { + + + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionSymbolTestInit.cs b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionSymbolTestInit.cs new file mode 100644 index 0000000000..d61361f298 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionSymbolTestInit.cs @@ -0,0 +1,29 @@ +using System.Threading; + +using IKVM.CoreLib.Symbols.Reflection; + +namespace IKVM.CoreLib.Tests.Symbols.Reflection +{ + + public class ReflectionSymbolTestInit : SymbolTestInit + { + + ReflectionSymbolContext? _symbols; + + /// + /// Gets the symbol context. + /// + public override ReflectionSymbolContext Symbols + { + get + { + if (_symbols == null) + Interlocked.CompareExchange(ref _symbols, new ReflectionSymbolContext(typeof(object).Assembly, new ReflectionSymbolOptions(true)), null); + + return _symbols; + } + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionSymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionSymbolTests.cs deleted file mode 100644 index 37b66bf096..0000000000 --- a/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionSymbolTests.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; - -using FluentAssertions; - -using IKVM.CoreLib.Symbols.Reflection; - -using Microsoft.VisualStudio.TestTools.UnitTesting; - -namespace IKVM.CoreLib.Tests.Symbols.Reflection -{ - - [TestClass] - public class ReflectionSymbolTests - { - - class Foo - { - T? field; - } - - [TestMethod] - public void SameTypeShouldBeSame() - { - var c = new ReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(typeof(object)); - var s2 = c.GetOrCreateTypeSymbol(typeof(object)); - s1.Should().BeOfType(); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void GenericTypeDefinitionShouldBeSame() - { - var c = new ReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(typeof(Foo<>)); - var s2 = c.GetOrCreateTypeSymbol(typeof(Foo<>)); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void GenericTypeShouldBeSame() - { - var c = new ReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(typeof(Foo)); - var s2 = c.GetOrCreateTypeSymbol(typeof(Foo)); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void ArrayTypeShouldBeSame() - { - var c = new ReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(typeof(object[,])); - var s2 = c.GetOrCreateTypeSymbol(typeof(object[,])); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void SZArrayTypeShouldBeSame() - { - var c = new ReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(typeof(object[])); - var s2 = c.GetOrCreateTypeSymbol(typeof(object[])); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public unsafe void PointerTypeShouldBeSame() - { - var c = new ReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(typeof(int*)); - var s2 = c.GetOrCreateTypeSymbol(typeof(int*)); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public unsafe void ByRefTypeShouldBeSame() - { - var c = new ReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(typeof(int).MakeByRefType()); - var s2 = c.GetOrCreateTypeSymbol(typeof(int).MakeByRefType()); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void EnumTypeShouldBeSame() - { - var c = new ReflectionSymbolContext(); - var s1 = c.GetOrCreateTypeSymbol(typeof(AttributeTargets)); - var s2 = c.GetOrCreateTypeSymbol(typeof(AttributeTargets)); - s1.Should().BeSameAs(s2); - } - - [TestMethod] - public void CanGetType() - { - var c = new ReflectionSymbolContext(); - var s = c.GetOrCreateTypeSymbol(typeof(object)); - s.Name.Should().Be("Object"); - s.FullName.Should().Be("System.Object"); - } - - [TestMethod] - public void CanGetFieldOfGenericTypeDefinition() - { - var c = new ReflectionSymbolContext(); - var s = c.GetOrCreateTypeSymbol(typeof(Foo<>)); - s.IsGenericType.Should().BeTrue(); - s.IsGenericTypeDefinition.Should().BeTrue(); - var f = s.GetField("field", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - f.Name.Should().Be("field"); - f.FieldType.IsGenericType.Should().BeFalse(); - f.FieldType.IsGenericParameter.Should().BeTrue(); - } - - [TestMethod] - public void CanGetFieldOfGenericType() - { - var c = new ReflectionSymbolContext(); - var s = c.GetOrCreateTypeSymbol(typeof(Foo)); - s.IsGenericType.Should().BeTrue(); - s.IsGenericTypeDefinition.Should().BeFalse(); - var f = s.GetField("field", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); - f.Name.Should().Be("field"); - f.FieldType.IsGenericType.Should().BeFalse(); - f.FieldType.IsGenericParameter.Should().BeFalse(); - f.FieldType.Should().BeSameAs(c.GetOrCreateTypeSymbol(typeof(int))); - } - - [TestMethod] - public void CanGetMethod() - { - var c = new ReflectionSymbolContext(); - var s = c.GetOrCreateTypeSymbol(typeof(object)); - var m = s.GetMethod("ToString"); - m.Name.Should().Be("ToString"); - m.ReturnType.Should().BeSameAs(c.GetOrCreateTypeSymbol(typeof(string))); - m.ReturnParameter.ParameterType.Should().BeSameAs(c.GetOrCreateTypeSymbol(typeof(string))); - m.IsGenericMethod.Should().BeFalse(); - m.IsGenericMethodDefinition.Should().BeFalse(); - m.IsPublic.Should().BeTrue(); - m.IsPrivate.Should().BeFalse(); - } - - } - -} diff --git a/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionTypeSymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionTypeSymbolTests.cs new file mode 100644 index 0000000000..04cbd5a0f6 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/Reflection/ReflectionTypeSymbolTests.cs @@ -0,0 +1,20 @@ +using IKVM.CoreLib.Symbols.Reflection; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols.Reflection +{ + + [TestClass] + public class ReflectionTypeSymbolTests : TypeSymbolTests + { + + [TestMethod] + public void DoNothing() + { + + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/SymbolTestInit.cs b/src/IKVM.CoreLib.Tests/Symbols/SymbolTestInit.cs new file mode 100644 index 0000000000..064ac386d8 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/SymbolTestInit.cs @@ -0,0 +1,13 @@ +using IKVM.CoreLib.Symbols; + +namespace IKVM.CoreLib.Tests.Symbols +{ + + public abstract class SymbolTestInit where TSymbols : SymbolContext + { + + public abstract TSymbols Symbols { get; } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/TypeSymbolNameBuilderTests.cs b/src/IKVM.CoreLib.Tests/Symbols/TypeSymbolNameBuilderTests.cs new file mode 100644 index 0000000000..1de28332da --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/TypeSymbolNameBuilderTests.cs @@ -0,0 +1,18 @@ +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols +{ + + [TestClass] + public class TypeSymbolNameBuilderTests + { + + [TestMethod] + public void Foo() + { + + } + + } + +} diff --git a/src/IKVM.CoreLib.Tests/Symbols/TypeSymbolTests.cs b/src/IKVM.CoreLib.Tests/Symbols/TypeSymbolTests.cs new file mode 100644 index 0000000000..23c86d5aa1 --- /dev/null +++ b/src/IKVM.CoreLib.Tests/Symbols/TypeSymbolTests.cs @@ -0,0 +1,412 @@ +using System.Collections.Generic; +using System.Reflection; + +using FluentAssertions; + +using IKVM.CoreLib.Symbols; + +using Microsoft.VisualStudio.TestTools.UnitTesting; + +namespace IKVM.CoreLib.Tests.Symbols +{ + + /// + /// Base class for some tests that interact with . + /// + public abstract class TypeSymbolTests + where TInit : SymbolTestInit, new() + where TSymbols : SymbolContext + { + + protected TInit Init { get; } = new TInit(); + + [TestMethod] + public void SystemObjectPropertiesShouldMatch() + { + var s = Init.Symbols.ResolveCoreType("System.Object"); + s.AssemblyQualifiedName.Should().Be(typeof(object).AssemblyQualifiedName); + s.Name.Should().Be(typeof(object).Name); + s.Namespace.Should().Be(typeof(object).Namespace); + s.FullName.Should().Be(typeof(object).FullName); + s.BaseType.Should().BeNull(); + s.HasElementType.Should().BeFalse(); + s.IsAbstract.Should().BeFalse(); + s.IsArray.Should().BeFalse(); + s.IsAutoLayout.Should().BeTrue(); + s.IsByRef.Should().BeFalse(); + s.IsClass.Should().BeTrue(); + s.IsConstructedGenericType.Should().BeFalse(); + s.IsEnum.Should().BeFalse(); + s.IsExplicitLayout.Should().BeFalse(); + s.IsFunctionPointer.Should().BeFalse(); + s.IsGenericMethodParameter.Should().BeFalse(); + s.IsGenericParameter.Should().BeFalse(); + s.IsGenericType.Should().BeFalse(); + s.IsGenericTypeDefinition.Should().BeFalse(); + s.IsGenericTypeParameter.Should().BeFalse(); + s.IsInterface.Should().BeFalse(); + s.IsLayoutSequential.Should().BeFalse(); + s.IsMissing.Should().BeFalse(); + s.IsNested.Should().BeFalse(); + s.IsNestedAssembly.Should().BeFalse(); + s.IsNestedFamANDAssem.Should().BeFalse(); + s.IsNestedFamily.Should().BeFalse(); + s.IsNestedFamORAssem.Should().BeFalse(); + s.IsNestedPrivate.Should().BeFalse(); + s.IsNestedPublic.Should().BeFalse(); + s.IsNotPublic.Should().BeFalse(); + s.IsPointer.Should().BeFalse(); + s.IsPrimitive.Should().BeFalse(); + s.IsPublic.Should().BeTrue(); + s.IsSealed.Should().BeFalse(); + s.IsSerializable.Should().BeTrue(); + s.IsSZArray.Should().BeFalse(); + s.IsTypeDefinition.Should().BeTrue(); + s.IsUnmanagedFunctionPointer.Should().BeFalse(); + s.IsValueType.Should().BeFalse(); + s.IsVisible.Should().BeTrue(); + s.ToString().Should().Be(typeof(object).ToString()); + s.GetCustomAttributes(true); + } + + [TestMethod] + public void ShouldInt32PropertiesShouldMatch() + { + var s = Init.Symbols.ResolveCoreType("System.Int32"); + s.AssemblyQualifiedName.Should().Be(typeof(int).AssemblyQualifiedName); + s.Name.Should().Be(typeof(int).Name); + s.Namespace.Should().Be(typeof(int).Namespace); + s.FullName.Should().Be(typeof(int).FullName); + s.BaseType.Should().Be(Init.Symbols.ResolveCoreType("System.ValueType")); + s.HasElementType.Should().BeFalse(); + s.IsAbstract.Should().BeFalse(); + s.IsArray.Should().BeFalse(); + s.IsAutoLayout.Should().BeFalse(); + s.IsByRef.Should().BeFalse(); + s.IsClass.Should().BeFalse(); + s.IsConstructedGenericType.Should().BeFalse(); + s.IsEnum.Should().BeFalse(); + s.IsExplicitLayout.Should().BeFalse(); + s.IsFunctionPointer.Should().BeFalse(); + s.IsGenericMethodParameter.Should().BeFalse(); + s.IsGenericParameter.Should().BeFalse(); + s.IsGenericType.Should().BeFalse(); + s.IsGenericTypeDefinition.Should().BeFalse(); + s.IsGenericTypeParameter.Should().BeFalse(); + s.IsInterface.Should().BeFalse(); + s.IsLayoutSequential.Should().BeTrue(); + s.IsMissing.Should().BeFalse(); + s.IsNested.Should().BeFalse(); + s.IsNestedAssembly.Should().BeFalse(); + s.IsNestedFamANDAssem.Should().BeFalse(); + s.IsNestedFamily.Should().BeFalse(); + s.IsNestedFamORAssem.Should().BeFalse(); + s.IsNestedPrivate.Should().BeFalse(); + s.IsNestedPublic.Should().BeFalse(); + s.IsNotPublic.Should().BeFalse(); + s.IsPointer.Should().BeFalse(); + s.IsPrimitive.Should().BeTrue(); + s.IsPublic.Should().BeTrue(); + s.IsSealed.Should().BeTrue(); + s.IsSerializable.Should().BeTrue(); + s.IsSZArray.Should().BeFalse(); + s.IsTypeDefinition.Should().BeTrue(); + s.IsUnmanagedFunctionPointer.Should().BeFalse(); + s.IsValueType.Should().BeTrue(); + s.IsVisible.Should().BeTrue(); + s.ToString().Should().Be(typeof(int).ToString()); + s.GetCustomAttributes(true); + } + + [TestMethod] + public void SystemInt32ShouldReturnSameInstance() + { + var s1 = Init.Symbols.ResolveCoreType("System.Int32"); + var s2 = Init.Symbols.ResolveCoreType("System.Int32"); + s1.Should().BeSameAs(s2); + } + + [TestMethod] + public void GetFieldShouldNotReturnInternalField() + { + var s = Init.Symbols.ResolveCoreType("System.Nullable`1"); + var f = s.GetField("value"); + f.Should().BeNull(); + } + + [TestMethod] + public void CanMakeArrayType() + { + var s = Init.Symbols.ResolveCoreType("System.Int32"); + var p = s.MakeArrayType(); + p.AssemblyQualifiedName.Should().Be(typeof(int[]).AssemblyQualifiedName); + p.Name.Should().Be(typeof(int[]).Name); + p.Namespace.Should().Be(typeof(int[]).Namespace); + p.FullName.Should().Be(typeof(int[]).FullName); + p.BaseType.Should().Be(Init.Symbols.ResolveCoreType("System.Array")); + p.HasElementType.Should().BeTrue(); + p.IsAbstract.Should().BeFalse(); + p.IsArray.Should().BeTrue(); + p.IsAutoLayout.Should().BeTrue(); + p.IsByRef.Should().BeFalse(); + p.IsClass.Should().BeTrue(); + p.IsConstructedGenericType.Should().BeFalse(); + p.IsEnum.Should().BeFalse(); + p.IsExplicitLayout.Should().BeFalse(); + p.IsFunctionPointer.Should().BeFalse(); + p.IsGenericMethodParameter.Should().BeFalse(); + p.IsGenericParameter.Should().BeFalse(); + p.IsGenericType.Should().BeFalse(); + p.IsGenericTypeDefinition.Should().BeFalse(); + p.IsGenericTypeParameter.Should().BeFalse(); + p.IsInterface.Should().BeFalse(); + p.IsLayoutSequential.Should().BeFalse(); + p.IsMissing.Should().BeFalse(); + p.IsNested.Should().BeFalse(); + p.IsNestedAssembly.Should().BeFalse(); + p.IsNestedFamANDAssem.Should().BeFalse(); + p.IsNestedFamily.Should().BeFalse(); + p.IsNestedFamORAssem.Should().BeFalse(); + p.IsNestedPrivate.Should().BeFalse(); + p.IsNestedPublic.Should().BeFalse(); + p.IsNotPublic.Should().BeFalse(); + p.IsPointer.Should().BeFalse(); + p.IsPrimitive.Should().BeFalse(); + p.IsPublic.Should().BeTrue(); + p.IsSealed.Should().BeTrue(); + p.IsSerializable.Should().BeTrue(); + p.IsSZArray.Should().BeTrue(); + p.IsTypeDefinition.Should().BeFalse(); + p.IsUnmanagedFunctionPointer.Should().BeFalse(); + p.IsValueType.Should().BeFalse(); + p.IsVisible.Should().BeTrue(); + p.ToString().Should().Be(typeof(int[]).ToString()); + p.GetCustomAttributes(true); + } + + [TestMethod] + public void SystemInt32ArrayShouldReturnSameInstance() + { + var s1 = Init.Symbols.ResolveCoreType("System.Int32").MakeArrayType(); + var s2 = Init.Symbols.ResolveCoreType("System.Int32").MakeArrayType(); + s1.Should().BeSameAs(s2); + } + + [TestMethod] + public void CanMakePointerType() + { + var s = Init.Symbols.ResolveCoreType("System.Int32"); + var p = s.MakePointerType(); + p.AssemblyQualifiedName.Should().Be(typeof(int*).AssemblyQualifiedName); + p.Name.Should().Be(typeof(int*).Name); + p.Namespace.Should().Be(typeof(int*).Namespace); + p.FullName.Should().Be(typeof(int*).FullName); + p.BaseType.Should().BeNull(); + p.HasElementType.Should().BeTrue(); + p.IsAbstract.Should().BeFalse(); + p.IsArray.Should().BeFalse(); + p.IsAutoLayout.Should().BeTrue(); + p.IsByRef.Should().BeFalse(); + p.IsClass.Should().BeTrue(); + p.IsConstructedGenericType.Should().BeFalse(); + p.IsEnum.Should().BeFalse(); + p.IsExplicitLayout.Should().BeFalse(); + p.IsFunctionPointer.Should().BeFalse(); + p.IsGenericMethodParameter.Should().BeFalse(); + p.IsGenericParameter.Should().BeFalse(); + p.IsGenericType.Should().BeFalse(); + p.IsGenericTypeDefinition.Should().BeFalse(); + p.IsGenericTypeParameter.Should().BeFalse(); + p.IsInterface.Should().BeFalse(); + p.IsLayoutSequential.Should().BeFalse(); + p.IsMissing.Should().BeFalse(); + p.IsNested.Should().BeFalse(); + p.IsNestedAssembly.Should().BeFalse(); + p.IsNestedFamANDAssem.Should().BeFalse(); + p.IsNestedFamily.Should().BeFalse(); + p.IsNestedFamORAssem.Should().BeFalse(); + p.IsNestedPrivate.Should().BeFalse(); + p.IsNestedPublic.Should().BeFalse(); + p.IsNotPublic.Should().BeFalse(); + p.IsPointer.Should().BeTrue(); + p.IsPrimitive.Should().BeFalse(); + p.IsPublic.Should().BeTrue(); + p.IsSealed.Should().BeFalse(); + p.IsSerializable.Should().BeFalse(); + p.IsSZArray.Should().BeFalse(); + p.IsTypeDefinition.Should().BeFalse(); + p.IsUnmanagedFunctionPointer.Should().BeFalse(); + p.IsValueType.Should().BeFalse(); + p.IsVisible.Should().BeTrue(); + p.ToString().Should().Be(typeof(int*).ToString()); + p.GetCustomAttributes(true); + } + + [TestMethod] + public void SystemInt32PointerShouldReturnSameInstance() + { + var s1 = Init.Symbols.ResolveCoreType("System.Int32").MakePointerType(); + var s2 = Init.Symbols.ResolveCoreType("System.Int32").MakePointerType(); + s1.Should().BeSameAs(s2); + } + + [TestMethod] + public void CanMakeGenericType() + { + var s = Init.Symbols.ResolveCoreType("System.Collections.Generic.List`1"); + var t = s.MakeGenericType([Init.Symbols.ResolveCoreType("System.Int32")]); + t.AssemblyQualifiedName.Should().Be(typeof(List).AssemblyQualifiedName); + t.Name.Should().Be(typeof(List).Name); + t.Namespace.Should().Be(typeof(List).Namespace); + t.FullName.Should().Be(typeof(List).FullName); + t.BaseType.Should().Be(Init.Symbols.ResolveCoreType("System.Object")); + t.HasElementType.Should().BeFalse(); + t.IsAbstract.Should().BeFalse(); + t.IsArray.Should().BeFalse(); + t.IsAutoLayout.Should().BeTrue(); + t.IsByRef.Should().BeFalse(); + t.IsClass.Should().BeTrue(); + t.IsConstructedGenericType.Should().BeTrue(); + t.IsEnum.Should().BeFalse(); + t.IsExplicitLayout.Should().BeFalse(); + t.IsFunctionPointer.Should().BeFalse(); + t.IsGenericMethodParameter.Should().BeFalse(); + t.IsGenericParameter.Should().BeFalse(); + t.IsGenericType.Should().BeTrue(); + t.IsGenericTypeDefinition.Should().BeFalse(); + t.IsGenericTypeParameter.Should().BeFalse(); + t.IsInterface.Should().BeFalse(); + t.IsLayoutSequential.Should().BeFalse(); + t.IsMissing.Should().BeFalse(); + t.IsNested.Should().BeFalse(); + t.IsNestedAssembly.Should().BeFalse(); + t.IsNestedFamANDAssem.Should().BeFalse(); + t.IsNestedFamily.Should().BeFalse(); + t.IsNestedFamORAssem.Should().BeFalse(); + t.IsNestedPrivate.Should().BeFalse(); + t.IsNestedPublic.Should().BeFalse(); + t.IsNotPublic.Should().BeFalse(); + t.IsPointer.Should().BeFalse(); + t.IsPrimitive.Should().BeFalse(); + t.IsPublic.Should().BeTrue(); + t.IsSealed.Should().BeFalse(); + t.IsSerializable.Should().BeTrue(); + t.IsSZArray.Should().BeFalse(); + t.IsTypeDefinition.Should().BeFalse(); + t.IsUnmanagedFunctionPointer.Should().BeFalse(); + t.IsValueType.Should().BeFalse(); + t.IsVisible.Should().BeTrue(); + t.ToString().Should().Be(typeof(List).ToString()); + t.GetCustomAttributes(true); + } + + [TestMethod] + public void CanGetFieldFromConstructedType() + { + var s = Init.Symbols.ResolveCoreType("System.Nullable`1"); + var t = s.MakeGenericType([Init.Symbols.ResolveCoreType("System.Int32")]); + var f = t.GetField("value", BindingFlags.NonPublic | BindingFlags.Instance); + f.Should().BeOfType(typeof(ConstructedGenericFieldSymbol)); + f.DeclaringType.Should().BeSameAs(t); + f.Name.Should().Be("value"); + f.IsAssembly.Should().BeTrue(); + f.IsFamily.Should().BeFalse(); + f.IsFamilyAndAssembly.Should().BeFalse(); + f.IsFamilyOrAssembly.Should().BeFalse(); + f.IsInitOnly.Should().BeFalse(); + f.IsLiteral.Should().BeFalse(); + f.IsMissing.Should().BeFalse(); + f.IsNotSerialized.Should().BeFalse(); + f.IsPrivate.Should().BeFalse(); + f.IsPublic.Should().BeFalse(); + f.IsSpecialName.Should().BeFalse(); + f.IsStatic.Should().BeFalse(); + f.GetCustomAttributes(true); + + var ft = f.FieldType; + ft.Should().BeSameAs(Init.Symbols.ResolveCoreType("System.Int32")); + } + + [TestMethod] + public void CanGetMethodFromConstructedType() + { + var s = Init.Symbols.ResolveCoreType("System.Collections.Generic.List`1"); + var t = s.MakeGenericType([Init.Symbols.ResolveCoreType("System.Int32")]); + var m = t.GetMethod("Add"); + m.Should().BeOfType(typeof(ConstructedGenericMethodSymbol)); + m.DeclaringType.Should().BeSameAs(t); + m.Name.Should().Be("Add"); + m.ContainsGenericParameters.Should().BeFalse(); + m.IsAbstract.Should().BeFalse(); + m.IsAssembly.Should().BeFalse(); + m.IsConstructor.Should().BeFalse(); + m.IsFamily.Should().BeFalse(); + m.IsFamilyAndAssembly.Should().BeFalse(); + m.IsFamilyOrAssembly.Should().BeFalse(); + m.IsFinal.Should().BeTrue(); + m.IsGenericMethod.Should().BeFalse(); + m.IsGenericMethodDefinition.Should().BeFalse(); + m.IsHideBySig.Should().BeTrue(); + m.IsMissing.Should().BeFalse(); + m.IsPrivate.Should().BeFalse(); + m.IsPublic.Should().BeTrue(); + m.IsSpecialName.Should().BeFalse(); + m.IsStatic.Should().BeFalse(); + m.IsVirtual.Should().BeTrue(); + m.MethodImplementationFlags.Should().Be(typeof(List).GetMethod("Add")!.MethodImplementationFlags); + m.MemberType.Should().Be(MemberTypes.Method); + m.GetCustomAttributes(true); + + var pl = m.Parameters; + pl.Should().HaveCount(1); + var p0 = pl[0]; + p0.Name.Should().Be("item"); + p0.ParameterType.Should().BeSameAs(Init.Symbols.ResolveCoreType("System.Int32")); + } + + [TestMethod] + public void CanGetConstructor() + { + var s = Init.Symbols.ResolveCoreType("System.Object"); + var c = s.GetConstructor([]); + c.Should().NotBeNull(); + c.Name.Should().Be(ConstructorInfo.ConstructorName); + c.IsConstructor.Should().BeTrue(); + c.Attributes.Should().HaveFlag(MethodAttributes.SpecialName); + c.Attributes.Should().HaveFlag(MethodAttributes.RTSpecialName); + } + + [TestMethod] + public void CanGetStaticConstructor() + { + var s = Init.Symbols.ResolveCoreType("System.Reflection.Module"); + var c = s.TypeInitializer; + c.Should().NotBeNull(); + c.Name.Should().Be(ConstructorInfo.TypeConstructorName); + c.IsConstructor.Should().BeTrue(); + c.Attributes.Should().HaveFlag(MethodAttributes.SpecialName); + c.Attributes.Should().HaveFlag(MethodAttributes.RTSpecialName); + } + + [TestMethod] + public void CanGetGenericMethodFromGenericType() + { + var typeOfFunc2 = Init.Symbols.ResolveCoreType("System.Func`2"); + var typeOfTask = Init.Symbols.ResolveCoreType("System.Threading.Tasks.Task"); + var typeOfTask1 = Init.Symbols.ResolveCoreType("System.Threading.Tasks.Task`1"); + + var m = typeOfTask1.GetMethod("ContinueWith", 1, [ + TypeSymbolSelector.Predicate(t => + t.GenericTypeDefinition == typeOfFunc2 && + t.GenericArguments is [var arg1, { IsGenericMethodParameter: true, GenericParameterPosition: 0 }] && arg1 == typeOfTask), + Init.Symbols.ResolveCoreType("System.Threading.CancellationToken")], + default); + + var m2 = m.MakeGenericMethod([Init.Symbols.ResolveCoreType("System.Int32")]); + + var p = m2.ParameterTypes; + } + + } + +} diff --git a/src/IKVM.CoreLib/Buffers/MemoryExtensons.cs b/src/IKVM.CoreLib/Buffers/MemoryExtensons.cs new file mode 100644 index 0000000000..4f424d01d1 --- /dev/null +++ b/src/IKVM.CoreLib/Buffers/MemoryExtensons.cs @@ -0,0 +1,11 @@ +namespace IKVM.CoreLib.Buffers +{ + + internal static class MemoryExtensons + { + + + + } + +} diff --git a/src/IKVM.CoreLib/Buffers/SequenceReader.Search.cs b/src/IKVM.CoreLib/Buffers/SequenceReader.Search.cs new file mode 100644 index 0000000000..c6f68c37ad --- /dev/null +++ b/src/IKVM.CoreLib/Buffers/SequenceReader.Search.cs @@ -0,0 +1,861 @@ +#if NETFRAMEWORK + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Buffers; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace IKVM.CoreLib.Buffers +{ + + internal ref partial struct SequenceReader + where T : unmanaged, IEquatable + { + + /// + /// Try to read everything up to the given . + /// + /// The read data, if any. + /// The delimiter to look for. + /// True to move past the if found. + /// True if the was found. + public bool TryReadTo(out ReadOnlySpan span, T delimiter, bool advancePastDelimiter = true) + { + ReadOnlySpan remaining = UnreadSpan; + int index = remaining.IndexOf(delimiter); + + if (index != -1) + { + span = index == 0 ? default : remaining.Slice(0, index); + AdvanceCurrentSpan(index + (advancePastDelimiter ? 1 : 0)); + return true; + } + + return TryReadToSlow(out span, delimiter, advancePastDelimiter); + } + + private bool TryReadToSlow(out ReadOnlySpan span, T delimiter, bool advancePastDelimiter) + { + if (!TryReadToInternal(out ReadOnlySequence sequence, delimiter, advancePastDelimiter, CurrentSpan.Length - CurrentSpanIndex)) + { + span = default; + return false; + } + + span = sequence.IsSingleSegment ? sequence.First.Span : sequence.ToArray(); + return true; + } + + /// + /// Try to read everything up to the given , ignoring delimiters that are + /// preceded by . + /// + /// The read data, if any. + /// The delimiter to look for. + /// If found prior to it will skip that occurrence. + /// True to move past the if found. + /// True if the was found. + public bool TryReadTo(out ReadOnlySpan span, T delimiter, T delimiterEscape, bool advancePastDelimiter = true) + { + ReadOnlySpan remaining = UnreadSpan; + int index = remaining.IndexOf(delimiter); + + if ((index > 0 && !remaining[index - 1].Equals(delimiterEscape)) || index == 0) + { + span = remaining.Slice(0, index); + AdvanceCurrentSpan(index + (advancePastDelimiter ? 1 : 0)); + return true; + } + + // This delimiter might be skipped, go down the slow path + return TryReadToSlow(out span, delimiter, delimiterEscape, index, advancePastDelimiter); + } + + private bool TryReadToSlow(out ReadOnlySpan span, T delimiter, T delimiterEscape, int index, bool advancePastDelimiter) + { + if (!TryReadToSlow(out ReadOnlySequence sequence, delimiter, delimiterEscape, index, advancePastDelimiter)) + { + span = default; + return false; + } + + Debug.Assert(sequence.Length > 0); + span = sequence.IsSingleSegment ? sequence.First.Span : sequence.ToArray(); + return true; + } + + private bool TryReadToSlow(out ReadOnlySequence sequence, T delimiter, T delimiterEscape, int index, bool advancePastDelimiter) + { + SequenceReader copy = this; + + ReadOnlySpan remaining = UnreadSpan; + bool priorEscape = false; + + do + { + if (index >= 0) + { + if (index == 0 && priorEscape) + { + // We were in the escaped state, so skip this delimiter + priorEscape = false; + Advance(index + 1); + remaining = UnreadSpan; + goto Continue; + } + else if (index > 0 && remaining[index - 1].Equals(delimiterEscape)) + { + // This delimiter might be skipped + + // Count our escapes + int escapeCount = 1; + int i = index - 2; + for (; i >= 0; i--) + { + if (!remaining[i].Equals(delimiterEscape)) + break; + } + if (i < 0 && priorEscape) + { + // Started and ended with escape, increment once more + escapeCount++; + } + escapeCount += index - 2 - i; + + if ((escapeCount & 1) != 0) + { + // An odd escape count means we're currently escaped, + // skip the delimiter and reset escaped state. + Advance(index + 1); + priorEscape = false; + remaining = UnreadSpan; + goto Continue; + } + } + + // Found the delimiter. Move to it, slice, then move past it. + AdvanceCurrentSpan(index); + + sequence = Sequence.Slice(copy.Position, Position); + if (advancePastDelimiter) + { + Advance(1); + } + return true; + } + else + { + // No delimiter, need to check the end of the span for odd number of escapes then advance + if (remaining.EndsWith([delimiterEscape])) + { + int escapeCount = 1; + int i = remaining.Length - 2; + for (; i >= 0; i--) + { + if (!remaining[i].Equals(delimiterEscape)) + break; + } + + escapeCount += remaining.Length - 2 - i; + if (i < 0 && priorEscape) + priorEscape = (escapeCount & 1) == 0; // equivalent to incrementing escapeCount before setting priorEscape + else + priorEscape = (escapeCount & 1) != 0; + } + else + { + priorEscape = false; + } + } + + // Nothing in the current span, move to the end, checking for the skip delimiter + AdvanceCurrentSpan(remaining.Length); + remaining = CurrentSpan; + + Continue: + index = remaining.IndexOf(delimiter); + } while (!End); + + // Didn't find anything, reset our original state. + this = copy; + sequence = default; + return false; + } + + /// + /// Try to read everything up to the given . + /// + /// The read data, if any. + /// The delimiter to look for. + /// True to move past the if found. + /// True if the was found. + public bool TryReadTo(out ReadOnlySequence sequence, T delimiter, bool advancePastDelimiter = true) + { + return TryReadToInternal(out sequence, delimiter, advancePastDelimiter); + } + + private bool TryReadToInternal(out ReadOnlySequence sequence, T delimiter, bool advancePastDelimiter, int skip = 0) + { + Debug.Assert(skip >= 0); + SequenceReader copy = this; + if (skip > 0) + Advance(skip); + ReadOnlySpan remaining = UnreadSpan; + + while (_moreData) + { + int index = remaining.IndexOf(delimiter); + if (index != -1) + { + // Found the delimiter. Move to it, slice, then move past it. + if (index > 0) + { + AdvanceCurrentSpan(index); + } + + sequence = Sequence.Slice(copy.Position, Position); + if (advancePastDelimiter) + { + Advance(1); + } + return true; + } + + AdvanceCurrentSpan(remaining.Length); + remaining = CurrentSpan; + } + + // Didn't find anything, reset our original state. + this = copy; + sequence = default; + return false; + } + + /// + /// Try to read everything up to the given , ignoring delimiters that are + /// preceded by . + /// + /// The read data, if any. + /// The delimiter to look for. + /// If found prior to it will skip that occurrence. + /// True to move past the if found. + /// True if the was found. + public bool TryReadTo(out ReadOnlySequence sequence, T delimiter, T delimiterEscape, bool advancePastDelimiter = true) + { + SequenceReader copy = this; + + ReadOnlySpan remaining = UnreadSpan; + bool priorEscape = false; + + while (_moreData) + { + int index = remaining.IndexOf(delimiter); + if (index != -1) + { + if (index == 0 && priorEscape) + { + // We were in the escaped state, so skip this delimiter + priorEscape = false; + Advance(index + 1); + remaining = UnreadSpan; + continue; + } + else if (index > 0 && remaining[index - 1].Equals(delimiterEscape)) + { + // This delimiter might be skipped + + // Count our escapes + int escapeCount = 0; + for (int i = index; i > 0 && remaining[i - 1].Equals(delimiterEscape); i--, escapeCount++) + ; + if (escapeCount == index && priorEscape) + { + // Started and ended with escape, increment once more + escapeCount++; + } + + priorEscape = false; + if ((escapeCount & 1) != 0) + { + // Odd escape count means we're in the escaped state, so skip this delimiter + Advance(index + 1); + remaining = UnreadSpan; + continue; + } + } + + // Found the delimiter. Move to it, slice, then move past it. + if (index > 0) + { + Advance(index); + } + + sequence = Sequence.Slice(copy.Position, Position); + if (advancePastDelimiter) + { + Advance(1); + } + return true; + } + + // No delimiter, need to check the end of the span for odd number of escapes then advance + { + int escapeCount = 0; + for (int i = remaining.Length; i > 0 && remaining[i - 1].Equals(delimiterEscape); i--, escapeCount++) + ; + if (priorEscape && escapeCount == remaining.Length) + { + escapeCount++; + } + priorEscape = escapeCount % 2 != 0; + } + + // Nothing in the current span, move to the end, checking for the skip delimiter + Advance(remaining.Length); + remaining = CurrentSpan; + } + + // Didn't find anything, reset our original state. + this = copy; + sequence = default; + return false; + } + + /// + /// Try to read everything up to the given . + /// + /// The read data, if any. + /// The delimiters to look for. + /// True to move past the first found instance of any of the given . + /// True if any of the were found. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryReadToAny(out ReadOnlySpan span, scoped ReadOnlySpan delimiters, bool advancePastDelimiter = true) + { + ReadOnlySpan remaining = UnreadSpan; + int index = delimiters.Length == 2 + ? remaining.IndexOfAny(delimiters[0], delimiters[1]) + : remaining.IndexOfAny(delimiters); + + if (index != -1) + { + span = remaining.Slice(0, index); + Advance(index + (advancePastDelimiter ? 1 : 0)); + return true; + } + + return TryReadToAnySlow(out span, delimiters, advancePastDelimiter); + } + + private bool TryReadToAnySlow(out ReadOnlySpan span, scoped ReadOnlySpan delimiters, bool advancePastDelimiter) + { + if (!TryReadToAnyInternal(out ReadOnlySequence sequence, delimiters, advancePastDelimiter, CurrentSpan.Length - CurrentSpanIndex)) + { + span = default; + return false; + } + + span = sequence.IsSingleSegment ? sequence.First.Span : sequence.ToArray(); + return true; + } + + /// + /// Try to read everything up to the given . + /// + /// The read data, if any. + /// The delimiters to look for. + /// True to move past the first found instance of any of the given . + /// True if any of the were found. + public bool TryReadToAny(out ReadOnlySequence sequence, scoped ReadOnlySpan delimiters, bool advancePastDelimiter = true) + { + return TryReadToAnyInternal(out sequence, delimiters, advancePastDelimiter); + } + + private bool TryReadToAnyInternal(out ReadOnlySequence sequence, scoped ReadOnlySpan delimiters, bool advancePastDelimiter, int skip = 0) + { + SequenceReader copy = this; + if (skip > 0) + Advance(skip); + ReadOnlySpan remaining = UnreadSpan; + + while (!End) + { + int index = delimiters.Length == 2 + ? remaining.IndexOfAny(delimiters[0], delimiters[1]) + : remaining.IndexOfAny(delimiters); + + if (index != -1) + { + // Found one of the delimiters. Move to it, slice, then move past it. + if (index > 0) + { + AdvanceCurrentSpan(index); + } + + sequence = Sequence.Slice(copy.Position, Position); + if (advancePastDelimiter) + { + Advance(1); + } + return true; + } + + Advance(remaining.Length); + remaining = CurrentSpan; + } + + // Didn't find anything, reset our original state. + this = copy; + sequence = default; + return false; + } + + /// + /// Try to read everything up to the given . + /// + /// The read data, if any. + /// The delimiter to look for. + /// True to move past the if found. + /// True if the was found. + public bool TryReadTo(out ReadOnlySpan span, scoped ReadOnlySpan delimiter, bool advancePastDelimiter = true) + { + ReadOnlySpan remaining = UnreadSpan; + int index = remaining.IndexOf(delimiter); + + if (index >= 0) + { + span = remaining.Slice(0, index); + AdvanceCurrentSpan(index + (advancePastDelimiter ? delimiter.Length : 0)); + return true; + } + + // This delimiter might be skipped, go down the slow path + return TryReadToSlow(out span, delimiter, advancePastDelimiter); + } + + private bool TryReadToSlow(out ReadOnlySpan span, scoped ReadOnlySpan delimiter, bool advancePastDelimiter) + { + if (!TryReadTo(out ReadOnlySequence sequence, delimiter, advancePastDelimiter)) + { + span = default; + return false; + } + + Debug.Assert(sequence.Length > 0); + span = sequence.IsSingleSegment ? sequence.First.Span : sequence.ToArray(); + return true; + } + + /// + /// Try to read data until the entire given matches. + /// + /// The read data, if any. + /// The multi (T) delimiter. + /// True to move past the if found. + /// True if the was found. + public bool TryReadTo(out ReadOnlySequence sequence, scoped ReadOnlySpan delimiter, bool advancePastDelimiter = true) + { + if (delimiter.Length == 0) + { + sequence = default; + return true; + } + + SequenceReader copy = this; + + bool advanced = false; + while (!End) + { + if (!TryReadTo(out sequence, delimiter[0], advancePastDelimiter: false)) + { + this = copy; + return false; + } + + if (delimiter.Length == 1) + { + if (advancePastDelimiter) + { + Advance(1); + } + return true; + } + + if (IsNext(delimiter)) + { + // Probably a faster way to do this, potentially by avoiding the Advance in the previous TryReadTo call + if (advanced) + { + sequence = copy.Sequence.Slice(copy.Consumed, Consumed - copy.Consumed); + } + + if (advancePastDelimiter) + { + Advance(delimiter.Length); + } + return true; + } + else + { + Advance(1); + advanced = true; + } + } + + this = copy; + sequence = default; + return false; + } + + /// + /// Try to read data with given . + /// + /// Read count. + /// The read data, if successfully read requested data. + /// true if remaining items in current is enough for . + public bool TryReadExact(int count, out ReadOnlySequence sequence) + { + if (count < 0) + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + + if (count > Remaining) + { + sequence = default; + return false; + } + + sequence = Sequence.Slice(Position, count); + if (count != 0) + { + Advance(count); + } + return true; + } + + /// + /// Advance until the given , if found. + /// + /// The delimiter to search for. + /// True to move past the if found. + /// True if the given was found. + public bool TryAdvanceTo(T delimiter, bool advancePastDelimiter = true) + { + ReadOnlySpan remaining = UnreadSpan; + int index = remaining.IndexOf(delimiter); + if (index != -1) + { + Advance(advancePastDelimiter ? index + 1 : index); + return true; + } + + return TryReadToInternal(out _, delimiter, advancePastDelimiter); + } + + /// + /// Advance until any of the given , if found. + /// + /// The delimiters to search for. + /// True to move past the first found instance of any of the given . + /// True if any of the given were found. + public bool TryAdvanceToAny(scoped ReadOnlySpan delimiters, bool advancePastDelimiter = true) + { + ReadOnlySpan remaining = UnreadSpan; + int index = remaining.IndexOfAny(delimiters); + if (index != -1) + { + AdvanceCurrentSpan(index + (advancePastDelimiter ? 1 : 0)); + return true; + } + + return TryReadToAnyInternal(out _, delimiters, advancePastDelimiter); + } + + /// + /// Advance past consecutive instances of the given . + /// + /// How many positions the reader has been advanced. + public long AdvancePast(T value) + { + long start = Consumed; + + do + { + // Advance past all matches in the current span + int i; + for (i = CurrentSpanIndex; i < CurrentSpan.Length && CurrentSpan[i].Equals(value); i++) + { + } + + int advanced = i - CurrentSpanIndex; + if (advanced == 0) + { + // Didn't advance at all in this span, exit. + break; + } + + AdvanceCurrentSpan(advanced); + + // If we're at position 0 after advancing and not at the End, + // we're in a new span and should continue the loop. + } while (CurrentSpanIndex == 0 && !End); + + return Consumed - start; + } + + /// + /// Skip consecutive instances of any of the given . + /// + /// How many positions the reader has been advanced. + public long AdvancePastAny(scoped ReadOnlySpan values) + { + long start = Consumed; + + do + { + // Advance past all matches in the current span + int i; + for (i = CurrentSpanIndex; i < CurrentSpan.Length && values.IndexOf(CurrentSpan[i]) != -1; i++) + { + } + + int advanced = i - CurrentSpanIndex; + if (advanced == 0) + { + // Didn't advance at all in this span, exit. + break; + } + + AdvanceCurrentSpan(advanced); + + // If we're at position 0 after advancing and not at the End, + // we're in a new span and should continue the loop. + } while (CurrentSpanIndex == 0 && !End); + + return Consumed - start; + } + + /// + /// Advance past consecutive instances of any of the given values. + /// + /// How many positions the reader has been advanced. + public long AdvancePastAny(T value0, T value1, T value2, T value3) + { + long start = Consumed; + + do + { + // Advance past all matches in the current span + int i; + for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++) + { + T value = CurrentSpan[i]; + if (!value.Equals(value0) && !value.Equals(value1) && !value.Equals(value2) && !value.Equals(value3)) + { + break; + } + } + + int advanced = i - CurrentSpanIndex; + if (advanced == 0) + { + // Didn't advance at all in this span, exit. + break; + } + + AdvanceCurrentSpan(advanced); + + // If we're at position 0 after advancing and not at the End, + // we're in a new span and should continue the loop. + } while (CurrentSpanIndex == 0 && !End); + + return Consumed - start; + } + + /// + /// Advance past consecutive instances of any of the given values. + /// + /// How many positions the reader has been advanced. + public long AdvancePastAny(T value0, T value1, T value2) + { + long start = Consumed; + + do + { + // Advance past all matches in the current span + int i; + for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++) + { + T value = CurrentSpan[i]; + if (!value.Equals(value0) && !value.Equals(value1) && !value.Equals(value2)) + { + break; + } + } + + int advanced = i - CurrentSpanIndex; + if (advanced == 0) + { + // Didn't advance at all in this span, exit. + break; + } + + AdvanceCurrentSpan(advanced); + + // If we're at position 0 after advancing and not at the End, + // we're in a new span and should continue the loop. + } while (CurrentSpanIndex == 0 && !End); + + return Consumed - start; + } + + /// + /// Advance past consecutive instances of any of the given values. + /// + /// How many positions the reader has been advanced. + public long AdvancePastAny(T value0, T value1) + { + long start = Consumed; + + do + { + // Advance past all matches in the current span + int i; + for (i = CurrentSpanIndex; i < CurrentSpan.Length; i++) + { + T value = CurrentSpan[i]; + if (!value.Equals(value0) && !value.Equals(value1)) + { + break; + } + } + + int advanced = i - CurrentSpanIndex; + if (advanced == 0) + { + // Didn't advance at all in this span, exit. + break; + } + + AdvanceCurrentSpan(advanced); + + // If we're at position 0 after advancing and not at the End, + // we're in a new span and should continue the loop. + } while (CurrentSpanIndex == 0 && !End); + + return Consumed - start; + } + + /// + /// Moves the reader to the end of the sequence. + /// + public void AdvanceToEnd() + { + if (_moreData) + { + Consumed = Length; + CurrentSpan = default; + CurrentSpanIndex = 0; + _currentPosition = Sequence.End; + _nextPosition = default; + _moreData = false; + } + } + + /// + /// Check to see if the given value is next. + /// + /// The value to compare the next items to. + /// Move past the value if found. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool IsNext(T next, bool advancePast = false) + { + if (End) + return false; + + if (CurrentSpan[CurrentSpanIndex].Equals(next)) + { + if (advancePast) + { + AdvanceCurrentSpan(1); + } + return true; + } + return false; + } + + /// + /// Check to see if the given values are next. + /// + /// The span to compare the next items to. + /// Move past the values if found. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool IsNext(scoped ReadOnlySpan next, bool advancePast = false) + { + ReadOnlySpan unread = UnreadSpan; + if (unread.StartsWith(next)) + { + if (advancePast) + { + AdvanceCurrentSpan(next.Length); + } + return true; + } + + // Only check the slow path if there wasn't enough to satisfy next + return unread.Length < next.Length && IsNextSlow(next, advancePast); + } + + private bool IsNextSlow(scoped ReadOnlySpan next, bool advancePast) + { + ReadOnlySpan currentSpan = UnreadSpan; + + // We should only come in here if we need more data than we have in our current span + Debug.Assert(currentSpan.Length < next.Length); + + int fullLength = next.Length; + SequencePosition nextPosition = _nextPosition; + + while (next.StartsWith(currentSpan)) + { + if (next.Length == currentSpan.Length) + { + // Fully matched + if (advancePast) + { + Advance(fullLength); + } + return true; + } + + // Need to check the next segment + while (true) + { + if (!Sequence.TryGet(ref nextPosition, out ReadOnlyMemory nextSegment, advance: true)) + { + // Nothing left + return false; + } + + if (nextSegment.Length > 0) + { + next = next.Slice(currentSpan.Length); + currentSpan = nextSegment.Span; + if (currentSpan.Length > next.Length) + { + currentSpan = currentSpan.Slice(0, next.Length); + } + break; + } + } + } + + return false; + } + } +} + +#endif diff --git a/src/IKVM.CoreLib/Buffers/SequenceReader.cs b/src/IKVM.CoreLib/Buffers/SequenceReader.cs new file mode 100644 index 0000000000..ddca1d188f --- /dev/null +++ b/src/IKVM.CoreLib/Buffers/SequenceReader.cs @@ -0,0 +1,466 @@ +#if NETFRAMEWORK + +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Buffers; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace IKVM.CoreLib.Buffers +{ + + ref partial struct SequenceReader where T : unmanaged, IEquatable + { + + private SequencePosition _currentPosition; + private SequencePosition _nextPosition; + private bool _moreData; + private readonly long _length; + + /// + /// Create a over the given . + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public SequenceReader(ReadOnlySequence sequence) + { + CurrentSpanIndex = 0; + Consumed = 0; + Sequence = sequence; + _currentPosition = sequence.Start; + _length = -1; + + ReadOnlySpan first = sequence.First.Span; + _nextPosition = sequence.GetPosition(first.Length); + CurrentSpan = first; + _moreData = first.Length > 0; + + if (!_moreData && !sequence.IsSingleSegment) + { + _moreData = true; + GetNextSpan(); + } + } + + /// + /// True when there is no more data in the . + /// + public readonly bool End => !_moreData; + + /// + /// The underlying for the reader. + /// + public ReadOnlySequence Sequence { get; } + + /// + /// Gets the unread portion of the . + /// + /// + /// The unread portion of the . + /// + public readonly ReadOnlySequence UnreadSequence => Sequence.Slice(Position); + + /// + /// The current position in the . + /// + public readonly SequencePosition Position + => Sequence.GetPosition(CurrentSpanIndex, _currentPosition); + + /// + /// The current segment in the as a span. + /// + public ReadOnlySpan CurrentSpan { get; private set; } + + /// + /// The index in the . + /// + public int CurrentSpanIndex { get; private set; } + + /// + /// The unread portion of the . + /// + public readonly ReadOnlySpan UnreadSpan + { + [MethodImpl(MethodImplOptions.AggressiveInlining)] + get => CurrentSpan.Slice(CurrentSpanIndex); + } + + /// + /// The total number of 's processed by the reader. + /// + public long Consumed { get; private set; } + + /// + /// Remaining 's in the reader's . + /// + public readonly long Remaining => Length - Consumed; + + /// + /// Count of in the reader's . + /// + public readonly long Length + { + get + { + if (_length < 0) + { + // Cast-away readonly to initialize lazy field + Unsafe.AsRef(in _length) = Sequence.Length; + } + return _length; + } + } + + /// + /// Peeks at the next value without advancing the reader. + /// + /// The next value or default if at the end. + /// False if at the end of the reader. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public readonly bool TryPeek(out T value) + { + if (_moreData) + { + value = CurrentSpan[CurrentSpanIndex]; + return true; + } + else + { + value = default; + return false; + } + } + + /// + /// Peeks at the next value at specific offset without advancing the reader. + /// + /// The offset from current position. + /// The next value, or the default value if at the end of the reader. + /// true if the reader is not at its end and the peek operation succeeded; false if at the end of the reader. + public readonly bool TryPeek(long offset, out T value) + { + if (offset < 0) + throw new ArgumentOutOfRangeException(nameof(offset)); + + // If we've got data and offset is not out of bounds + if (!_moreData || Remaining <= offset) + { + value = default; + return false; + } + + // Sum CurrentSpanIndex + offset could overflow as is but the value of offset should be very large + // because we check Remaining <= offset above so to overflow we should have a ReadOnlySequence close to 8 exabytes + Debug.Assert(CurrentSpanIndex + offset >= 0); + + // If offset doesn't fall inside current segment move to next until we find correct one + if ((CurrentSpanIndex + offset) <= CurrentSpan.Length - 1) + { + Debug.Assert(offset <= int.MaxValue); + + value = CurrentSpan[CurrentSpanIndex + (int)offset]; + return true; + } + else + { + long remainingOffset = offset - (CurrentSpan.Length - CurrentSpanIndex); + SequencePosition nextPosition = _nextPosition; + ReadOnlyMemory currentMemory; + + while (Sequence.TryGet(ref nextPosition, out currentMemory, advance: true)) + { + // Skip empty segment + if (currentMemory.Length > 0) + { + if (remainingOffset >= currentMemory.Length) + { + // Subtract current non consumed data + remainingOffset -= currentMemory.Length; + } + else + { + break; + } + } + } + + value = currentMemory.Span[(int)remainingOffset]; + return true; + } + } + + /// + /// Read the next value and advance the reader. + /// + /// The next value or default if at the end. + /// False if at the end of the reader. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public bool TryRead(out T value) + { + if (End) + { + value = default; + return false; + } + + value = CurrentSpan[CurrentSpanIndex]; + CurrentSpanIndex++; + Consumed++; + + if (CurrentSpanIndex >= CurrentSpan.Length) + { + GetNextSpan(); + } + + return true; + } + + /// + /// Move the reader back the specified number of items. + /// + /// + /// Thrown if trying to rewind a negative amount or more than . + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Rewind(long count) + { + if ((ulong)count > (ulong)Consumed) + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + + if (count == 0) + { + return; + } + + Consumed -= count; + + if (CurrentSpanIndex >= count) + { + CurrentSpanIndex -= (int)count; + _moreData = true; + } + else + { + // Current segment doesn't have enough data, scan backward through segments + RetreatToPreviousSpan(Consumed); + } + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private void RetreatToPreviousSpan(long consumed) + { + ResetReader(); + Advance(consumed); + } + + private void ResetReader() + { + CurrentSpanIndex = 0; + Consumed = 0; + _currentPosition = Sequence.Start; + _nextPosition = _currentPosition; + + if (Sequence.TryGet(ref _nextPosition, out ReadOnlyMemory memory, advance: true)) + { + _moreData = true; + + if (memory.Length == 0) + { + CurrentSpan = default; + // No data in the first span, move to one with data + GetNextSpan(); + } + else + { + CurrentSpan = memory.Span; + } + } + else + { + // No data in any spans and at end of sequence + _moreData = false; + CurrentSpan = default; + } + } + + /// + /// Get the next segment with available data, if any. + /// + private void GetNextSpan() + { + if (!Sequence.IsSingleSegment) + { + SequencePosition previousNextPosition = _nextPosition; + while (Sequence.TryGet(ref _nextPosition, out ReadOnlyMemory memory, advance: true)) + { + _currentPosition = previousNextPosition; + if (memory.Length > 0) + { + CurrentSpan = memory.Span; + CurrentSpanIndex = 0; + return; + } + else + { + CurrentSpan = default; + CurrentSpanIndex = 0; + previousNextPosition = _nextPosition; + } + } + } + _moreData = false; + } + + /// + /// Move the reader ahead the specified number of items. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public void Advance(long count) + { + const long TooBigOrNegative = unchecked((long)0xFFFFFFFF80000000); + if ((count & TooBigOrNegative) == 0 && CurrentSpan.Length - CurrentSpanIndex > (int)count) + { + CurrentSpanIndex += (int)count; + Consumed += count; + } + else + { + // Can't satisfy from the current span + AdvanceToNextSpan(count); + } + } + + /// + /// Unchecked helper to avoid unnecessary checks where you know count is valid. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal void AdvanceCurrentSpan(long count) + { + Debug.Assert(count >= 0); + + Consumed += count; + CurrentSpanIndex += (int)count; + if (CurrentSpanIndex >= CurrentSpan.Length) + GetNextSpan(); + } + + /// + /// Only call this helper if you know that you are advancing in the current span + /// with valid count and there is no need to fetch the next one. + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + internal void AdvanceWithinSpan(long count) + { + Debug.Assert(count >= 0); + + Consumed += count; + CurrentSpanIndex += (int)count; + + Debug.Assert(CurrentSpanIndex < CurrentSpan.Length); + } + + private void AdvanceToNextSpan(long count) + { + if (count < 0) + { + throw new ArgumentOutOfRangeException(nameof(count)); + } + + Consumed += count; + while (_moreData) + { + int remaining = CurrentSpan.Length - CurrentSpanIndex; + + if (remaining > count) + { + CurrentSpanIndex += (int)count; + count = 0; + break; + } + + // As there may not be any further segments we need to + // push the current index to the end of the span. + CurrentSpanIndex += remaining; + count -= remaining; + Debug.Assert(count >= 0); + + GetNextSpan(); + + if (count == 0) + { + break; + } + } + + if (count != 0) + { + // Not enough data left- adjust for where we actually ended and throw + Consumed -= count; + throw new ArgumentOutOfRangeException(nameof(count)); + } + } + + /// + /// Copies data from the current to the given span if there + /// is enough data to fill it. + /// + /// + /// This API is used to copy a fixed amount of data out of the sequence if possible. It does not advance + /// the reader. To look ahead for a specific stream of data can be used. + /// + /// Destination span to copy to. + /// True if there is enough data to completely fill the span. + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public readonly bool TryCopyTo(Span destination) + { + // This API doesn't advance to facilitate conditional advancement based on the data returned. + // We don't provide an advance option to allow easier utilizing of stack allocated destination spans. + // (Because we can make this method readonly we can guarantee that we won't capture the span.) + + ReadOnlySpan firstSpan = UnreadSpan; + if (firstSpan.Length >= destination.Length) + { + firstSpan.Slice(0, destination.Length).CopyTo(destination); + return true; + } + + // Not enough in the current span to satisfy the request, fall through to the slow path + return TryCopyMultisegment(destination); + } + + internal readonly bool TryCopyMultisegment(Span destination) + { + // If we don't have enough to fill the requested buffer, return false + if (Remaining < destination.Length) + return false; + + ReadOnlySpan firstSpan = UnreadSpan; + Debug.Assert(firstSpan.Length < destination.Length); + firstSpan.CopyTo(destination); + int copied = firstSpan.Length; + + SequencePosition next = _nextPosition; + while (Sequence.TryGet(ref next, out ReadOnlyMemory nextSegment, true)) + { + if (nextSegment.Length > 0) + { + ReadOnlySpan nextSpan = nextSegment.Span; + int toCopy = Math.Min(nextSpan.Length, destination.Length - copied); + nextSpan.Slice(0, toCopy).CopyTo(destination.Slice(copied)); + copied += toCopy; + if (copied >= destination.Length) + { + break; + } + } + } + + return true; + } + } +} + +#endif diff --git a/src/IKVM.CoreLib/Buffers/SequenceReaderExtensions.cs b/src/IKVM.CoreLib/Buffers/SequenceReaderExtensions.cs new file mode 100644 index 0000000000..c7e5f451c7 --- /dev/null +++ b/src/IKVM.CoreLib/Buffers/SequenceReaderExtensions.cs @@ -0,0 +1,357 @@ +using System; +using System.Buffers; +using System.Buffers.Binary; +using System.Diagnostics; +using System.Numerics; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +namespace IKVM.CoreLib.Buffers +{ + + static partial class SequenceReaderExtensions + { + + /// + /// Try to read the given type out of the buffer if possible. Warning: this is dangerous to use with arbitrary + /// structs- see remarks for full details. + /// + /// + /// IMPORTANT: The read is a straight copy of bits. If a struct depends on specific state of its members to + /// behave correctly this can lead to exceptions, etc. If reading endian specific integers, use the explicit + /// overloads such as . + /// + /// + /// True if successful. will be default if failed (due to lack of space). + /// + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe bool TryRead(ref this SequenceReader reader, out T value) + where T : unmanaged + { + var span = reader.UnreadSpan; + if (span.Length < sizeof(T)) + return TryReadMultisegment(ref reader, out value); + + value = Unsafe.ReadUnaligned(ref MemoryMarshal.GetReference(span)); + reader.Advance(sizeof(T)); + return true; + } + + static unsafe bool TryReadMultisegment(ref SequenceReader reader, out T value) + where T : unmanaged + { + Debug.Assert(reader.UnreadSpan.Length < sizeof(T), "reader.UnreadSpan.Length < sizeof(T)"); + + // Not enough data in the current segment, try to peek for the data we need. + var buffer = default(T); + var tempSpan = new Span(&buffer, sizeof(T)); + + if (!reader.TryCopyTo(tempSpan)) + { + value = default; + return false; + } + + value = Unsafe.ReadUnaligned(ref MemoryMarshal.GetReference(tempSpan)); + reader.Advance(sizeof(T)); + return true; + } + + /// + /// Reads an from the next position in the sequence. + /// + /// The reader to read from. + /// Receives the value read. + /// true if there was another byte in the sequence; false otherwise. + public static bool TryRead(ref this SequenceReader reader, out sbyte value) + { + if (TryRead(ref reader, out byte byteValue)) + { + value = unchecked((sbyte)byteValue); + return true; + } + + value = default; + return false; + } + +#if NETFRAMEWORK + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out short value) + { + if (!BitConverter.IsLittleEndian) + { + return reader.TryRead(out value); + } + + return TryReadReverseEndianness(ref reader, out value); + } + +#endif + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out ushort value) + { + if (reader.TryReadBigEndian(out short shortValue)) + { + value = unchecked((ushort)shortValue); + return true; + } + + value = default; + return false; + } + + private static bool TryReadReverseEndianness(ref SequenceReader reader, out short value) + { + if (reader.TryRead(out value)) + { + value = BinaryPrimitives.ReverseEndianness(value); + return true; + } + + return false; + } + +#if NETFRAMEWORK + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out int value) + { + return BitConverter.IsLittleEndian ? TryReadReverseEndianness(ref reader, out value) : reader.TryRead(out value); + } + +#endif + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out uint value) + { + if (reader.TryReadBigEndian(out int intValue)) + { + value = unchecked((uint)intValue); + return true; + } + + value = default; + return false; + } + + static bool TryReadReverseEndianness(ref SequenceReader reader, out int value) + { + if (reader.TryRead(out value)) + { + value = BinaryPrimitives.ReverseEndianness(value); + return true; + } + + return false; + } + +#if NETFRAMEWORK + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out long value) + { + return BitConverter.IsLittleEndian ? TryReadReverseEndianness(ref reader, out value) : reader.TryRead(out value); + } + +#endif + + /// + /// Reads an as big endian. + /// + /// False if there wasn't enough data for an . + public static bool TryReadBigEndian(ref this SequenceReader reader, out ulong value) + { + if (reader.TryReadBigEndian(out long longValue)) + { + value = unchecked((ulong)longValue); + return true; + } + + value = default; + return false; + } + + static bool TryReadReverseEndianness(ref SequenceReader reader, out long value) + { + if (reader.TryRead(out value)) + { + value = BinaryPrimitives.ReverseEndianness(value); + return true; + } + + return false; + } + + /// + /// Reads a as big endian. + /// + /// False if there wasn't enough data for a . + public static unsafe bool TryReadBigEndian(ref this SequenceReader reader, out float value) + { + if (reader.TryReadBigEndian(out int intValue)) + { + value = *(float*)&intValue; + return true; + } + + value = default; + return false; + } + + /// + /// Reads a as big endian. + /// + /// False if there wasn't enough data for a . + public static unsafe bool TryReadBigEndian(ref this SequenceReader reader, out double value) + { + if (reader.TryReadBigEndian(out long longValue)) + { + value = *(double*)&longValue; + return true; + } + + value = default; + return false; + } + + /// + /// Try to read data with given . + /// + /// Read count. + /// The read data, if successfully read requested data. + /// true if remaining items in current is enough for . + public static bool TryReadExact(ref this SequenceReader reader, int count, out ReadOnlySequence sequence) + where T : unmanaged, IEquatable + { + if (count < 0) + throw new ArgumentOutOfRangeException(nameof(count)); + + if (count > reader.Remaining) + { + sequence = default; + return false; + } + + sequence = reader.Sequence.Slice(reader.Position, count); + if (count != 0) + reader.Advance(count); + + return true; + } + + /// + /// Try to read data with given . + /// + /// Read count. + /// The read data, if successfully read requested data. + /// true if remaining items in current is enough for . + public static bool TryReadExact(ref this SequenceReader reader, long count, out ReadOnlySequence sequence) + where T : unmanaged, IEquatable + { + if (count < 0) + throw new ArgumentOutOfRangeException(nameof(count)); + + if (count > reader.Remaining) + { + sequence = default; + return false; + } + + sequence = reader.Sequence.Slice(reader.Position, count); + if (count != 0) + reader.Advance(count); + + return true; + } + + /// + /// Tries to advance the reader over the specified number of bytes. + /// + /// + /// + /// + public static bool TryAdvance(ref this SequenceReader reader, long count) + where T : unmanaged, IEquatable + { + return reader.TryReadExact(count, out _); + } + + + /// + /// Advances bytes up until the alignment is met. + /// + public static bool TryAlign(ref this SequenceReader reader, int alignment) + where T : unmanaged, IEquatable + { + var position = (int)reader.Consumed; + return TryAdvance(ref reader, CalculateAlignment(position, alignment) - position); + } + + /// + /// Returns the number of bits set on the specified . + /// + /// + /// + static int PopCount(int v) + { + return PopCount(unchecked((uint)v)); + } + + /// + /// Returns the number of bits set on the specified . + /// + /// + /// + static int PopCount(uint v) + { +#if NET + return BitOperations.PopCount(v); +#else + unchecked + { + v -= ((v >> 1) & 0x55555555u); + v = (v & 0x33333333u) + ((v >> 2) & 0x33333333u); + return (int)((v + (v >> 4) & 0xF0F0F0Fu) * 0x1010101u) >> 24; + } +#endif + } + + /// + /// Calculates the alignment based on the current position and alignment. + /// + /// + /// + /// + static int CalculateAlignment(int position, int alignment) + { + Debug.Assert(position >= 0 && alignment > 0); + Debug.Assert(PopCount(alignment) == 1); + + int result = position & ~(alignment - 1); + if (result == position) + return result; + + return result + alignment; + } + + } + +} diff --git a/src/IKVM.CoreLib/Collections/EnumerableExtensions.cs b/src/IKVM.CoreLib/Collections/EnumerableExtensions.cs new file mode 100644 index 0000000000..c62a088114 --- /dev/null +++ b/src/IKVM.CoreLib/Collections/EnumerableExtensions.cs @@ -0,0 +1,73 @@ +using System; +using System.Collections.Generic; + +namespace IKVM.CoreLib.Collections +{ + + static class EnumerableExtensions + { + + public static TSource? SingleOrDefaultOrThrow(this IEnumerable source, Func exception) + { + if (source == null) + throw new ArgumentNullException(nameof(source)); + if (exception == null) + throw new ArgumentNullException(nameof(exception)); + + if (source is IReadOnlyList list) + { + switch (list.Count) + { + case 0: + return default; + case 1: + return list[0]; + } + } + else + { + using IEnumerator enumerator = source.GetEnumerator(); + if (enumerator.MoveNext() == false) + return default; + + var current = enumerator.Current; + if (enumerator.MoveNext() == false) + return current; + } + + throw exception(); + } + + public static TSource? SingleOrDefaultOrThrow(this IEnumerable source, Predicate predicate, Func exception) + { + if (source == null) + throw new ArgumentNullException(nameof(source)); + if (predicate == null) + throw new ArgumentNullException(nameof(predicate)); + if (exception == null) + throw new ArgumentNullException(nameof(exception)); + + var val = default(TSource); + var num = 0; + + foreach (var item in source) + { + if (predicate(item)) + { + val = item; + if ((++num) >= 2) + throw exception(); + } + } + + return num switch + { + 0 => default, + 1 => val, + _ => throw new InvalidOperationException(), + }; + } + + } + +} diff --git a/src/IKVM.CoreLib/Collections/ImmutableExtensions.cs b/src/IKVM.CoreLib/Collections/ImmutableExtensions.cs new file mode 100644 index 0000000000..044993b55c --- /dev/null +++ b/src/IKVM.CoreLib/Collections/ImmutableExtensions.cs @@ -0,0 +1,122 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; + +namespace IKVM.CoreLib.Collections +{ + + public static class ImmutableExtensions + { + + /// + /// Value-type implementation of . + /// + /// + public readonly struct ImmutableArrayValueComparer : IEqualityComparer> + where TComparer : IEqualityComparer + { + + readonly TComparer comparer; + + /// + /// Initializes a new instance. + /// + /// + public ImmutableArrayValueComparer(TComparer comparer) + { + this.comparer = comparer; + } + + /// + public bool Equals(ImmutableArray x, ImmutableArray y) + { + if (x == y) + return true; + + if (x.Length != y.Length) + return false; + + for (int i = 0; i < x.Length; i++) + if (comparer.Equals(x[i], y[i]) == false) + return false; + + return true; + } + + /// + public int GetHashCode([DisallowNull] ImmutableArray obj) + { + var h = new HashCode(); + h.Add(obj.Length); + + for (int i = 0; i < obj.Length; i++) + h.Add(obj[i], comparer); + + return h.ToHashCode(); + } + } + + /// + /// Value-type implementation of . + /// + /// + public readonly struct ValueReferenceEqualityComparer : IEqualityComparer + where T : class + { + + /// + public bool Equals(T? x, T? y) + { + return x == y; + } + + /// + public int GetHashCode([DisallowNull] T obj) + { + return obj.GetHashCode(); + } + + } + + /// + /// Returns true if the two given instances are exactly equal, including their contents. + /// + /// + /// + /// + /// + public static bool ImmutableArrayReferenceEquals(this ImmutableArray x, ImmutableArray y) + where T : class + { + return ImmutableArrayEquals(x, y, new ValueReferenceEqualityComparer()); + } + + /// + /// Returns true if the two given instances are exactly equal, including their contents. + /// + /// + /// + /// + /// + public static bool ImmutableArrayEquals(this ImmutableArray x, ImmutableArray y) + { + return ImmutableArrayEquals(x, y, EqualityComparer.Default); + } + + /// + /// Returns true if the two given instances are exactly equal, including their contents. + /// + /// + /// + /// + /// + public static bool ImmutableArrayEquals(this ImmutableArray x, ImmutableArray y, TComparer comparer) + where TComparer : IEqualityComparer + { + return new ImmutableArrayValueComparer(comparer).Equals(x, y); + } + + } + +} diff --git a/src/IKVM.CoreLib/Collections/IndexRangeDictionary.cs b/src/IKVM.CoreLib/Collections/IndexRangeDictionary.cs new file mode 100644 index 0000000000..e361df9bbb --- /dev/null +++ b/src/IKVM.CoreLib/Collections/IndexRangeDictionary.cs @@ -0,0 +1,159 @@ +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace IKVM.CoreLib.Collections +{ + + /// + /// Represents a dictionary that can store int keys mapped to values, where the underlying storage is an array that + /// holds the minimum number of items for the minimum and maximum key values. + /// + struct IndexRangeDictionary + { + + const int ALIGNMENT = 8; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + static internal int AlignTowardsInfinity(int i) + { + if (i >= 0) + return (i + (ALIGNMENT - 1)) & -ALIGNMENT; + else + return -((-i + (ALIGNMENT - 1)) & -ALIGNMENT); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + static internal int AlignTowardsZero(int i) + { + if (i >= 0) + return i - (i % ALIGNMENT); + else + return -(-i - (-i % ALIGNMENT)); + } + + int _maxCapacity; + internal int _minKey = 0; + internal int _maxKey = 0; + internal T?[] _items = []; + + /// + /// Initializes a new instance. + /// + public IndexRangeDictionary() : this(maxCapacity: int.MaxValue) + { + + } + + /// + /// Initializes a new instance. + /// + public IndexRangeDictionary(int maxCapacity = int.MaxValue) + { + if (maxCapacity < 0) + throw new ArgumentOutOfRangeException(nameof(maxCapacity)); + + _maxCapacity = maxCapacity; + } + + /// + /// Gets the capacity of the dictionary. + /// + public readonly int Capacity => _items.Length; + + /// + /// Gets or sets the item with the specified key, optionally growing the list to accomidate. + /// + /// + /// + public T? this[int key] + { + readonly get => Get(key); + set => Set(key, value); + } + + /// + /// Ensures the list is sized such that it can hold the specified key. + /// + /// + /// + public void EnsureCapacity(int key) + { + // on first hit, set keys to this key (not 0) + if (_items.Length == 0) + { + _minKey = key; + _maxKey = key; + } + + // calculate new min and max aligned + var newMin = Math.Min(_minKey, Math.Min(AlignTowardsZero(key), AlignTowardsInfinity(key))); + var newMax = Math.Max(_maxKey, Math.Max(AlignTowardsZero(key), AlignTowardsInfinity(key))); + + // calculate desired length + var len = Math.Max(_items.Length, 8); + while (len < newMax - newMin + 1) + len *= 2; + + // calculate amount to shift + int sft = 0; + if (newMin < _minKey) + sft = _minKey - newMin; + + // if we calculated any resize or shift operation, apply + if (_items.Length != len || sft > 0) + { + // we will be copying data either to either existing array or new array + var src = _items; + if (_items.Length != len) + _items = new T[len]; + + // copy source data to destination at shift + // clear newly exposed positions + if (src.Length > 0) + { + Array.Copy(src, 0, _items, sft, _maxKey - _minKey + 1); + Array.Clear(_items, 0, sft); + } + } + + // reset our min and max range + _minKey = newMin; + _maxKey = newMax; + + Debug.Assert(key - _minKey >= 0); + Debug.Assert(key - _minKey < _items.Length); + } + + /// + /// Adds a new item to the list. + /// + /// + readonly T? Get(int key) + { + var pos = key - _minKey; + if (pos < 0 || pos >= _items.Length) + return default; + else + return _items[pos]; + } + + /// + /// Adds a new item to the list. + /// + /// + /// + void Set(int key, T? value) + { + EnsureCapacity(key); + if (_items == null) + throw new InvalidOperationException(); + + Debug.Assert(key - _minKey >= 0); + Debug.Assert(key - _minKey < _items.Length); + _items[key - _minKey] = value; + } + + } + +} diff --git a/src/IKVM.CoreLib/Diagnostics/Diagnostic.g.cs b/src/IKVM.CoreLib/Diagnostics/Diagnostic.g.cs index 9f7f9e73d2..c5edb304d0 100644 --- a/src/IKVM.CoreLib/Diagnostics/Diagnostic.g.cs +++ b/src/IKVM.CoreLib/Diagnostics/Diagnostic.g.cs @@ -285,6 +285,8 @@ partial record class Diagnostic return ModuleInitializerMethodRequirements; case 5060: return InvalidZip; + case 5061: + return CoreAssemblyVersionMismatch; case 6000: return GenericRuntimeTrace; case 6001: @@ -300,7 +302,7 @@ partial record class Diagnostic /// The 'MainMethodFound' diagnostic. /// /// -/// Found main method in class "{arg0}". +/// Info: Found main method in class "{arg0}". /// public static readonly Diagnostic MainMethodFound = new Diagnostic(1, nameof(MainMethodFound), "Found main method in class \"{0}\".", DiagnosticLevel.Info); @@ -308,7 +310,7 @@ partial record class Diagnostic /// The 'OutputFileIs' diagnostic. /// /// -/// Output file is "{arg0}". +/// Info: Output file is "{arg0}". /// public static readonly Diagnostic OutputFileIs = new Diagnostic(2, nameof(OutputFileIs), "Output file is \"{0}\".", DiagnosticLevel.Info); @@ -316,7 +318,7 @@ partial record class Diagnostic /// The 'AutoAddRef' diagnostic. /// /// -/// Automatically adding reference to "{arg0}". +/// Info: Automatically adding reference to "{arg0}". /// public static readonly Diagnostic AutoAddRef = new Diagnostic(3, nameof(AutoAddRef), "Automatically adding reference to \"{0}\".", DiagnosticLevel.Info); @@ -324,7 +326,7 @@ partial record class Diagnostic /// The 'MainMethodFromManifest' diagnostic. /// /// -/// Using main class "{arg0}" based on jar manifest. +/// Info: Using main class "{arg0}" based on jar manifest. /// public static readonly Diagnostic MainMethodFromManifest = new Diagnostic(4, nameof(MainMethodFromManifest), "Using main class \"{0}\" based on jar manifest.", DiagnosticLevel.Info); @@ -332,7 +334,7 @@ partial record class Diagnostic /// The 'GenericCompilerInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static readonly Diagnostic GenericCompilerInfo = new Diagnostic(5, nameof(GenericCompilerInfo), "{0}", DiagnosticLevel.Info); @@ -340,7 +342,7 @@ partial record class Diagnostic /// The 'GenericClassLoadingInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static readonly Diagnostic GenericClassLoadingInfo = new Diagnostic(6, nameof(GenericClassLoadingInfo), "{0}", DiagnosticLevel.Info); @@ -348,7 +350,7 @@ partial record class Diagnostic /// The 'GenericVerifierInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static readonly Diagnostic GenericVerifierInfo = new Diagnostic(7, nameof(GenericVerifierInfo), "{0}", DiagnosticLevel.Info); @@ -356,7 +358,7 @@ partial record class Diagnostic /// The 'GenericRuntimeInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static readonly Diagnostic GenericRuntimeInfo = new Diagnostic(8, nameof(GenericRuntimeInfo), "{0}", DiagnosticLevel.Info); @@ -364,7 +366,7 @@ partial record class Diagnostic /// The 'GenericJniInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static readonly Diagnostic GenericJniInfo = new Diagnostic(9, nameof(GenericJniInfo), "{0}", DiagnosticLevel.Info); @@ -372,7 +374,7 @@ partial record class Diagnostic /// The 'ClassNotFound' diagnostic. /// /// -/// Class "{arg0}" not found. +/// Warning: Class "{arg0}" not found. /// public static readonly Diagnostic ClassNotFound = new Diagnostic(100, nameof(ClassNotFound), "Class \"{0}\" not found.", DiagnosticLevel.Warning); @@ -380,7 +382,7 @@ partial record class Diagnostic /// The 'ClassFormatError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (class format error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (class format error "{arg1}") /// public static readonly Diagnostic ClassFormatError = new Diagnostic(101, nameof(ClassFormatError), "Unable to compile class \"{0}\". (class format error \"{1}\")", DiagnosticLevel.Warning); @@ -388,7 +390,7 @@ partial record class Diagnostic /// The 'DuplicateClassName' diagnostic. /// /// -/// Duplicate class name: "{arg0}". +/// Warning: Duplicate class name: "{arg0}". /// public static readonly Diagnostic DuplicateClassName = new Diagnostic(102, nameof(DuplicateClassName), "Duplicate class name: \"{0}\".", DiagnosticLevel.Warning); @@ -396,7 +398,7 @@ partial record class Diagnostic /// The 'IllegalAccessError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (illegal access error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (illegal access error "{arg1}") /// public static readonly Diagnostic IllegalAccessError = new Diagnostic(103, nameof(IllegalAccessError), "Unable to compile class \"{0}\". (illegal access error \"{1}\")", DiagnosticLevel.Warning); @@ -404,7 +406,7 @@ partial record class Diagnostic /// The 'VerificationError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (verification error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (verification error "{arg1}") /// public static readonly Diagnostic VerificationError = new Diagnostic(104, nameof(VerificationError), "Unable to compile class \"{0}\". (verification error \"{1}\")", DiagnosticLevel.Warning); @@ -412,7 +414,7 @@ partial record class Diagnostic /// The 'NoClassDefFoundError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (missing class "{arg1}") +/// Warning: Unable to compile class "{arg0}". (missing class "{arg1}") /// public static readonly Diagnostic NoClassDefFoundError = new Diagnostic(105, nameof(NoClassDefFoundError), "Unable to compile class \"{0}\". (missing class \"{1}\")", DiagnosticLevel.Warning); @@ -420,7 +422,7 @@ partial record class Diagnostic /// The 'GenericUnableToCompileError' diagnostic. /// /// -/// Unable to compile class "{arg0}". ("{arg1}": "{arg2}") +/// Warning: Unable to compile class "{arg0}". ("{arg1}": "{arg2}") /// public static readonly Diagnostic GenericUnableToCompileError = new Diagnostic(106, nameof(GenericUnableToCompileError), "Unable to compile class \"{0}\". (\"{1}\": \"{2}\")", DiagnosticLevel.Warning); @@ -428,7 +430,7 @@ partial record class Diagnostic /// The 'DuplicateResourceName' diagnostic. /// /// -/// Skipping resource (name clash): "{arg0}" +/// Warning: Skipping resource (name clash): "{arg0}" /// public static readonly Diagnostic DuplicateResourceName = new Diagnostic(107, nameof(DuplicateResourceName), "Skipping resource (name clash): \"{0}\"", DiagnosticLevel.Warning); @@ -436,7 +438,7 @@ partial record class Diagnostic /// The 'SkippingReferencedClass' diagnostic. /// /// -/// Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") +/// Warning: Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") /// public static readonly Diagnostic SkippingReferencedClass = new Diagnostic(109, nameof(SkippingReferencedClass), "Skipping class: \"{0}\". (class is already available in referenced assembly \"{1}\")", DiagnosticLevel.Warning); @@ -444,7 +446,7 @@ partial record class Diagnostic /// The 'NoJniRuntime' diagnostic. /// /// -/// Unable to load runtime JNI assembly. +/// Warning: Unable to load runtime JNI assembly. /// public static readonly Diagnostic NoJniRuntime = new Diagnostic(110, nameof(NoJniRuntime), "Unable to load runtime JNI assembly.", DiagnosticLevel.Warning); @@ -452,7 +454,7 @@ partial record class Diagnostic /// The 'EmittedNoClassDefFoundError' diagnostic. /// /// -/// Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). +/// Warning: Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). /// public static readonly Diagnostic EmittedNoClassDefFoundError = new Diagnostic(111, nameof(EmittedNoClassDefFoundError), "Emitted java.lang.NoClassDefFoundError in \"{0}\". (\"{1}\").", DiagnosticLevel.Warning); @@ -460,7 +462,7 @@ partial record class Diagnostic /// The 'EmittedIllegalAccessError' diagnostic. /// /// -/// Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedIllegalAccessError = new Diagnostic(112, nameof(EmittedIllegalAccessError), "Emitted java.lang.IllegalAccessError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -468,7 +470,7 @@ partial record class Diagnostic /// The 'EmittedInstantiationError' diagnostic. /// /// -/// Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedInstantiationError = new Diagnostic(113, nameof(EmittedInstantiationError), "Emitted java.lang.InstantiationError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -476,7 +478,7 @@ partial record class Diagnostic /// The 'EmittedIncompatibleClassChangeError' diagnostic. /// /// -/// Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedIncompatibleClassChangeError = new Diagnostic(114, nameof(EmittedIncompatibleClassChangeError), "Emitted java.lang.IncompatibleClassChangeError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -484,7 +486,7 @@ partial record class Diagnostic /// The 'EmittedNoSuchFieldError' diagnostic. /// /// -/// Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedNoSuchFieldError = new Diagnostic(115, nameof(EmittedNoSuchFieldError), "Emitted java.lang.NoSuchFieldError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -492,7 +494,7 @@ partial record class Diagnostic /// The 'EmittedAbstractMethodError' diagnostic. /// /// -/// Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedAbstractMethodError = new Diagnostic(116, nameof(EmittedAbstractMethodError), "Emitted java.lang.AbstractMethodError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -500,7 +502,7 @@ partial record class Diagnostic /// The 'EmittedNoSuchMethodError' diagnostic. /// /// -/// Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedNoSuchMethodError = new Diagnostic(117, nameof(EmittedNoSuchMethodError), "Emitted java.lang.NoSuchMethodError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -508,7 +510,7 @@ partial record class Diagnostic /// The 'EmittedLinkageError' diagnostic. /// /// -/// Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedLinkageError = new Diagnostic(118, nameof(EmittedLinkageError), "Emitted java.lang.LinkageError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -516,7 +518,7 @@ partial record class Diagnostic /// The 'EmittedVerificationError' diagnostic. /// /// -/// Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedVerificationError = new Diagnostic(119, nameof(EmittedVerificationError), "Emitted java.lang.VerificationError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -524,7 +526,7 @@ partial record class Diagnostic /// The 'EmittedClassFormatError' diagnostic. /// /// -/// Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") /// public static readonly Diagnostic EmittedClassFormatError = new Diagnostic(120, nameof(EmittedClassFormatError), "Emitted java.lang.ClassFormatError in \"{0}\". (\"{1}\")", DiagnosticLevel.Warning); @@ -532,7 +534,7 @@ partial record class Diagnostic /// The 'InvalidCustomAttribute' diagnostic. /// /// -/// Error emitting "{arg0}" custom attribute. ("{arg1}") +/// Warning: Error emitting "{arg0}" custom attribute. ("{arg1}") /// public static readonly Diagnostic InvalidCustomAttribute = new Diagnostic(121, nameof(InvalidCustomAttribute), "Error emitting \"{0}\" custom attribute. (\"{1}\")", DiagnosticLevel.Warning); @@ -540,7 +542,7 @@ partial record class Diagnostic /// The 'IgnoredCustomAttribute' diagnostic. /// /// -/// Custom attribute "{arg0}" was ignored. ("{arg1}") +/// Warning: Custom attribute "{arg0}" was ignored. ("{arg1}") /// public static readonly Diagnostic IgnoredCustomAttribute = new Diagnostic(122, nameof(IgnoredCustomAttribute), "Custom attribute \"{0}\" was ignored. (\"{1}\")", DiagnosticLevel.Warning); @@ -548,7 +550,7 @@ partial record class Diagnostic /// The 'AssumeAssemblyVersionMatch' diagnostic. /// /// -/// Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy +/// Warning: Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy /// public static readonly Diagnostic AssumeAssemblyVersionMatch = new Diagnostic(123, nameof(AssumeAssemblyVersionMatch), "Assuming assembly reference \"{0}\" matches \"{1}\", you may need to supply runtime p" + "olicy", DiagnosticLevel.Warning); @@ -557,7 +559,7 @@ partial record class Diagnostic /// The 'InvalidDirectoryInLibOptionPath' diagnostic. /// /// -/// Directory "{arg0}" specified in -lib option is not valid. +/// Warning: Directory "{arg0}" specified in -lib option is not valid. /// public static readonly Diagnostic InvalidDirectoryInLibOptionPath = new Diagnostic(124, nameof(InvalidDirectoryInLibOptionPath), "Directory \"{0}\" specified in -lib option is not valid.", DiagnosticLevel.Warning); @@ -565,7 +567,7 @@ partial record class Diagnostic /// The 'InvalidDirectoryInLibEnvironmentPath' diagnostic. /// /// -/// Directory "{arg0}" specified in LIB environment is not valid. +/// Warning: Directory "{arg0}" specified in LIB environment is not valid. /// public static readonly Diagnostic InvalidDirectoryInLibEnvironmentPath = new Diagnostic(125, nameof(InvalidDirectoryInLibEnvironmentPath), "Directory \"{0}\" specified in LIB environment is not valid.", DiagnosticLevel.Warning); @@ -573,7 +575,7 @@ partial record class Diagnostic /// The 'LegacySearchRule' diagnostic. /// /// -/// Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. +/// Warning: Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. /// public static readonly Diagnostic LegacySearchRule = new Diagnostic(126, nameof(LegacySearchRule), "Found assembly \"{0}\" using legacy search rule, please append \'.dll\' to the refere" + "nce.", DiagnosticLevel.Warning); @@ -582,7 +584,7 @@ partial record class Diagnostic /// The 'AssemblyLocationIgnored' diagnostic. /// /// -/// Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". +/// Warning: Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". /// public static readonly Diagnostic AssemblyLocationIgnored = new Diagnostic(127, nameof(AssemblyLocationIgnored), "Assembly \"{0}\" is ignored as previously loaded assembly \"{1}\" has the same identi" + "ty \"{2}\".", DiagnosticLevel.Warning); @@ -591,7 +593,7 @@ partial record class Diagnostic /// The 'InterfaceMethodCantBeInternal' diagnostic. /// /// -/// Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") +/// Warning: Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") /// public static readonly Diagnostic InterfaceMethodCantBeInternal = new Diagnostic(128, nameof(InterfaceMethodCantBeInternal), "Ignoring @ikvm.lang.Internal annotation on interface method. (\"{0}.{1}{2}\")", DiagnosticLevel.Warning); @@ -599,7 +601,7 @@ partial record class Diagnostic /// The 'DuplicateAssemblyReference' diagnostic. /// /// -/// Duplicate assembly reference "{arg0}" +/// Warning: Duplicate assembly reference "{arg0}" /// public static readonly Diagnostic DuplicateAssemblyReference = new Diagnostic(132, nameof(DuplicateAssemblyReference), "Duplicate assembly reference \"{0}\"", DiagnosticLevel.Warning); @@ -607,7 +609,7 @@ partial record class Diagnostic /// The 'UnableToResolveType' diagnostic. /// /// -/// Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. +/// Warning: Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. /// public static readonly Diagnostic UnableToResolveType = new Diagnostic(133, nameof(UnableToResolveType), "Reference in \"{0}\" to type \"{1}\" claims it is defined in \"{2}\", but it could not " + "be found.", DiagnosticLevel.Warning); @@ -616,7 +618,7 @@ partial record class Diagnostic /// The 'StubsAreDeprecated' diagnostic. /// /// -/// Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. +/// Warning: Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. /// public static readonly Diagnostic StubsAreDeprecated = new Diagnostic(134, nameof(StubsAreDeprecated), "Compiling stubs is deprecated. Please add a reference to assembly \"{0}\" instead.", DiagnosticLevel.Warning); @@ -624,7 +626,7 @@ partial record class Diagnostic /// The 'WrongClassName' diagnostic. /// /// -/// Unable to compile "{arg0}" (wrong name: "{arg1}") +/// Warning: Unable to compile "{arg0}" (wrong name: "{arg1}") /// public static readonly Diagnostic WrongClassName = new Diagnostic(135, nameof(WrongClassName), "Unable to compile \"{0}\" (wrong name: \"{1}\")", DiagnosticLevel.Warning); @@ -632,7 +634,7 @@ partial record class Diagnostic /// The 'ReflectionCallerClassRequiresCallerID' diagnostic. /// /// -/// Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") +/// Warning: Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") /// public static readonly Diagnostic ReflectionCallerClassRequiresCallerID = new Diagnostic(136, nameof(ReflectionCallerClassRequiresCallerID), "Reflection.getCallerClass() called from non-CallerID method. (\"{0}.{1}{2}\")", DiagnosticLevel.Warning); @@ -640,7 +642,7 @@ partial record class Diagnostic /// The 'LegacyAssemblyAttributesFound' diagnostic. /// /// -/// Legacy assembly attributes container found. Please use the -assemblyattributes: option. +/// Warning: Legacy assembly attributes container found. Please use the -assemblyattributes: option. /// public static readonly Diagnostic LegacyAssemblyAttributesFound = new Diagnostic(137, nameof(LegacyAssemblyAttributesFound), "Legacy assembly attributes container found. Please use the -assemblyattributes: option.", DiagnosticLevel.Warning); @@ -649,7 +651,7 @@ partial record class Diagnostic /// The 'UnableToCreateLambdaFactory' diagnostic. /// /// -/// Unable to create static lambda factory. +/// Warning: Unable to create static lambda factory. /// public static readonly Diagnostic UnableToCreateLambdaFactory = new Diagnostic(138, nameof(UnableToCreateLambdaFactory), "Unable to create static lambda factory.", DiagnosticLevel.Warning); @@ -657,7 +659,7 @@ partial record class Diagnostic /// The 'UnknownWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static readonly Diagnostic UnknownWarning = new Diagnostic(999, nameof(UnknownWarning), "{0}", DiagnosticLevel.Warning); @@ -665,7 +667,7 @@ partial record class Diagnostic /// The 'DuplicateIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// public static readonly Diagnostic DuplicateIkvmLangProperty = new Diagnostic(139, nameof(DuplicateIkvmLangProperty), "Ignoring duplicate ikvm.lang.Property annotation on {0}.{1}.", DiagnosticLevel.Warning); @@ -673,7 +675,7 @@ partial record class Diagnostic /// The 'MalformedIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// public static readonly Diagnostic MalformedIkvmLangProperty = new Diagnostic(140, nameof(MalformedIkvmLangProperty), "Ignoring duplicate ikvm.lang.Property annotation on {0}.{1}.", DiagnosticLevel.Warning); @@ -681,7 +683,7 @@ partial record class Diagnostic /// The 'GenericCompilerWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static readonly Diagnostic GenericCompilerWarning = new Diagnostic(141, nameof(GenericCompilerWarning), "{0}", DiagnosticLevel.Warning); @@ -689,7 +691,7 @@ partial record class Diagnostic /// The 'GenericClassLoadingWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static readonly Diagnostic GenericClassLoadingWarning = new Diagnostic(142, nameof(GenericClassLoadingWarning), "{0}", DiagnosticLevel.Warning); @@ -697,7 +699,7 @@ partial record class Diagnostic /// The 'GenericVerifierWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static readonly Diagnostic GenericVerifierWarning = new Diagnostic(143, nameof(GenericVerifierWarning), "{0}", DiagnosticLevel.Warning); @@ -705,7 +707,7 @@ partial record class Diagnostic /// The 'GenericRuntimeWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static readonly Diagnostic GenericRuntimeWarning = new Diagnostic(144, nameof(GenericRuntimeWarning), "{0}", DiagnosticLevel.Warning); @@ -713,7 +715,7 @@ partial record class Diagnostic /// The 'GenericJniWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static readonly Diagnostic GenericJniWarning = new Diagnostic(145, nameof(GenericJniWarning), "{0}", DiagnosticLevel.Warning); @@ -721,7 +723,7 @@ partial record class Diagnostic /// The 'UnableToCreateProxy' diagnostic. /// /// -/// Unable to create proxy "{arg0}". ("{arg1}") +/// Error: Unable to create proxy "{arg0}". ("{arg1}") /// public static readonly Diagnostic UnableToCreateProxy = new Diagnostic(4001, nameof(UnableToCreateProxy), "Unable to create proxy \"{0}\". (\"{1}\")", DiagnosticLevel.Error); @@ -729,7 +731,7 @@ partial record class Diagnostic /// The 'DuplicateProxy' diagnostic. /// /// -/// Duplicate proxy "{arg0}". +/// Error: Duplicate proxy "{arg0}". /// public static readonly Diagnostic DuplicateProxy = new Diagnostic(4002, nameof(DuplicateProxy), "Duplicate proxy \"{0}\".", DiagnosticLevel.Error); @@ -737,7 +739,7 @@ partial record class Diagnostic /// The 'MapXmlUnableToResolveOpCode' diagnostic. /// /// -/// Unable to resolve opcode in remap file: {arg0}. +/// Error: Unable to resolve opcode in remap file: {arg0}. /// public static readonly Diagnostic MapXmlUnableToResolveOpCode = new Diagnostic(4003, nameof(MapXmlUnableToResolveOpCode), "Unable to resolve opcode in remap file: {0}.", DiagnosticLevel.Error); @@ -745,7 +747,7 @@ partial record class Diagnostic /// The 'MapXmlError' diagnostic. /// /// -/// Error in remap file: {arg0}. +/// Error: Error in remap file: {arg0}. /// public static readonly Diagnostic MapXmlError = new Diagnostic(4004, nameof(MapXmlError), "Error in remap file: {0}.", DiagnosticLevel.Error); @@ -753,7 +755,7 @@ partial record class Diagnostic /// The 'InputFileNotFound' diagnostic. /// /// -/// Source file '{arg0}' not found. +/// Error: Source file '{arg0}' not found. /// public static readonly Diagnostic InputFileNotFound = new Diagnostic(4005, nameof(InputFileNotFound), "Source file \'{0}\' not found.", DiagnosticLevel.Error); @@ -761,7 +763,7 @@ partial record class Diagnostic /// The 'UnknownFileType' diagnostic. /// /// -/// Unknown file type: {arg0}. +/// Error: Unknown file type: {arg0}. /// public static readonly Diagnostic UnknownFileType = new Diagnostic(4006, nameof(UnknownFileType), "Unknown file type: {0}.", DiagnosticLevel.Error); @@ -769,7 +771,7 @@ partial record class Diagnostic /// The 'UnknownElementInMapFile' diagnostic. /// /// -/// Unknown element {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown element {arg0} in remap file, line {arg1}, column {arg2}. /// public static readonly Diagnostic UnknownElementInMapFile = new Diagnostic(4007, nameof(UnknownElementInMapFile), "Unknown element {0} in remap file, line {1}, column {2}.", DiagnosticLevel.Error); @@ -777,7 +779,7 @@ partial record class Diagnostic /// The 'UnknownAttributeInMapFile' diagnostic. /// /// -/// Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. /// public static readonly Diagnostic UnknownAttributeInMapFile = new Diagnostic(4008, nameof(UnknownAttributeInMapFile), "Unknown attribute {0} in remap file, line {1}, column {2}.", DiagnosticLevel.Error); @@ -785,7 +787,7 @@ partial record class Diagnostic /// The 'InvalidMemberNameInMapFile' diagnostic. /// /// -/// Invalid {arg0} name '{arg1}' in remap file in class {arg2}. +/// Error: Invalid {arg0} name '{arg1}' in remap file in class {arg2}. /// public static readonly Diagnostic InvalidMemberNameInMapFile = new Diagnostic(4009, nameof(InvalidMemberNameInMapFile), "Invalid {0} name \'{1}\' in remap file in class {2}.", DiagnosticLevel.Error); @@ -793,7 +795,7 @@ partial record class Diagnostic /// The 'InvalidMemberSignatureInMapFile' diagnostic. /// /// -/// Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. +/// Error: Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. /// public static readonly Diagnostic InvalidMemberSignatureInMapFile = new Diagnostic(4010, nameof(InvalidMemberSignatureInMapFile), "Invalid {0} signature \'{3}\' in remap file for {0} {1}.{2}.", DiagnosticLevel.Error); @@ -801,7 +803,7 @@ partial record class Diagnostic /// The 'InvalidPropertyNameInMapFile' diagnostic. /// /// -/// Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. /// public static readonly Diagnostic InvalidPropertyNameInMapFile = new Diagnostic(4011, nameof(InvalidPropertyNameInMapFile), "Invalid property {0} name \'{3}\' in remap file for property {1}.{2}.", DiagnosticLevel.Error); @@ -809,7 +811,7 @@ partial record class Diagnostic /// The 'InvalidPropertySignatureInMapFile' diagnostic. /// /// -/// Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. /// public static readonly Diagnostic InvalidPropertySignatureInMapFile = new Diagnostic(4012, nameof(InvalidPropertySignatureInMapFile), "Invalid property {0} signature \'{3}\' in remap file for property {1}.{2}.", DiagnosticLevel.Error); @@ -817,7 +819,7 @@ partial record class Diagnostic /// The 'NonPrimaryAssemblyReference' diagnostic. /// /// -/// Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. +/// Error: Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. /// public static readonly Diagnostic NonPrimaryAssemblyReference = new Diagnostic(4013, nameof(NonPrimaryAssemblyReference), "Referenced assembly \"{0}\" is not the primary assembly of a shared class loader gr" + "oup, please reference primary assembly \"{1}\" instead.", DiagnosticLevel.Error); @@ -826,7 +828,7 @@ partial record class Diagnostic /// The 'MissingType' diagnostic. /// /// -/// Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. +/// Error: Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. /// public static readonly Diagnostic MissingType = new Diagnostic(4014, nameof(MissingType), "Reference to type \"{0}\" claims it is defined in \"{1}\", but it could not be found." + "", DiagnosticLevel.Error); @@ -835,7 +837,7 @@ partial record class Diagnostic /// The 'MissingReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. +/// Error: The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. /// public static readonly Diagnostic MissingReference = new Diagnostic(4015, nameof(MissingReference), "The type \'{0}\' is defined in an assembly that is notResponseFileDepthExceeded ref" + "erenced. You must add a reference to assembly \'{1}\'.", DiagnosticLevel.Error); @@ -844,7 +846,7 @@ partial record class Diagnostic /// The 'CallerSensitiveOnUnsupportedMethod' diagnostic. /// /// -/// CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") +/// Error: CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") /// public static readonly Diagnostic CallerSensitiveOnUnsupportedMethod = new Diagnostic(4016, nameof(CallerSensitiveOnUnsupportedMethod), "CallerSensitive annotation on unsupported method. (\"{0}.{1}{2}\")", DiagnosticLevel.Error); @@ -852,7 +854,7 @@ partial record class Diagnostic /// The 'RemappedTypeMissingDefaultInterfaceMethod' diagnostic. /// /// -/// {arg0} does not implement default interface method {arg1}. +/// Error: {arg0} does not implement default interface method {arg1}. /// public static readonly Diagnostic RemappedTypeMissingDefaultInterfaceMethod = new Diagnostic(4017, nameof(RemappedTypeMissingDefaultInterfaceMethod), "{0} does not implement default interface method {1}.", DiagnosticLevel.Error); @@ -860,7 +862,7 @@ partial record class Diagnostic /// The 'GenericCompilerError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static readonly Diagnostic GenericCompilerError = new Diagnostic(4018, nameof(GenericCompilerError), "{0}", DiagnosticLevel.Error); @@ -868,7 +870,7 @@ partial record class Diagnostic /// The 'GenericClassLoadingError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static readonly Diagnostic GenericClassLoadingError = new Diagnostic(4019, nameof(GenericClassLoadingError), "{0}", DiagnosticLevel.Error); @@ -876,7 +878,7 @@ partial record class Diagnostic /// The 'GenericVerifierError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static readonly Diagnostic GenericVerifierError = new Diagnostic(4020, nameof(GenericVerifierError), "{0}", DiagnosticLevel.Error); @@ -884,7 +886,7 @@ partial record class Diagnostic /// The 'GenericRuntimeError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static readonly Diagnostic GenericRuntimeError = new Diagnostic(4021, nameof(GenericRuntimeError), "{0}", DiagnosticLevel.Error); @@ -892,7 +894,7 @@ partial record class Diagnostic /// The 'GenericJniError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static readonly Diagnostic GenericJniError = new Diagnostic(4022, nameof(GenericJniError), "{0}", DiagnosticLevel.Error); @@ -900,7 +902,7 @@ partial record class Diagnostic /// The 'ExportingImportsNotSupported' diagnostic. /// /// -/// Exporting previously imported assemblies is not supported. +/// Error: Exporting previously imported assemblies is not supported. /// public static readonly Diagnostic ExportingImportsNotSupported = new Diagnostic(4023, nameof(ExportingImportsNotSupported), "Exporting previously imported assemblies is not supported.", DiagnosticLevel.Error); @@ -908,7 +910,7 @@ partial record class Diagnostic /// The 'ResponseFileDepthExceeded' diagnostic. /// /// -/// Response file nesting depth exceeded. +/// Fatal: Response file nesting depth exceeded. /// public static readonly Diagnostic ResponseFileDepthExceeded = new Diagnostic(5000, nameof(ResponseFileDepthExceeded), "Response file nesting depth exceeded.", DiagnosticLevel.Fatal); @@ -916,7 +918,7 @@ partial record class Diagnostic /// The 'ErrorReadingFile' diagnostic. /// /// -/// Unable to read file: {arg0}. ({arg1}) +/// Fatal: Unable to read file: {arg0}. ({arg1}) /// public static readonly Diagnostic ErrorReadingFile = new Diagnostic(5001, nameof(ErrorReadingFile), "Unable to read file: {0}. ({1})", DiagnosticLevel.Fatal); @@ -924,7 +926,7 @@ partial record class Diagnostic /// The 'NoTargetsFound' diagnostic. /// /// -/// No targets found +/// Fatal: No targets found /// public static readonly Diagnostic NoTargetsFound = new Diagnostic(5002, nameof(NoTargetsFound), "No targets found", DiagnosticLevel.Fatal); @@ -932,7 +934,7 @@ partial record class Diagnostic /// The 'FileFormatLimitationExceeded' diagnostic. /// /// -/// File format limitation exceeded: {arg0}. +/// Fatal: File format limitation exceeded: {arg0}. /// public static readonly Diagnostic FileFormatLimitationExceeded = new Diagnostic(5003, nameof(FileFormatLimitationExceeded), "File format limitation exceeded: {0}.", DiagnosticLevel.Fatal); @@ -940,7 +942,7 @@ partial record class Diagnostic /// The 'CannotSpecifyBothKeyFileAndContainer' diagnostic. /// /// -/// You cannot specify both a key file and container. +/// Fatal: You cannot specify both a key file and container. /// public static readonly Diagnostic CannotSpecifyBothKeyFileAndContainer = new Diagnostic(5004, nameof(CannotSpecifyBothKeyFileAndContainer), "You cannot specify both a key file and container.", DiagnosticLevel.Fatal); @@ -948,7 +950,7 @@ partial record class Diagnostic /// The 'DelaySignRequiresKey' diagnostic. /// /// -/// You cannot delay sign without a key file or container. +/// Fatal: You cannot delay sign without a key file or container. /// public static readonly Diagnostic DelaySignRequiresKey = new Diagnostic(5005, nameof(DelaySignRequiresKey), "You cannot delay sign without a key file or container.", DiagnosticLevel.Fatal); @@ -956,7 +958,7 @@ partial record class Diagnostic /// The 'InvalidStrongNameKeyPair' diagnostic. /// /// -/// Invalid key {arg0} specified. ("{arg1}") +/// Fatal: Invalid key {arg0} specified. ("{arg1}") /// public static readonly Diagnostic InvalidStrongNameKeyPair = new Diagnostic(5006, nameof(InvalidStrongNameKeyPair), "Invalid key {0} specified. (\"{1}\")", DiagnosticLevel.Fatal); @@ -964,7 +966,7 @@ partial record class Diagnostic /// The 'ReferenceNotFound' diagnostic. /// /// -/// Reference not found: {arg0} +/// Fatal: Reference not found: {arg0} /// public static readonly Diagnostic ReferenceNotFound = new Diagnostic(5007, nameof(ReferenceNotFound), "Reference not found: {0}", DiagnosticLevel.Fatal); @@ -972,7 +974,7 @@ partial record class Diagnostic /// The 'OptionsMustPreceedChildLevels' diagnostic. /// /// -/// You can only specify options before any child levels. +/// Fatal: You can only specify options before any child levels. /// public static readonly Diagnostic OptionsMustPreceedChildLevels = new Diagnostic(5008, nameof(OptionsMustPreceedChildLevels), "You can only specify options before any child levels.", DiagnosticLevel.Fatal); @@ -980,7 +982,7 @@ partial record class Diagnostic /// The 'UnrecognizedTargetType' diagnostic. /// /// -/// Invalid value '{arg0}' for -target option. +/// Fatal: Invalid value '{arg0}' for -target option. /// public static readonly Diagnostic UnrecognizedTargetType = new Diagnostic(5009, nameof(UnrecognizedTargetType), "Invalid value \'{0}\' for -target option.", DiagnosticLevel.Fatal); @@ -988,7 +990,7 @@ partial record class Diagnostic /// The 'UnrecognizedPlatform' diagnostic. /// /// -/// Invalid value '{arg0}' for -platform option. +/// Fatal: Invalid value '{arg0}' for -platform option. /// public static readonly Diagnostic UnrecognizedPlatform = new Diagnostic(5010, nameof(UnrecognizedPlatform), "Invalid value \'{0}\' for -platform option.", DiagnosticLevel.Fatal); @@ -996,7 +998,7 @@ partial record class Diagnostic /// The 'UnrecognizedApartment' diagnostic. /// /// -/// Invalid value '{arg0}' for -apartment option. +/// Fatal: Invalid value '{arg0}' for -apartment option. /// public static readonly Diagnostic UnrecognizedApartment = new Diagnostic(5011, nameof(UnrecognizedApartment), "Invalid value \'{0}\' for -apartment option.", DiagnosticLevel.Fatal); @@ -1004,7 +1006,7 @@ partial record class Diagnostic /// The 'MissingFileSpecification' diagnostic. /// /// -/// Missing file specification for '{arg0}' option. +/// Fatal: Missing file specification for '{arg0}' option. /// public static readonly Diagnostic MissingFileSpecification = new Diagnostic(5012, nameof(MissingFileSpecification), "Missing file specification for \'{0}\' option.", DiagnosticLevel.Fatal); @@ -1012,7 +1014,7 @@ partial record class Diagnostic /// The 'PathTooLong' diagnostic. /// /// -/// Path too long: {arg0}. +/// Fatal: Path too long: {arg0}. /// public static readonly Diagnostic PathTooLong = new Diagnostic(5013, nameof(PathTooLong), "Path too long: {0}.", DiagnosticLevel.Fatal); @@ -1020,7 +1022,7 @@ partial record class Diagnostic /// The 'PathNotFound' diagnostic. /// /// -/// Path not found: {arg0}. +/// Fatal: Path not found: {arg0}. /// public static readonly Diagnostic PathNotFound = new Diagnostic(5014, nameof(PathNotFound), "Path not found: {0}.", DiagnosticLevel.Fatal); @@ -1028,7 +1030,7 @@ partial record class Diagnostic /// The 'InvalidPath' diagnostic. /// /// -/// Invalid path: {arg0}. +/// Fatal: Invalid path: {arg0}. /// public static readonly Diagnostic InvalidPath = new Diagnostic(5015, nameof(InvalidPath), "Invalid path: {0}.", DiagnosticLevel.Fatal); @@ -1036,7 +1038,7 @@ partial record class Diagnostic /// The 'InvalidOptionSyntax' diagnostic. /// /// -/// Invalid option: {arg0}. +/// Fatal: Invalid option: {arg0}. /// public static readonly Diagnostic InvalidOptionSyntax = new Diagnostic(5016, nameof(InvalidOptionSyntax), "Invalid option: {0}.", DiagnosticLevel.Fatal); @@ -1044,7 +1046,7 @@ partial record class Diagnostic /// The 'ExternalResourceNotFound' diagnostic. /// /// -/// External resource file does not exist: {arg0}. +/// Fatal: External resource file does not exist: {arg0}. /// public static readonly Diagnostic ExternalResourceNotFound = new Diagnostic(5017, nameof(ExternalResourceNotFound), "External resource file does not exist: {0}.", DiagnosticLevel.Fatal); @@ -1052,7 +1054,7 @@ partial record class Diagnostic /// The 'ExternalResourceNameInvalid' diagnostic. /// /// -/// External resource file may not include path specification: {arg0}. +/// Fatal: External resource file may not include path specification: {arg0}. /// public static readonly Diagnostic ExternalResourceNameInvalid = new Diagnostic(5018, nameof(ExternalResourceNameInvalid), "External resource file may not include path specification: {0}.", DiagnosticLevel.Fatal); @@ -1060,7 +1062,7 @@ partial record class Diagnostic /// The 'InvalidVersionFormat' diagnostic. /// /// -/// Invalid version specified: {arg0}. +/// Fatal: Invalid version specified: {arg0}. /// public static readonly Diagnostic InvalidVersionFormat = new Diagnostic(5019, nameof(InvalidVersionFormat), "Invalid version specified: {0}.", DiagnosticLevel.Fatal); @@ -1068,7 +1070,7 @@ partial record class Diagnostic /// The 'InvalidFileAlignment' diagnostic. /// /// -/// Invalid value '{arg0}' for -filealign option. +/// Fatal: Invalid value '{arg0}' for -filealign option. /// public static readonly Diagnostic InvalidFileAlignment = new Diagnostic(5020, nameof(InvalidFileAlignment), "Invalid value \'{0}\' for -filealign option.", DiagnosticLevel.Fatal); @@ -1076,7 +1078,7 @@ partial record class Diagnostic /// The 'ErrorWritingFile' diagnostic. /// /// -/// Unable to write file: {arg0}. ({arg1}) +/// Fatal: Unable to write file: {arg0}. ({arg1}) /// public static readonly Diagnostic ErrorWritingFile = new Diagnostic(5021, nameof(ErrorWritingFile), "Unable to write file: {0}. ({1})", DiagnosticLevel.Fatal); @@ -1084,7 +1086,7 @@ partial record class Diagnostic /// The 'UnrecognizedOption' diagnostic. /// /// -/// Unrecognized option: {arg0}. +/// Fatal: Unrecognized option: {arg0}. /// public static readonly Diagnostic UnrecognizedOption = new Diagnostic(5022, nameof(UnrecognizedOption), "Unrecognized option: {0}.", DiagnosticLevel.Fatal); @@ -1092,7 +1094,7 @@ partial record class Diagnostic /// The 'NoOutputFileSpecified' diagnostic. /// /// -/// No output file specified. +/// Fatal: No output file specified. /// public static readonly Diagnostic NoOutputFileSpecified = new Diagnostic(5023, nameof(NoOutputFileSpecified), "No output file specified.", DiagnosticLevel.Fatal); @@ -1100,7 +1102,7 @@ partial record class Diagnostic /// The 'SharedClassLoaderCannotBeUsedOnModuleTarget' diagnostic. /// /// -/// Incompatible options: -target:module and -sharedclassloader cannot be combined. +/// Fatal: Incompatible options: -target:module and -sharedclassloader cannot be combined. /// public static readonly Diagnostic SharedClassLoaderCannotBeUsedOnModuleTarget = new Diagnostic(5024, nameof(SharedClassLoaderCannotBeUsedOnModuleTarget), "Incompatible options: -target:module and -sharedclassloader cannot be combined.", DiagnosticLevel.Fatal); @@ -1108,7 +1110,7 @@ partial record class Diagnostic /// The 'RuntimeNotFound' diagnostic. /// /// -/// Unable to load runtime assembly. +/// Fatal: Unable to load runtime assembly. /// public static readonly Diagnostic RuntimeNotFound = new Diagnostic(5025, nameof(RuntimeNotFound), "Unable to load runtime assembly.", DiagnosticLevel.Fatal); @@ -1116,7 +1118,7 @@ partial record class Diagnostic /// The 'MainClassRequiresExe' diagnostic. /// /// -/// Main class cannot be specified for library or module. +/// Fatal: Main class cannot be specified for library or module. /// public static readonly Diagnostic MainClassRequiresExe = new Diagnostic(5026, nameof(MainClassRequiresExe), "Main class cannot be specified for library or module.", DiagnosticLevel.Fatal); @@ -1124,7 +1126,7 @@ partial record class Diagnostic /// The 'ExeRequiresMainClass' diagnostic. /// /// -/// No main method found. +/// Fatal: No main method found. /// public static readonly Diagnostic ExeRequiresMainClass = new Diagnostic(5027, nameof(ExeRequiresMainClass), "No main method found.", DiagnosticLevel.Fatal); @@ -1132,7 +1134,7 @@ partial record class Diagnostic /// The 'PropertiesRequireExe' diagnostic. /// /// -/// Properties cannot be specified for library or module. +/// Fatal: Properties cannot be specified for library or module. /// public static readonly Diagnostic PropertiesRequireExe = new Diagnostic(5028, nameof(PropertiesRequireExe), "Properties cannot be specified for library or module.", DiagnosticLevel.Fatal); @@ -1140,7 +1142,7 @@ partial record class Diagnostic /// The 'ModuleCannotHaveClassLoader' diagnostic. /// /// -/// Cannot specify assembly class loader for modules. +/// Fatal: Cannot specify assembly class loader for modules. /// public static readonly Diagnostic ModuleCannotHaveClassLoader = new Diagnostic(5029, nameof(ModuleCannotHaveClassLoader), "Cannot specify assembly class loader for modules.", DiagnosticLevel.Fatal); @@ -1148,7 +1150,7 @@ partial record class Diagnostic /// The 'ErrorParsingMapFile' diagnostic. /// /// -/// Unable to parse remap file: {arg0}. ({arg1}) +/// Fatal: Unable to parse remap file: {arg0}. ({arg1}) /// public static readonly Diagnostic ErrorParsingMapFile = new Diagnostic(5030, nameof(ErrorParsingMapFile), "Unable to parse remap file: {0}. ({1})", DiagnosticLevel.Fatal); @@ -1156,7 +1158,7 @@ partial record class Diagnostic /// The 'BootstrapClassesMissing' diagnostic. /// /// -/// Bootstrap classes missing and core assembly not found. +/// Fatal: Bootstrap classes missing and core assembly not found. /// public static readonly Diagnostic BootstrapClassesMissing = new Diagnostic(5031, nameof(BootstrapClassesMissing), "Bootstrap classes missing and core assembly not found.", DiagnosticLevel.Fatal); @@ -1164,7 +1166,7 @@ partial record class Diagnostic /// The 'StrongNameRequiresStrongNamedRefs' diagnostic. /// /// -/// All referenced assemblies must be strong named, to be able to sign the output assembly. +/// Fatal: All referenced assemblies must be strong named, to be able to sign the output assembly. /// public static readonly Diagnostic StrongNameRequiresStrongNamedRefs = new Diagnostic(5032, nameof(StrongNameRequiresStrongNamedRefs), "All referenced assemblies must be strong named, to be able to sign the output ass" + "embly.", DiagnosticLevel.Fatal); @@ -1173,7 +1175,7 @@ partial record class Diagnostic /// The 'MainClassNotFound' diagnostic. /// /// -/// Main class not found. +/// Fatal: Main class not found. /// public static readonly Diagnostic MainClassNotFound = new Diagnostic(5033, nameof(MainClassNotFound), "Main class not found.", DiagnosticLevel.Fatal); @@ -1181,7 +1183,7 @@ partial record class Diagnostic /// The 'MainMethodNotFound' diagnostic. /// /// -/// Main method not found. +/// Fatal: Main method not found. /// public static readonly Diagnostic MainMethodNotFound = new Diagnostic(5034, nameof(MainMethodNotFound), "Main method not found.", DiagnosticLevel.Fatal); @@ -1189,7 +1191,7 @@ partial record class Diagnostic /// The 'UnsupportedMainMethod' diagnostic. /// /// -/// Redirected main method not supported. +/// Fatal: Redirected main method not supported. /// public static readonly Diagnostic UnsupportedMainMethod = new Diagnostic(5035, nameof(UnsupportedMainMethod), "Redirected main method not supported.", DiagnosticLevel.Fatal); @@ -1197,7 +1199,7 @@ partial record class Diagnostic /// The 'ExternalMainNotAccessible' diagnostic. /// /// -/// External main method must be public and in a public class. +/// Fatal: External main method must be public and in a public class. /// public static readonly Diagnostic ExternalMainNotAccessible = new Diagnostic(5036, nameof(ExternalMainNotAccessible), "External main method must be public and in a public class.", DiagnosticLevel.Fatal); @@ -1205,7 +1207,7 @@ partial record class Diagnostic /// The 'ClassLoaderNotFound' diagnostic. /// /// -/// Custom assembly class loader class not found. +/// Fatal: Custom assembly class loader class not found. /// public static readonly Diagnostic ClassLoaderNotFound = new Diagnostic(5037, nameof(ClassLoaderNotFound), "Custom assembly class loader class not found.", DiagnosticLevel.Fatal); @@ -1213,7 +1215,7 @@ partial record class Diagnostic /// The 'ClassLoaderNotAccessible' diagnostic. /// /// -/// Custom assembly class loader class is not accessible. +/// Fatal: Custom assembly class loader class is not accessible. /// public static readonly Diagnostic ClassLoaderNotAccessible = new Diagnostic(5038, nameof(ClassLoaderNotAccessible), "Custom assembly class loader class is not accessible.", DiagnosticLevel.Fatal); @@ -1221,7 +1223,7 @@ partial record class Diagnostic /// The 'ClassLoaderIsAbstract' diagnostic. /// /// -/// Custom assembly class loader class is abstract. +/// Fatal: Custom assembly class loader class is abstract. /// public static readonly Diagnostic ClassLoaderIsAbstract = new Diagnostic(5039, nameof(ClassLoaderIsAbstract), "Custom assembly class loader class is abstract.", DiagnosticLevel.Fatal); @@ -1229,7 +1231,7 @@ partial record class Diagnostic /// The 'ClassLoaderNotClassLoader' diagnostic. /// /// -/// Custom assembly class loader class does not extend java.lang.ClassLoader. +/// Fatal: Custom assembly class loader class does not extend java.lang.ClassLoader. /// public static readonly Diagnostic ClassLoaderNotClassLoader = new Diagnostic(5040, nameof(ClassLoaderNotClassLoader), "Custom assembly class loader class does not extend java.lang.ClassLoader.", DiagnosticLevel.Fatal); @@ -1237,7 +1239,7 @@ partial record class Diagnostic /// The 'ClassLoaderConstructorMissing' diagnostic. /// /// -/// Custom assembly class loader constructor is missing. +/// Fatal: Custom assembly class loader constructor is missing. /// public static readonly Diagnostic ClassLoaderConstructorMissing = new Diagnostic(5041, nameof(ClassLoaderConstructorMissing), "Custom assembly class loader constructor is missing.", DiagnosticLevel.Fatal); @@ -1245,7 +1247,7 @@ partial record class Diagnostic /// The 'MapFileTypeNotFound' diagnostic. /// /// -/// Type '{arg0}' referenced in remap file was not found. +/// Fatal: Type '{arg0}' referenced in remap file was not found. /// public static readonly Diagnostic MapFileTypeNotFound = new Diagnostic(5042, nameof(MapFileTypeNotFound), "Type \'{0}\' referenced in remap file was not found.", DiagnosticLevel.Fatal); @@ -1253,7 +1255,7 @@ partial record class Diagnostic /// The 'MapFileClassNotFound' diagnostic. /// /// -/// Class '{arg0}' referenced in remap file was not found. +/// Fatal: Class '{arg0}' referenced in remap file was not found. /// public static readonly Diagnostic MapFileClassNotFound = new Diagnostic(5043, nameof(MapFileClassNotFound), "Class \'{0}\' referenced in remap file was not found.", DiagnosticLevel.Fatal); @@ -1261,7 +1263,7 @@ partial record class Diagnostic /// The 'MaximumErrorCountReached' diagnostic. /// /// -/// Maximum error count reached. +/// Fatal: Maximum error count reached. /// public static readonly Diagnostic MaximumErrorCountReached = new Diagnostic(5044, nameof(MaximumErrorCountReached), "Maximum error count reached.", DiagnosticLevel.Fatal); @@ -1269,7 +1271,7 @@ partial record class Diagnostic /// The 'LinkageError' diagnostic. /// /// -/// Link error: {arg0} +/// Fatal: Link error: {arg0} /// public static readonly Diagnostic LinkageError = new Diagnostic(5045, nameof(LinkageError), "Link error: {0}", DiagnosticLevel.Fatal); @@ -1277,7 +1279,7 @@ partial record class Diagnostic /// The 'RuntimeMismatch' diagnostic. /// /// -/// Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} +/// Fatal: Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} /// public static readonly Diagnostic RuntimeMismatch = new Diagnostic(5046, nameof(RuntimeMismatch), "Referenced assembly {0} was compiled with an incompatible IKVM.Runtime version. C" + "urrent runtime: {1}. Referenced assembly runtime: {2}", DiagnosticLevel.Fatal); @@ -1286,7 +1288,7 @@ partial record class Diagnostic /// The 'RuntimeMismatchStrongName' diagnostic. /// /// -/// +/// Fatal: /// public static readonly Diagnostic RuntimeMismatchStrongName = new Diagnostic(5047, nameof(RuntimeMismatchStrongName), "", DiagnosticLevel.Fatal); @@ -1294,7 +1296,7 @@ partial record class Diagnostic /// The 'CoreClassesMissing' diagnostic. /// /// -/// Failed to find core classes in core library. +/// Fatal: Failed to find core classes in core library. /// public static readonly Diagnostic CoreClassesMissing = new Diagnostic(5048, nameof(CoreClassesMissing), "Failed to find core classes in core library.", DiagnosticLevel.Fatal); @@ -1302,7 +1304,7 @@ partial record class Diagnostic /// The 'CriticalClassNotFound' diagnostic. /// /// -/// Unable to load critical class '{arg0}'. +/// Fatal: Unable to load critical class '{arg0}'. /// public static readonly Diagnostic CriticalClassNotFound = new Diagnostic(5049, nameof(CriticalClassNotFound), "Unable to load critical class \'{0}\'.", DiagnosticLevel.Fatal); @@ -1310,7 +1312,7 @@ partial record class Diagnostic /// The 'AssemblyContainsDuplicateClassNames' diagnostic. /// /// -/// Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) +/// Fatal: Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) /// public static readonly Diagnostic AssemblyContainsDuplicateClassNames = new Diagnostic(5050, nameof(AssemblyContainsDuplicateClassNames), "Type \'{0}\' and \'{1}\' both map to the same name \'{2}\'. ({3})", DiagnosticLevel.Fatal); @@ -1318,7 +1320,7 @@ partial record class Diagnostic /// The 'CallerIDRequiresHasCallerIDAnnotation' diagnostic. /// /// -/// CallerID.getCallerID() requires a HasCallerID annotation. +/// Fatal: CallerID.getCallerID() requires a HasCallerID annotation. /// public static readonly Diagnostic CallerIDRequiresHasCallerIDAnnotation = new Diagnostic(5051, nameof(CallerIDRequiresHasCallerIDAnnotation), "CallerID.getCallerID() requires a HasCallerID annotation.", DiagnosticLevel.Fatal); @@ -1326,7 +1328,7 @@ partial record class Diagnostic /// The 'UnableToResolveInterface' diagnostic. /// /// -/// Unable to resolve interface '{arg0}' on type '{arg1}'. +/// Fatal: Unable to resolve interface '{arg0}' on type '{arg1}'. /// public static readonly Diagnostic UnableToResolveInterface = new Diagnostic(5052, nameof(UnableToResolveInterface), "Unable to resolve interface \'{0}\' on type \'{1}\'.", DiagnosticLevel.Fatal); @@ -1334,7 +1336,7 @@ partial record class Diagnostic /// The 'MissingBaseType' diagnostic. /// /// -/// The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. +/// Fatal: The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. /// public static readonly Diagnostic MissingBaseType = new Diagnostic(5053, nameof(MissingBaseType), "The base class or interface \'{0}\' in assembly \'{1}\' referenced by type \'{2}\' in \'" + "{3}\' could not be resolved.", DiagnosticLevel.Fatal); @@ -1343,7 +1345,7 @@ partial record class Diagnostic /// The 'MissingBaseTypeReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. +/// Fatal: The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. /// public static readonly Diagnostic MissingBaseTypeReference = new Diagnostic(5054, nameof(MissingBaseTypeReference), "The type \'{0}\' is defined in an assembly that is not referenced. You must add a r" + "eference to assembly \'{1}\'.", DiagnosticLevel.Fatal); @@ -1352,7 +1354,7 @@ partial record class Diagnostic /// The 'FileNotFound' diagnostic. /// /// -/// File not found: {arg0}. +/// Fatal: File not found: {arg0}. /// public static readonly Diagnostic FileNotFound = new Diagnostic(5055, nameof(FileNotFound), "File not found: {0}.", DiagnosticLevel.Fatal); @@ -1360,7 +1362,7 @@ partial record class Diagnostic /// The 'RuntimeMethodMissing' diagnostic. /// /// -/// Runtime method '{arg0}' not found. +/// Fatal: Runtime method '{arg0}' not found. /// public static readonly Diagnostic RuntimeMethodMissing = new Diagnostic(5056, nameof(RuntimeMethodMissing), "Runtime method \'{0}\' not found.", DiagnosticLevel.Fatal); @@ -1368,7 +1370,7 @@ partial record class Diagnostic /// The 'MapFileFieldNotFound' diagnostic. /// /// -/// Field '{arg0}' referenced in remap file was not found in class '{arg1}'. +/// Fatal: Field '{arg0}' referenced in remap file was not found in class '{arg1}'. /// public static readonly Diagnostic MapFileFieldNotFound = new Diagnostic(5057, nameof(MapFileFieldNotFound), "Field \'{0}\' referenced in remap file was not found in class \'{1}\'.", DiagnosticLevel.Fatal); @@ -1376,7 +1378,7 @@ partial record class Diagnostic /// The 'GhostInterfaceMethodMissing' diagnostic. /// /// -/// Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) +/// Fatal: Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) /// public static readonly Diagnostic GhostInterfaceMethodMissing = new Diagnostic(5058, nameof(GhostInterfaceMethodMissing), "Remapped class \'{0}\' does not implement ghost interface method. ({1}.{2}{3})", DiagnosticLevel.Fatal); @@ -1384,7 +1386,7 @@ partial record class Diagnostic /// The 'ModuleInitializerMethodRequirements' diagnostic. /// /// -/// Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. +/// Fatal: Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. /// public static readonly Diagnostic ModuleInitializerMethodRequirements = new Diagnostic(5059, nameof(ModuleInitializerMethodRequirements), "Method \'{0}.{1}{2}\' does not meet the requirements of a module initializer.", DiagnosticLevel.Fatal); @@ -1392,15 +1394,24 @@ partial record class Diagnostic /// The 'InvalidZip' diagnostic. /// /// -/// Invalid zip: {name}. +/// Fatal: Invalid zip: {name}. /// public static readonly Diagnostic InvalidZip = new Diagnostic(5060, nameof(InvalidZip), "Invalid zip: {0}.", DiagnosticLevel.Fatal); + /// + /// The 'CoreAssemblyVersionMismatch' diagnostic. + /// + /// +/// Fatal: Unable to load assembly '{0}' as it depends on a higher version of {1} than the one currently loaded. + /// + public static readonly Diagnostic CoreAssemblyVersionMismatch = new Diagnostic(5061, nameof(CoreAssemblyVersionMismatch), "Unable to load assembly \'{-1}\' as it depends on a higher version of {-1} than the" + + " one currently loaded.", DiagnosticLevel.Fatal); + /// /// The 'GenericRuntimeTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public static readonly Diagnostic GenericRuntimeTrace = new Diagnostic(6000, nameof(GenericRuntimeTrace), "{0}", DiagnosticLevel.Trace); @@ -1408,7 +1419,7 @@ partial record class Diagnostic /// The 'GenericJniTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public static readonly Diagnostic GenericJniTrace = new Diagnostic(6001, nameof(GenericJniTrace), "{0}", DiagnosticLevel.Trace); @@ -1416,7 +1427,7 @@ partial record class Diagnostic /// The 'GenericCompilerTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public static readonly Diagnostic GenericCompilerTrace = new Diagnostic(6002, nameof(GenericCompilerTrace), "{0}", DiagnosticLevel.Trace); diff --git a/src/IKVM.CoreLib/Diagnostics/Diagnostic.g.tt b/src/IKVM.CoreLib/Diagnostics/Diagnostic.g.tt index 975d42ffb9..6d64b08652 100644 --- a/src/IKVM.CoreLib/Diagnostics/Diagnostic.g.tt +++ b/src/IKVM.CoreLib/Diagnostics/Diagnostic.g.tt @@ -63,7 +63,7 @@ foreach (var kvp in DiagnosticFile.Read(Host.ResolvePath(Path.Combine("Diagnosti /// <#= desc #> /// /// -<#= Util.ToCommentString(kvp.Value.Message ?? "") #> +<#= Util.ToCommentString(kvp.Value) #> /// public static readonly Diagnostic <#= kvp.Key #> = new Diagnostic(<#= kvp.Value.Id #>, nameof(<#= kvp.Key #>), <#= Util.ToStringLiteral(string.Join("", message)) #>, DiagnosticLevel.<#= kvp.Value.Level #>); diff --git a/src/IKVM.CoreLib/Diagnostics/Diagnostic.json b/src/IKVM.CoreLib/Diagnostics/Diagnostic.json index 3979a699a0..833477aefe 100644 --- a/src/IKVM.CoreLib/Diagnostics/Diagnostic.json +++ b/src/IKVM.CoreLib/Diagnostics/Diagnostic.json @@ -1631,6 +1631,21 @@ } ] }, + "CoreAssemblyVersionMismatch": { + "id": 5061, + "level": "Fatal", + "message": "Unable to load assembly '{0}' as it depends on a higher version of {1} than the one currently loaded.", + "args": [ + { + "name": "arg0", + "type": "string" + }, + { + "name": "arg1", + "type": "string" + } + ] + }, "GenericRuntimeTrace": { "id": 6000, "level": "Trace", diff --git a/src/IKVM.CoreLib/Diagnostics/Diagnostic.t4 b/src/IKVM.CoreLib/Diagnostics/Diagnostic.t4 index e7fe518497..eaf85ec045 100644 --- a/src/IKVM.CoreLib/Diagnostics/Diagnostic.t4 +++ b/src/IKVM.CoreLib/Diagnostics/Diagnostic.t4 @@ -56,13 +56,13 @@ public static class Util } } - public static string ToCommentString(string input) + public static string ToCommentString(Diagnostic diagnostic) { using (var writer = new StringWriter()) { using (var provider = CodeDomProvider.CreateProvider("CSharp")) { - provider.GenerateCodeFromStatement(new CodeCommentStatement(input, true), writer, null); + provider.GenerateCodeFromStatement(new CodeCommentStatement(diagnostic.Level + ": " + diagnostic.Message, true), writer, null); return writer.ToString().Trim(); } } diff --git a/src/IKVM.CoreLib/Diagnostics/DiagnosticEvent.g.cs b/src/IKVM.CoreLib/Diagnostics/DiagnosticEvent.g.cs index 1b84ae7019..6d96eb2c80 100644 --- a/src/IKVM.CoreLib/Diagnostics/DiagnosticEvent.g.cs +++ b/src/IKVM.CoreLib/Diagnostics/DiagnosticEvent.g.cs @@ -12,7 +12,7 @@ readonly partial struct DiagnosticEvent /// The 'MainMethodFound' diagnostic. /// /// -/// Found main method in class "{arg0}". +/// Info: Found main method in class "{arg0}". /// public static DiagnosticEvent MainMethodFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MainMethodFound.Event([arg0], exception, location); @@ -20,7 +20,7 @@ readonly partial struct DiagnosticEvent /// The 'OutputFileIs' diagnostic. /// /// -/// Output file is "{arg0}". +/// Info: Output file is "{arg0}". /// public static DiagnosticEvent OutputFileIs(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.OutputFileIs.Event([arg0], exception, location); @@ -28,7 +28,7 @@ readonly partial struct DiagnosticEvent /// The 'AutoAddRef' diagnostic. /// /// -/// Automatically adding reference to "{arg0}". +/// Info: Automatically adding reference to "{arg0}". /// public static DiagnosticEvent AutoAddRef(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.AutoAddRef.Event([arg0], exception, location); @@ -36,7 +36,7 @@ readonly partial struct DiagnosticEvent /// The 'MainMethodFromManifest' diagnostic. /// /// -/// Using main class "{arg0}" based on jar manifest. +/// Info: Using main class "{arg0}" based on jar manifest. /// public static DiagnosticEvent MainMethodFromManifest(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MainMethodFromManifest.Event([arg0], exception, location); @@ -44,7 +44,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericCompilerInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static DiagnosticEvent GenericCompilerInfo(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericCompilerInfo.Event([arg0], exception, location); @@ -52,7 +52,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericClassLoadingInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static DiagnosticEvent GenericClassLoadingInfo(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericClassLoadingInfo.Event([arg0], exception, location); @@ -60,7 +60,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericVerifierInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static DiagnosticEvent GenericVerifierInfo(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericVerifierInfo.Event([arg0], exception, location); @@ -68,7 +68,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericRuntimeInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static DiagnosticEvent GenericRuntimeInfo(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericRuntimeInfo.Event([arg0], exception, location); @@ -76,7 +76,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericJniInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public static DiagnosticEvent GenericJniInfo(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericJniInfo.Event([arg0], exception, location); @@ -84,7 +84,7 @@ readonly partial struct DiagnosticEvent /// The 'ClassNotFound' diagnostic. /// /// -/// Class "{arg0}" not found. +/// Warning: Class "{arg0}" not found. /// public static DiagnosticEvent ClassNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ClassNotFound.Event([arg0], exception, location); @@ -92,7 +92,7 @@ readonly partial struct DiagnosticEvent /// The 'ClassFormatError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (class format error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (class format error "{arg1}") /// public static DiagnosticEvent ClassFormatError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ClassFormatError.Event([arg0, arg1], exception, location); @@ -100,7 +100,7 @@ readonly partial struct DiagnosticEvent /// The 'DuplicateClassName' diagnostic. /// /// -/// Duplicate class name: "{arg0}". +/// Warning: Duplicate class name: "{arg0}". /// public static DiagnosticEvent DuplicateClassName(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.DuplicateClassName.Event([arg0], exception, location); @@ -108,7 +108,7 @@ readonly partial struct DiagnosticEvent /// The 'IllegalAccessError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (illegal access error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (illegal access error "{arg1}") /// public static DiagnosticEvent IllegalAccessError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.IllegalAccessError.Event([arg0, arg1], exception, location); @@ -116,7 +116,7 @@ readonly partial struct DiagnosticEvent /// The 'VerificationError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (verification error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (verification error "{arg1}") /// public static DiagnosticEvent VerificationError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.VerificationError.Event([arg0, arg1], exception, location); @@ -124,7 +124,7 @@ readonly partial struct DiagnosticEvent /// The 'NoClassDefFoundError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (missing class "{arg1}") +/// Warning: Unable to compile class "{arg0}". (missing class "{arg1}") /// public static DiagnosticEvent NoClassDefFoundError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.NoClassDefFoundError.Event([arg0, arg1], exception, location); @@ -132,7 +132,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericUnableToCompileError' diagnostic. /// /// -/// Unable to compile class "{arg0}". ("{arg1}": "{arg2}") +/// Warning: Unable to compile class "{arg0}". ("{arg1}": "{arg2}") /// public static DiagnosticEvent GenericUnableToCompileError(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericUnableToCompileError.Event([arg0, arg1, arg2], exception, location); @@ -140,7 +140,7 @@ readonly partial struct DiagnosticEvent /// The 'DuplicateResourceName' diagnostic. /// /// -/// Skipping resource (name clash): "{arg0}" +/// Warning: Skipping resource (name clash): "{arg0}" /// public static DiagnosticEvent DuplicateResourceName(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.DuplicateResourceName.Event([arg0], exception, location); @@ -148,7 +148,7 @@ readonly partial struct DiagnosticEvent /// The 'SkippingReferencedClass' diagnostic. /// /// -/// Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") +/// Warning: Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") /// public static DiagnosticEvent SkippingReferencedClass(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.SkippingReferencedClass.Event([arg0, arg1], exception, location); @@ -156,7 +156,7 @@ readonly partial struct DiagnosticEvent /// The 'NoJniRuntime' diagnostic. /// /// -/// Unable to load runtime JNI assembly. +/// Warning: Unable to load runtime JNI assembly. /// public static DiagnosticEvent NoJniRuntime(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.NoJniRuntime.Event([], exception, location); @@ -164,7 +164,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedNoClassDefFoundError' diagnostic. /// /// -/// Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). +/// Warning: Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). /// public static DiagnosticEvent EmittedNoClassDefFoundError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedNoClassDefFoundError.Event([arg0, arg1], exception, location); @@ -172,7 +172,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedIllegalAccessError' diagnostic. /// /// -/// Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedIllegalAccessError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedIllegalAccessError.Event([arg0, arg1], exception, location); @@ -180,7 +180,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedInstantiationError' diagnostic. /// /// -/// Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedInstantiationError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedInstantiationError.Event([arg0, arg1], exception, location); @@ -188,7 +188,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedIncompatibleClassChangeError' diagnostic. /// /// -/// Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedIncompatibleClassChangeError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedIncompatibleClassChangeError.Event([arg0, arg1], exception, location); @@ -196,7 +196,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedNoSuchFieldError' diagnostic. /// /// -/// Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedNoSuchFieldError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedNoSuchFieldError.Event([arg0, arg1], exception, location); @@ -204,7 +204,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedAbstractMethodError' diagnostic. /// /// -/// Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedAbstractMethodError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedAbstractMethodError.Event([arg0, arg1], exception, location); @@ -212,7 +212,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedNoSuchMethodError' diagnostic. /// /// -/// Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedNoSuchMethodError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedNoSuchMethodError.Event([arg0, arg1], exception, location); @@ -220,7 +220,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedLinkageError' diagnostic. /// /// -/// Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedLinkageError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedLinkageError.Event([arg0, arg1], exception, location); @@ -228,7 +228,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedVerificationError' diagnostic. /// /// -/// Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedVerificationError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedVerificationError.Event([arg0, arg1], exception, location); @@ -236,7 +236,7 @@ readonly partial struct DiagnosticEvent /// The 'EmittedClassFormatError' diagnostic. /// /// -/// Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") /// public static DiagnosticEvent EmittedClassFormatError(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.EmittedClassFormatError.Event([arg0, arg1], exception, location); @@ -244,7 +244,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidCustomAttribute' diagnostic. /// /// -/// Error emitting "{arg0}" custom attribute. ("{arg1}") +/// Warning: Error emitting "{arg0}" custom attribute. ("{arg1}") /// public static DiagnosticEvent InvalidCustomAttribute(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidCustomAttribute.Event([arg0, arg1], exception, location); @@ -252,7 +252,7 @@ readonly partial struct DiagnosticEvent /// The 'IgnoredCustomAttribute' diagnostic. /// /// -/// Custom attribute "{arg0}" was ignored. ("{arg1}") +/// Warning: Custom attribute "{arg0}" was ignored. ("{arg1}") /// public static DiagnosticEvent IgnoredCustomAttribute(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.IgnoredCustomAttribute.Event([arg0, arg1], exception, location); @@ -260,7 +260,7 @@ readonly partial struct DiagnosticEvent /// The 'AssumeAssemblyVersionMatch' diagnostic. /// /// -/// Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy +/// Warning: Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy /// public static DiagnosticEvent AssumeAssemblyVersionMatch(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.AssumeAssemblyVersionMatch.Event([arg0, arg1], exception, location); @@ -268,7 +268,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidDirectoryInLibOptionPath' diagnostic. /// /// -/// Directory "{arg0}" specified in -lib option is not valid. +/// Warning: Directory "{arg0}" specified in -lib option is not valid. /// public static DiagnosticEvent InvalidDirectoryInLibOptionPath(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidDirectoryInLibOptionPath.Event([arg0], exception, location); @@ -276,7 +276,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidDirectoryInLibEnvironmentPath' diagnostic. /// /// -/// Directory "{arg0}" specified in LIB environment is not valid. +/// Warning: Directory "{arg0}" specified in LIB environment is not valid. /// public static DiagnosticEvent InvalidDirectoryInLibEnvironmentPath(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidDirectoryInLibEnvironmentPath.Event([arg0], exception, location); @@ -284,7 +284,7 @@ readonly partial struct DiagnosticEvent /// The 'LegacySearchRule' diagnostic. /// /// -/// Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. +/// Warning: Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. /// public static DiagnosticEvent LegacySearchRule(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.LegacySearchRule.Event([arg0], exception, location); @@ -292,7 +292,7 @@ readonly partial struct DiagnosticEvent /// The 'AssemblyLocationIgnored' diagnostic. /// /// -/// Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". +/// Warning: Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". /// public static DiagnosticEvent AssemblyLocationIgnored(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.AssemblyLocationIgnored.Event([arg0, arg1, arg2], exception, location); @@ -300,7 +300,7 @@ readonly partial struct DiagnosticEvent /// The 'InterfaceMethodCantBeInternal' diagnostic. /// /// -/// Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") +/// Warning: Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") /// public static DiagnosticEvent InterfaceMethodCantBeInternal(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InterfaceMethodCantBeInternal.Event([arg0, arg1, arg2], exception, location); @@ -308,7 +308,7 @@ readonly partial struct DiagnosticEvent /// The 'DuplicateAssemblyReference' diagnostic. /// /// -/// Duplicate assembly reference "{arg0}" +/// Warning: Duplicate assembly reference "{arg0}" /// public static DiagnosticEvent DuplicateAssemblyReference(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.DuplicateAssemblyReference.Event([arg0], exception, location); @@ -316,7 +316,7 @@ readonly partial struct DiagnosticEvent /// The 'UnableToResolveType' diagnostic. /// /// -/// Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. +/// Warning: Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. /// public static DiagnosticEvent UnableToResolveType(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnableToResolveType.Event([arg0, arg1, arg2], exception, location); @@ -324,7 +324,7 @@ readonly partial struct DiagnosticEvent /// The 'StubsAreDeprecated' diagnostic. /// /// -/// Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. +/// Warning: Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. /// public static DiagnosticEvent StubsAreDeprecated(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.StubsAreDeprecated.Event([arg0], exception, location); @@ -332,7 +332,7 @@ readonly partial struct DiagnosticEvent /// The 'WrongClassName' diagnostic. /// /// -/// Unable to compile "{arg0}" (wrong name: "{arg1}") +/// Warning: Unable to compile "{arg0}" (wrong name: "{arg1}") /// public static DiagnosticEvent WrongClassName(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.WrongClassName.Event([arg0, arg1], exception, location); @@ -340,7 +340,7 @@ readonly partial struct DiagnosticEvent /// The 'ReflectionCallerClassRequiresCallerID' diagnostic. /// /// -/// Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") +/// Warning: Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") /// public static DiagnosticEvent ReflectionCallerClassRequiresCallerID(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ReflectionCallerClassRequiresCallerID.Event([arg0, arg1, arg2], exception, location); @@ -348,7 +348,7 @@ readonly partial struct DiagnosticEvent /// The 'LegacyAssemblyAttributesFound' diagnostic. /// /// -/// Legacy assembly attributes container found. Please use the -assemblyattributes: option. +/// Warning: Legacy assembly attributes container found. Please use the -assemblyattributes: option. /// public static DiagnosticEvent LegacyAssemblyAttributesFound(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.LegacyAssemblyAttributesFound.Event([], exception, location); @@ -356,7 +356,7 @@ readonly partial struct DiagnosticEvent /// The 'UnableToCreateLambdaFactory' diagnostic. /// /// -/// Unable to create static lambda factory. +/// Warning: Unable to create static lambda factory. /// public static DiagnosticEvent UnableToCreateLambdaFactory(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnableToCreateLambdaFactory.Event([], exception, location); @@ -364,7 +364,7 @@ readonly partial struct DiagnosticEvent /// The 'UnknownWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static DiagnosticEvent UnknownWarning(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnknownWarning.Event([arg0], exception, location); @@ -372,7 +372,7 @@ readonly partial struct DiagnosticEvent /// The 'DuplicateIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// public static DiagnosticEvent DuplicateIkvmLangProperty(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.DuplicateIkvmLangProperty.Event([arg0, arg1], exception, location); @@ -380,7 +380,7 @@ readonly partial struct DiagnosticEvent /// The 'MalformedIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// public static DiagnosticEvent MalformedIkvmLangProperty(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MalformedIkvmLangProperty.Event([arg0, arg1], exception, location); @@ -388,7 +388,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericCompilerWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static DiagnosticEvent GenericCompilerWarning(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericCompilerWarning.Event([arg0], exception, location); @@ -396,7 +396,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericClassLoadingWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static DiagnosticEvent GenericClassLoadingWarning(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericClassLoadingWarning.Event([arg0], exception, location); @@ -404,7 +404,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericVerifierWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static DiagnosticEvent GenericVerifierWarning(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericVerifierWarning.Event([arg0], exception, location); @@ -412,7 +412,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericRuntimeWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static DiagnosticEvent GenericRuntimeWarning(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericRuntimeWarning.Event([arg0], exception, location); @@ -420,7 +420,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericJniWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public static DiagnosticEvent GenericJniWarning(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericJniWarning.Event([arg0], exception, location); @@ -428,7 +428,7 @@ readonly partial struct DiagnosticEvent /// The 'UnableToCreateProxy' diagnostic. /// /// -/// Unable to create proxy "{arg0}". ("{arg1}") +/// Error: Unable to create proxy "{arg0}". ("{arg1}") /// public static DiagnosticEvent UnableToCreateProxy(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnableToCreateProxy.Event([arg0, arg1], exception, location); @@ -436,7 +436,7 @@ readonly partial struct DiagnosticEvent /// The 'DuplicateProxy' diagnostic. /// /// -/// Duplicate proxy "{arg0}". +/// Error: Duplicate proxy "{arg0}". /// public static DiagnosticEvent DuplicateProxy(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.DuplicateProxy.Event([arg0], exception, location); @@ -444,7 +444,7 @@ readonly partial struct DiagnosticEvent /// The 'MapXmlUnableToResolveOpCode' diagnostic. /// /// -/// Unable to resolve opcode in remap file: {arg0}. +/// Error: Unable to resolve opcode in remap file: {arg0}. /// public static DiagnosticEvent MapXmlUnableToResolveOpCode(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MapXmlUnableToResolveOpCode.Event([arg0], exception, location); @@ -452,7 +452,7 @@ readonly partial struct DiagnosticEvent /// The 'MapXmlError' diagnostic. /// /// -/// Error in remap file: {arg0}. +/// Error: Error in remap file: {arg0}. /// public static DiagnosticEvent MapXmlError(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MapXmlError.Event([arg0], exception, location); @@ -460,7 +460,7 @@ readonly partial struct DiagnosticEvent /// The 'InputFileNotFound' diagnostic. /// /// -/// Source file '{arg0}' not found. +/// Error: Source file '{arg0}' not found. /// public static DiagnosticEvent InputFileNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InputFileNotFound.Event([arg0], exception, location); @@ -468,7 +468,7 @@ readonly partial struct DiagnosticEvent /// The 'UnknownFileType' diagnostic. /// /// -/// Unknown file type: {arg0}. +/// Error: Unknown file type: {arg0}. /// public static DiagnosticEvent UnknownFileType(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnknownFileType.Event([arg0], exception, location); @@ -476,7 +476,7 @@ readonly partial struct DiagnosticEvent /// The 'UnknownElementInMapFile' diagnostic. /// /// -/// Unknown element {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown element {arg0} in remap file, line {arg1}, column {arg2}. /// public static DiagnosticEvent UnknownElementInMapFile(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnknownElementInMapFile.Event([arg0, arg1, arg2], exception, location); @@ -484,7 +484,7 @@ readonly partial struct DiagnosticEvent /// The 'UnknownAttributeInMapFile' diagnostic. /// /// -/// Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. /// public static DiagnosticEvent UnknownAttributeInMapFile(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnknownAttributeInMapFile.Event([arg0, arg1, arg2], exception, location); @@ -492,7 +492,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidMemberNameInMapFile' diagnostic. /// /// -/// Invalid {arg0} name '{arg1}' in remap file in class {arg2}. +/// Error: Invalid {arg0} name '{arg1}' in remap file in class {arg2}. /// public static DiagnosticEvent InvalidMemberNameInMapFile(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidMemberNameInMapFile.Event([arg0, arg1, arg2], exception, location); @@ -500,7 +500,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidMemberSignatureInMapFile' diagnostic. /// /// -/// Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. +/// Error: Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. /// public static DiagnosticEvent InvalidMemberSignatureInMapFile(string arg0, string arg1, string arg2, string arg3, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidMemberSignatureInMapFile.Event([arg0, arg1, arg2, arg3], exception, location); @@ -508,7 +508,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidPropertyNameInMapFile' diagnostic. /// /// -/// Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. /// public static DiagnosticEvent InvalidPropertyNameInMapFile(string arg0, string arg1, string arg2, string arg3, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidPropertyNameInMapFile.Event([arg0, arg1, arg2, arg3], exception, location); @@ -516,7 +516,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidPropertySignatureInMapFile' diagnostic. /// /// -/// Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. /// public static DiagnosticEvent InvalidPropertySignatureInMapFile(string arg0, string arg1, string arg2, string arg3, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidPropertySignatureInMapFile.Event([arg0, arg1, arg2, arg3], exception, location); @@ -524,7 +524,7 @@ readonly partial struct DiagnosticEvent /// The 'NonPrimaryAssemblyReference' diagnostic. /// /// -/// Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. +/// Error: Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. /// public static DiagnosticEvent NonPrimaryAssemblyReference(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.NonPrimaryAssemblyReference.Event([arg0, arg1], exception, location); @@ -532,7 +532,7 @@ readonly partial struct DiagnosticEvent /// The 'MissingType' diagnostic. /// /// -/// Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. +/// Error: Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. /// public static DiagnosticEvent MissingType(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MissingType.Event([arg0, arg1], exception, location); @@ -540,7 +540,7 @@ readonly partial struct DiagnosticEvent /// The 'MissingReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. +/// Error: The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. /// public static DiagnosticEvent MissingReference(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MissingReference.Event([arg0, arg1], exception, location); @@ -548,7 +548,7 @@ readonly partial struct DiagnosticEvent /// The 'CallerSensitiveOnUnsupportedMethod' diagnostic. /// /// -/// CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") +/// Error: CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") /// public static DiagnosticEvent CallerSensitiveOnUnsupportedMethod(string arg0, string arg1, string arg2, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.CallerSensitiveOnUnsupportedMethod.Event([arg0, arg1, arg2], exception, location); @@ -556,7 +556,7 @@ readonly partial struct DiagnosticEvent /// The 'RemappedTypeMissingDefaultInterfaceMethod' diagnostic. /// /// -/// {arg0} does not implement default interface method {arg1}. +/// Error: {arg0} does not implement default interface method {arg1}. /// public static DiagnosticEvent RemappedTypeMissingDefaultInterfaceMethod(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.RemappedTypeMissingDefaultInterfaceMethod.Event([arg0, arg1], exception, location); @@ -564,7 +564,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericCompilerError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static DiagnosticEvent GenericCompilerError(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericCompilerError.Event([arg0], exception, location); @@ -572,7 +572,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericClassLoadingError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static DiagnosticEvent GenericClassLoadingError(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericClassLoadingError.Event([arg0], exception, location); @@ -580,7 +580,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericVerifierError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static DiagnosticEvent GenericVerifierError(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericVerifierError.Event([arg0], exception, location); @@ -588,7 +588,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericRuntimeError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static DiagnosticEvent GenericRuntimeError(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericRuntimeError.Event([arg0], exception, location); @@ -596,7 +596,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericJniError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public static DiagnosticEvent GenericJniError(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericJniError.Event([arg0], exception, location); @@ -604,7 +604,7 @@ readonly partial struct DiagnosticEvent /// The 'ExportingImportsNotSupported' diagnostic. /// /// -/// Exporting previously imported assemblies is not supported. +/// Error: Exporting previously imported assemblies is not supported. /// public static DiagnosticEvent ExportingImportsNotSupported(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ExportingImportsNotSupported.Event([], exception, location); @@ -612,7 +612,7 @@ readonly partial struct DiagnosticEvent /// The 'ResponseFileDepthExceeded' diagnostic. /// /// -/// Response file nesting depth exceeded. +/// Fatal: Response file nesting depth exceeded. /// public static DiagnosticEvent ResponseFileDepthExceeded(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ResponseFileDepthExceeded.Event([], exception, location); @@ -620,7 +620,7 @@ readonly partial struct DiagnosticEvent /// The 'ErrorReadingFile' diagnostic. /// /// -/// Unable to read file: {arg0}. ({arg1}) +/// Fatal: Unable to read file: {arg0}. ({arg1}) /// public static DiagnosticEvent ErrorReadingFile(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ErrorReadingFile.Event([arg0, arg1], exception, location); @@ -628,7 +628,7 @@ readonly partial struct DiagnosticEvent /// The 'NoTargetsFound' diagnostic. /// /// -/// No targets found +/// Fatal: No targets found /// public static DiagnosticEvent NoTargetsFound(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.NoTargetsFound.Event([], exception, location); @@ -636,7 +636,7 @@ readonly partial struct DiagnosticEvent /// The 'FileFormatLimitationExceeded' diagnostic. /// /// -/// File format limitation exceeded: {arg0}. +/// Fatal: File format limitation exceeded: {arg0}. /// public static DiagnosticEvent FileFormatLimitationExceeded(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.FileFormatLimitationExceeded.Event([arg0], exception, location); @@ -644,7 +644,7 @@ readonly partial struct DiagnosticEvent /// The 'CannotSpecifyBothKeyFileAndContainer' diagnostic. /// /// -/// You cannot specify both a key file and container. +/// Fatal: You cannot specify both a key file and container. /// public static DiagnosticEvent CannotSpecifyBothKeyFileAndContainer(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.CannotSpecifyBothKeyFileAndContainer.Event([], exception, location); @@ -652,7 +652,7 @@ readonly partial struct DiagnosticEvent /// The 'DelaySignRequiresKey' diagnostic. /// /// -/// You cannot delay sign without a key file or container. +/// Fatal: You cannot delay sign without a key file or container. /// public static DiagnosticEvent DelaySignRequiresKey(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.DelaySignRequiresKey.Event([], exception, location); @@ -660,7 +660,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidStrongNameKeyPair' diagnostic. /// /// -/// Invalid key {arg0} specified. ("{arg1}") +/// Fatal: Invalid key {arg0} specified. ("{arg1}") /// public static DiagnosticEvent InvalidStrongNameKeyPair(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidStrongNameKeyPair.Event([arg0, arg1], exception, location); @@ -668,7 +668,7 @@ readonly partial struct DiagnosticEvent /// The 'ReferenceNotFound' diagnostic. /// /// -/// Reference not found: {arg0} +/// Fatal: Reference not found: {arg0} /// public static DiagnosticEvent ReferenceNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ReferenceNotFound.Event([arg0], exception, location); @@ -676,7 +676,7 @@ readonly partial struct DiagnosticEvent /// The 'OptionsMustPreceedChildLevels' diagnostic. /// /// -/// You can only specify options before any child levels. +/// Fatal: You can only specify options before any child levels. /// public static DiagnosticEvent OptionsMustPreceedChildLevels(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.OptionsMustPreceedChildLevels.Event([], exception, location); @@ -684,7 +684,7 @@ readonly partial struct DiagnosticEvent /// The 'UnrecognizedTargetType' diagnostic. /// /// -/// Invalid value '{arg0}' for -target option. +/// Fatal: Invalid value '{arg0}' for -target option. /// public static DiagnosticEvent UnrecognizedTargetType(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnrecognizedTargetType.Event([arg0], exception, location); @@ -692,7 +692,7 @@ readonly partial struct DiagnosticEvent /// The 'UnrecognizedPlatform' diagnostic. /// /// -/// Invalid value '{arg0}' for -platform option. +/// Fatal: Invalid value '{arg0}' for -platform option. /// public static DiagnosticEvent UnrecognizedPlatform(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnrecognizedPlatform.Event([arg0], exception, location); @@ -700,7 +700,7 @@ readonly partial struct DiagnosticEvent /// The 'UnrecognizedApartment' diagnostic. /// /// -/// Invalid value '{arg0}' for -apartment option. +/// Fatal: Invalid value '{arg0}' for -apartment option. /// public static DiagnosticEvent UnrecognizedApartment(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnrecognizedApartment.Event([arg0], exception, location); @@ -708,7 +708,7 @@ readonly partial struct DiagnosticEvent /// The 'MissingFileSpecification' diagnostic. /// /// -/// Missing file specification for '{arg0}' option. +/// Fatal: Missing file specification for '{arg0}' option. /// public static DiagnosticEvent MissingFileSpecification(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MissingFileSpecification.Event([arg0], exception, location); @@ -716,7 +716,7 @@ readonly partial struct DiagnosticEvent /// The 'PathTooLong' diagnostic. /// /// -/// Path too long: {arg0}. +/// Fatal: Path too long: {arg0}. /// public static DiagnosticEvent PathTooLong(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.PathTooLong.Event([arg0], exception, location); @@ -724,7 +724,7 @@ readonly partial struct DiagnosticEvent /// The 'PathNotFound' diagnostic. /// /// -/// Path not found: {arg0}. +/// Fatal: Path not found: {arg0}. /// public static DiagnosticEvent PathNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.PathNotFound.Event([arg0], exception, location); @@ -732,7 +732,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidPath' diagnostic. /// /// -/// Invalid path: {arg0}. +/// Fatal: Invalid path: {arg0}. /// public static DiagnosticEvent InvalidPath(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidPath.Event([arg0], exception, location); @@ -740,7 +740,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidOptionSyntax' diagnostic. /// /// -/// Invalid option: {arg0}. +/// Fatal: Invalid option: {arg0}. /// public static DiagnosticEvent InvalidOptionSyntax(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidOptionSyntax.Event([arg0], exception, location); @@ -748,7 +748,7 @@ readonly partial struct DiagnosticEvent /// The 'ExternalResourceNotFound' diagnostic. /// /// -/// External resource file does not exist: {arg0}. +/// Fatal: External resource file does not exist: {arg0}. /// public static DiagnosticEvent ExternalResourceNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ExternalResourceNotFound.Event([arg0], exception, location); @@ -756,7 +756,7 @@ readonly partial struct DiagnosticEvent /// The 'ExternalResourceNameInvalid' diagnostic. /// /// -/// External resource file may not include path specification: {arg0}. +/// Fatal: External resource file may not include path specification: {arg0}. /// public static DiagnosticEvent ExternalResourceNameInvalid(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ExternalResourceNameInvalid.Event([arg0], exception, location); @@ -764,7 +764,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidVersionFormat' diagnostic. /// /// -/// Invalid version specified: {arg0}. +/// Fatal: Invalid version specified: {arg0}. /// public static DiagnosticEvent InvalidVersionFormat(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidVersionFormat.Event([arg0], exception, location); @@ -772,7 +772,7 @@ readonly partial struct DiagnosticEvent /// The 'InvalidFileAlignment' diagnostic. /// /// -/// Invalid value '{arg0}' for -filealign option. +/// Fatal: Invalid value '{arg0}' for -filealign option. /// public static DiagnosticEvent InvalidFileAlignment(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidFileAlignment.Event([arg0], exception, location); @@ -780,7 +780,7 @@ readonly partial struct DiagnosticEvent /// The 'ErrorWritingFile' diagnostic. /// /// -/// Unable to write file: {arg0}. ({arg1}) +/// Fatal: Unable to write file: {arg0}. ({arg1}) /// public static DiagnosticEvent ErrorWritingFile(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ErrorWritingFile.Event([arg0, arg1], exception, location); @@ -788,7 +788,7 @@ readonly partial struct DiagnosticEvent /// The 'UnrecognizedOption' diagnostic. /// /// -/// Unrecognized option: {arg0}. +/// Fatal: Unrecognized option: {arg0}. /// public static DiagnosticEvent UnrecognizedOption(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnrecognizedOption.Event([arg0], exception, location); @@ -796,7 +796,7 @@ readonly partial struct DiagnosticEvent /// The 'NoOutputFileSpecified' diagnostic. /// /// -/// No output file specified. +/// Fatal: No output file specified. /// public static DiagnosticEvent NoOutputFileSpecified(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.NoOutputFileSpecified.Event([], exception, location); @@ -804,7 +804,7 @@ readonly partial struct DiagnosticEvent /// The 'SharedClassLoaderCannotBeUsedOnModuleTarget' diagnostic. /// /// -/// Incompatible options: -target:module and -sharedclassloader cannot be combined. +/// Fatal: Incompatible options: -target:module and -sharedclassloader cannot be combined. /// public static DiagnosticEvent SharedClassLoaderCannotBeUsedOnModuleTarget(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.SharedClassLoaderCannotBeUsedOnModuleTarget.Event([], exception, location); @@ -812,7 +812,7 @@ readonly partial struct DiagnosticEvent /// The 'RuntimeNotFound' diagnostic. /// /// -/// Unable to load runtime assembly. +/// Fatal: Unable to load runtime assembly. /// public static DiagnosticEvent RuntimeNotFound(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.RuntimeNotFound.Event([], exception, location); @@ -820,7 +820,7 @@ readonly partial struct DiagnosticEvent /// The 'MainClassRequiresExe' diagnostic. /// /// -/// Main class cannot be specified for library or module. +/// Fatal: Main class cannot be specified for library or module. /// public static DiagnosticEvent MainClassRequiresExe(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MainClassRequiresExe.Event([], exception, location); @@ -828,7 +828,7 @@ readonly partial struct DiagnosticEvent /// The 'ExeRequiresMainClass' diagnostic. /// /// -/// No main method found. +/// Fatal: No main method found. /// public static DiagnosticEvent ExeRequiresMainClass(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ExeRequiresMainClass.Event([], exception, location); @@ -836,7 +836,7 @@ readonly partial struct DiagnosticEvent /// The 'PropertiesRequireExe' diagnostic. /// /// -/// Properties cannot be specified for library or module. +/// Fatal: Properties cannot be specified for library or module. /// public static DiagnosticEvent PropertiesRequireExe(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.PropertiesRequireExe.Event([], exception, location); @@ -844,7 +844,7 @@ readonly partial struct DiagnosticEvent /// The 'ModuleCannotHaveClassLoader' diagnostic. /// /// -/// Cannot specify assembly class loader for modules. +/// Fatal: Cannot specify assembly class loader for modules. /// public static DiagnosticEvent ModuleCannotHaveClassLoader(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ModuleCannotHaveClassLoader.Event([], exception, location); @@ -852,7 +852,7 @@ readonly partial struct DiagnosticEvent /// The 'ErrorParsingMapFile' diagnostic. /// /// -/// Unable to parse remap file: {arg0}. ({arg1}) +/// Fatal: Unable to parse remap file: {arg0}. ({arg1}) /// public static DiagnosticEvent ErrorParsingMapFile(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ErrorParsingMapFile.Event([arg0, arg1], exception, location); @@ -860,7 +860,7 @@ readonly partial struct DiagnosticEvent /// The 'BootstrapClassesMissing' diagnostic. /// /// -/// Bootstrap classes missing and core assembly not found. +/// Fatal: Bootstrap classes missing and core assembly not found. /// public static DiagnosticEvent BootstrapClassesMissing(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.BootstrapClassesMissing.Event([], exception, location); @@ -868,7 +868,7 @@ readonly partial struct DiagnosticEvent /// The 'StrongNameRequiresStrongNamedRefs' diagnostic. /// /// -/// All referenced assemblies must be strong named, to be able to sign the output assembly. +/// Fatal: All referenced assemblies must be strong named, to be able to sign the output assembly. /// public static DiagnosticEvent StrongNameRequiresStrongNamedRefs(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.StrongNameRequiresStrongNamedRefs.Event([], exception, location); @@ -876,7 +876,7 @@ readonly partial struct DiagnosticEvent /// The 'MainClassNotFound' diagnostic. /// /// -/// Main class not found. +/// Fatal: Main class not found. /// public static DiagnosticEvent MainClassNotFound(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MainClassNotFound.Event([], exception, location); @@ -884,7 +884,7 @@ readonly partial struct DiagnosticEvent /// The 'MainMethodNotFound' diagnostic. /// /// -/// Main method not found. +/// Fatal: Main method not found. /// public static DiagnosticEvent MainMethodNotFound(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MainMethodNotFound.Event([], exception, location); @@ -892,7 +892,7 @@ readonly partial struct DiagnosticEvent /// The 'UnsupportedMainMethod' diagnostic. /// /// -/// Redirected main method not supported. +/// Fatal: Redirected main method not supported. /// public static DiagnosticEvent UnsupportedMainMethod(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnsupportedMainMethod.Event([], exception, location); @@ -900,7 +900,7 @@ readonly partial struct DiagnosticEvent /// The 'ExternalMainNotAccessible' diagnostic. /// /// -/// External main method must be public and in a public class. +/// Fatal: External main method must be public and in a public class. /// public static DiagnosticEvent ExternalMainNotAccessible(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ExternalMainNotAccessible.Event([], exception, location); @@ -908,7 +908,7 @@ readonly partial struct DiagnosticEvent /// The 'ClassLoaderNotFound' diagnostic. /// /// -/// Custom assembly class loader class not found. +/// Fatal: Custom assembly class loader class not found. /// public static DiagnosticEvent ClassLoaderNotFound(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ClassLoaderNotFound.Event([], exception, location); @@ -916,7 +916,7 @@ readonly partial struct DiagnosticEvent /// The 'ClassLoaderNotAccessible' diagnostic. /// /// -/// Custom assembly class loader class is not accessible. +/// Fatal: Custom assembly class loader class is not accessible. /// public static DiagnosticEvent ClassLoaderNotAccessible(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ClassLoaderNotAccessible.Event([], exception, location); @@ -924,7 +924,7 @@ readonly partial struct DiagnosticEvent /// The 'ClassLoaderIsAbstract' diagnostic. /// /// -/// Custom assembly class loader class is abstract. +/// Fatal: Custom assembly class loader class is abstract. /// public static DiagnosticEvent ClassLoaderIsAbstract(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ClassLoaderIsAbstract.Event([], exception, location); @@ -932,7 +932,7 @@ readonly partial struct DiagnosticEvent /// The 'ClassLoaderNotClassLoader' diagnostic. /// /// -/// Custom assembly class loader class does not extend java.lang.ClassLoader. +/// Fatal: Custom assembly class loader class does not extend java.lang.ClassLoader. /// public static DiagnosticEvent ClassLoaderNotClassLoader(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ClassLoaderNotClassLoader.Event([], exception, location); @@ -940,7 +940,7 @@ readonly partial struct DiagnosticEvent /// The 'ClassLoaderConstructorMissing' diagnostic. /// /// -/// Custom assembly class loader constructor is missing. +/// Fatal: Custom assembly class loader constructor is missing. /// public static DiagnosticEvent ClassLoaderConstructorMissing(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ClassLoaderConstructorMissing.Event([], exception, location); @@ -948,7 +948,7 @@ readonly partial struct DiagnosticEvent /// The 'MapFileTypeNotFound' diagnostic. /// /// -/// Type '{arg0}' referenced in remap file was not found. +/// Fatal: Type '{arg0}' referenced in remap file was not found. /// public static DiagnosticEvent MapFileTypeNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MapFileTypeNotFound.Event([arg0], exception, location); @@ -956,7 +956,7 @@ readonly partial struct DiagnosticEvent /// The 'MapFileClassNotFound' diagnostic. /// /// -/// Class '{arg0}' referenced in remap file was not found. +/// Fatal: Class '{arg0}' referenced in remap file was not found. /// public static DiagnosticEvent MapFileClassNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MapFileClassNotFound.Event([arg0], exception, location); @@ -964,7 +964,7 @@ readonly partial struct DiagnosticEvent /// The 'MaximumErrorCountReached' diagnostic. /// /// -/// Maximum error count reached. +/// Fatal: Maximum error count reached. /// public static DiagnosticEvent MaximumErrorCountReached(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MaximumErrorCountReached.Event([], exception, location); @@ -972,7 +972,7 @@ readonly partial struct DiagnosticEvent /// The 'LinkageError' diagnostic. /// /// -/// Link error: {arg0} +/// Fatal: Link error: {arg0} /// public static DiagnosticEvent LinkageError(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.LinkageError.Event([arg0], exception, location); @@ -980,7 +980,7 @@ readonly partial struct DiagnosticEvent /// The 'RuntimeMismatch' diagnostic. /// /// -/// Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} +/// Fatal: Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} /// public static DiagnosticEvent RuntimeMismatch(string referencedAssemblyPath, string runtimeAssemblyName, string referencedAssemblyName, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.RuntimeMismatch.Event([referencedAssemblyPath, runtimeAssemblyName, referencedAssemblyName], exception, location); @@ -988,7 +988,7 @@ readonly partial struct DiagnosticEvent /// The 'RuntimeMismatchStrongName' diagnostic. /// /// -/// +/// Fatal: /// public static DiagnosticEvent RuntimeMismatchStrongName(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.RuntimeMismatchStrongName.Event([], exception, location); @@ -996,7 +996,7 @@ readonly partial struct DiagnosticEvent /// The 'CoreClassesMissing' diagnostic. /// /// -/// Failed to find core classes in core library. +/// Fatal: Failed to find core classes in core library. /// public static DiagnosticEvent CoreClassesMissing(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.CoreClassesMissing.Event([], exception, location); @@ -1004,7 +1004,7 @@ readonly partial struct DiagnosticEvent /// The 'CriticalClassNotFound' diagnostic. /// /// -/// Unable to load critical class '{arg0}'. +/// Fatal: Unable to load critical class '{arg0}'. /// public static DiagnosticEvent CriticalClassNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.CriticalClassNotFound.Event([arg0], exception, location); @@ -1012,7 +1012,7 @@ readonly partial struct DiagnosticEvent /// The 'AssemblyContainsDuplicateClassNames' diagnostic. /// /// -/// Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) +/// Fatal: Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) /// public static DiagnosticEvent AssemblyContainsDuplicateClassNames(string arg0, string arg1, string arg2, string arg3, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.AssemblyContainsDuplicateClassNames.Event([arg0, arg1, arg2, arg3], exception, location); @@ -1020,7 +1020,7 @@ readonly partial struct DiagnosticEvent /// The 'CallerIDRequiresHasCallerIDAnnotation' diagnostic. /// /// -/// CallerID.getCallerID() requires a HasCallerID annotation. +/// Fatal: CallerID.getCallerID() requires a HasCallerID annotation. /// public static DiagnosticEvent CallerIDRequiresHasCallerIDAnnotation(Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.CallerIDRequiresHasCallerIDAnnotation.Event([], exception, location); @@ -1028,7 +1028,7 @@ readonly partial struct DiagnosticEvent /// The 'UnableToResolveInterface' diagnostic. /// /// -/// Unable to resolve interface '{arg0}' on type '{arg1}'. +/// Fatal: Unable to resolve interface '{arg0}' on type '{arg1}'. /// public static DiagnosticEvent UnableToResolveInterface(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.UnableToResolveInterface.Event([arg0, arg1], exception, location); @@ -1036,7 +1036,7 @@ readonly partial struct DiagnosticEvent /// The 'MissingBaseType' diagnostic. /// /// -/// The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. +/// Fatal: The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. /// public static DiagnosticEvent MissingBaseType(string arg0, string arg1, string arg2, string arg3, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MissingBaseType.Event([arg0, arg1, arg2, arg3], exception, location); @@ -1044,7 +1044,7 @@ readonly partial struct DiagnosticEvent /// The 'MissingBaseTypeReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. +/// Fatal: The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. /// public static DiagnosticEvent MissingBaseTypeReference(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MissingBaseTypeReference.Event([arg0, arg1], exception, location); @@ -1052,7 +1052,7 @@ readonly partial struct DiagnosticEvent /// The 'FileNotFound' diagnostic. /// /// -/// File not found: {arg0}. +/// Fatal: File not found: {arg0}. /// public static DiagnosticEvent FileNotFound(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.FileNotFound.Event([arg0], exception, location); @@ -1060,7 +1060,7 @@ readonly partial struct DiagnosticEvent /// The 'RuntimeMethodMissing' diagnostic. /// /// -/// Runtime method '{arg0}' not found. +/// Fatal: Runtime method '{arg0}' not found. /// public static DiagnosticEvent RuntimeMethodMissing(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.RuntimeMethodMissing.Event([arg0], exception, location); @@ -1068,7 +1068,7 @@ readonly partial struct DiagnosticEvent /// The 'MapFileFieldNotFound' diagnostic. /// /// -/// Field '{arg0}' referenced in remap file was not found in class '{arg1}'. +/// Fatal: Field '{arg0}' referenced in remap file was not found in class '{arg1}'. /// public static DiagnosticEvent MapFileFieldNotFound(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.MapFileFieldNotFound.Event([arg0, arg1], exception, location); @@ -1076,7 +1076,7 @@ readonly partial struct DiagnosticEvent /// The 'GhostInterfaceMethodMissing' diagnostic. /// /// -/// Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) +/// Fatal: Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) /// public static DiagnosticEvent GhostInterfaceMethodMissing(string arg0, string arg1, string arg2, string arg3, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GhostInterfaceMethodMissing.Event([arg0, arg1, arg2, arg3], exception, location); @@ -1084,7 +1084,7 @@ readonly partial struct DiagnosticEvent /// The 'ModuleInitializerMethodRequirements' diagnostic. /// /// -/// Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. +/// Fatal: Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. /// public static DiagnosticEvent ModuleInitializerMethodRequirements(string arg1, string arg2, string arg3, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.ModuleInitializerMethodRequirements.Event([arg1, arg2, arg3], exception, location); @@ -1092,15 +1092,23 @@ readonly partial struct DiagnosticEvent /// The 'InvalidZip' diagnostic. /// /// -/// Invalid zip: {name}. +/// Fatal: Invalid zip: {name}. /// public static DiagnosticEvent InvalidZip(string name, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.InvalidZip.Event([name], exception, location); + /// + /// The 'CoreAssemblyVersionMismatch' diagnostic. + /// + /// +/// Fatal: Unable to load assembly '{0}' as it depends on a higher version of {1} than the one currently loaded. + /// + public static DiagnosticEvent CoreAssemblyVersionMismatch(string arg0, string arg1, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.CoreAssemblyVersionMismatch.Event([arg0, arg1], exception, location); + /// /// The 'GenericRuntimeTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public static DiagnosticEvent GenericRuntimeTrace(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericRuntimeTrace.Event([arg0], exception, location); @@ -1108,7 +1116,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericJniTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public static DiagnosticEvent GenericJniTrace(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericJniTrace.Event([arg0], exception, location); @@ -1116,7 +1124,7 @@ readonly partial struct DiagnosticEvent /// The 'GenericCompilerTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public static DiagnosticEvent GenericCompilerTrace(string arg0, Exception? exception = null, DiagnosticLocation location = default) => Diagnostic.GenericCompilerTrace.Event([arg0], exception, location); diff --git a/src/IKVM.CoreLib/Diagnostics/DiagnosticEvent.g.tt b/src/IKVM.CoreLib/Diagnostics/DiagnosticEvent.g.tt index a7cdf4ab6d..9b3b95ecb8 100644 --- a/src/IKVM.CoreLib/Diagnostics/DiagnosticEvent.g.tt +++ b/src/IKVM.CoreLib/Diagnostics/DiagnosticEvent.g.tt @@ -50,7 +50,7 @@ foreach (var kvp in DiagnosticFile.Read(Host.ResolvePath(Path.Combine("Diagnosti /// <#= desc #> /// /// -<#= Util.ToCommentString(kvp.Value.Message ?? "") #> +<#= Util.ToCommentString(kvp.Value) #> /// public static DiagnosticEvent <#= kvp.Key #>(<#= string.Join(", ", argDecl) #>) => Diagnostic.<#= kvp.Key #>.Event([<#= string.Join(", ", argList) #>], exception, location); diff --git a/src/IKVM.Tools.Importer/FatalCompilerErrorException.cs b/src/IKVM.CoreLib/Diagnostics/DiagnosticEventException.cs similarity index 88% rename from src/IKVM.Tools.Importer/FatalCompilerErrorException.cs rename to src/IKVM.CoreLib/Diagnostics/DiagnosticEventException.cs index 8296518f42..bf64df0b37 100644 --- a/src/IKVM.Tools.Importer/FatalCompilerErrorException.cs +++ b/src/IKVM.CoreLib/Diagnostics/DiagnosticEventException.cs @@ -1,11 +1,9 @@ using System; -using IKVM.CoreLib.Diagnostics; - -namespace IKVM.Tools.Importer +namespace IKVM.CoreLib.Diagnostics { - sealed class FatalCompilerErrorException : Exception + sealed class DiagnosticEventException : Exception { /// @@ -33,7 +31,7 @@ static string FormatDiagnosticLevel(DiagnosticLevel level) /// Initializes a new instance. /// /// - internal FatalCompilerErrorException(in DiagnosticEvent evt) : + internal DiagnosticEventException(in DiagnosticEvent evt) : #if NET8_0_OR_GREATER base($"{FormatDiagnosticLevel(evt.Diagnostic.Level)} IKVM{evt.Diagnostic.Id:D4}: {string.Format(null, evt.Diagnostic.Message, evt.Args)}") #else diff --git a/src/IKVM.CoreLib/Diagnostics/DiagnosticEventHandler.g.cs b/src/IKVM.CoreLib/Diagnostics/DiagnosticEventHandler.g.cs index 3e9ecb9d1a..782a3309c4 100644 --- a/src/IKVM.CoreLib/Diagnostics/DiagnosticEventHandler.g.cs +++ b/src/IKVM.CoreLib/Diagnostics/DiagnosticEventHandler.g.cs @@ -10,7 +10,7 @@ internal abstract partial class DiagnosticEventHandler /// The 'MainMethodFound' diagnostic. /// /// -/// Found main method in class "{arg0}". +/// Info: Found main method in class "{arg0}". /// public void MainMethodFound(string arg0) { @@ -22,7 +22,7 @@ public void MainMethodFound(string arg0) /// The 'OutputFileIs' diagnostic. /// /// -/// Output file is "{arg0}". +/// Info: Output file is "{arg0}". /// public void OutputFileIs(string arg0) { @@ -34,7 +34,7 @@ public void OutputFileIs(string arg0) /// The 'AutoAddRef' diagnostic. /// /// -/// Automatically adding reference to "{arg0}". +/// Info: Automatically adding reference to "{arg0}". /// public void AutoAddRef(string arg0) { @@ -46,7 +46,7 @@ public void AutoAddRef(string arg0) /// The 'MainMethodFromManifest' diagnostic. /// /// -/// Using main class "{arg0}" based on jar manifest. +/// Info: Using main class "{arg0}" based on jar manifest. /// public void MainMethodFromManifest(string arg0) { @@ -58,7 +58,7 @@ public void MainMethodFromManifest(string arg0) /// The 'GenericCompilerInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericCompilerInfo(string arg0) { @@ -70,7 +70,7 @@ public void GenericCompilerInfo(string arg0) /// The 'GenericClassLoadingInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericClassLoadingInfo(string arg0) { @@ -82,7 +82,7 @@ public void GenericClassLoadingInfo(string arg0) /// The 'GenericVerifierInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericVerifierInfo(string arg0) { @@ -94,7 +94,7 @@ public void GenericVerifierInfo(string arg0) /// The 'GenericRuntimeInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericRuntimeInfo(string arg0) { @@ -106,7 +106,7 @@ public void GenericRuntimeInfo(string arg0) /// The 'GenericJniInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericJniInfo(string arg0) { @@ -118,7 +118,7 @@ public void GenericJniInfo(string arg0) /// The 'ClassNotFound' diagnostic. /// /// -/// Class "{arg0}" not found. +/// Warning: Class "{arg0}" not found. /// public void ClassNotFound(string arg0) { @@ -130,7 +130,7 @@ public void ClassNotFound(string arg0) /// The 'ClassFormatError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (class format error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (class format error "{arg1}") /// public void ClassFormatError(string arg0, string arg1) { @@ -142,7 +142,7 @@ public void ClassFormatError(string arg0, string arg1) /// The 'DuplicateClassName' diagnostic. /// /// -/// Duplicate class name: "{arg0}". +/// Warning: Duplicate class name: "{arg0}". /// public void DuplicateClassName(string arg0) { @@ -154,7 +154,7 @@ public void DuplicateClassName(string arg0) /// The 'IllegalAccessError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (illegal access error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (illegal access error "{arg1}") /// public void IllegalAccessError(string arg0, string arg1) { @@ -166,7 +166,7 @@ public void IllegalAccessError(string arg0, string arg1) /// The 'VerificationError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (verification error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (verification error "{arg1}") /// public void VerificationError(string arg0, string arg1) { @@ -178,7 +178,7 @@ public void VerificationError(string arg0, string arg1) /// The 'NoClassDefFoundError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (missing class "{arg1}") +/// Warning: Unable to compile class "{arg0}". (missing class "{arg1}") /// public void NoClassDefFoundError(string arg0, string arg1) { @@ -190,7 +190,7 @@ public void NoClassDefFoundError(string arg0, string arg1) /// The 'GenericUnableToCompileError' diagnostic. /// /// -/// Unable to compile class "{arg0}". ("{arg1}": "{arg2}") +/// Warning: Unable to compile class "{arg0}". ("{arg1}": "{arg2}") /// public void GenericUnableToCompileError(string arg0, string arg1, string arg2) { @@ -202,7 +202,7 @@ public void GenericUnableToCompileError(string arg0, string arg1, string arg2) /// The 'DuplicateResourceName' diagnostic. /// /// -/// Skipping resource (name clash): "{arg0}" +/// Warning: Skipping resource (name clash): "{arg0}" /// public void DuplicateResourceName(string arg0) { @@ -214,7 +214,7 @@ public void DuplicateResourceName(string arg0) /// The 'SkippingReferencedClass' diagnostic. /// /// -/// Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") +/// Warning: Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") /// public void SkippingReferencedClass(string arg0, string arg1) { @@ -226,7 +226,7 @@ public void SkippingReferencedClass(string arg0, string arg1) /// The 'NoJniRuntime' diagnostic. /// /// -/// Unable to load runtime JNI assembly. +/// Warning: Unable to load runtime JNI assembly. /// public void NoJniRuntime() { @@ -238,7 +238,7 @@ public void NoJniRuntime() /// The 'EmittedNoClassDefFoundError' diagnostic. /// /// -/// Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). +/// Warning: Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). /// public void EmittedNoClassDefFoundError(string arg0, string arg1) { @@ -250,7 +250,7 @@ public void EmittedNoClassDefFoundError(string arg0, string arg1) /// The 'EmittedIllegalAccessError' diagnostic. /// /// -/// Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") /// public void EmittedIllegalAccessError(string arg0, string arg1) { @@ -262,7 +262,7 @@ public void EmittedIllegalAccessError(string arg0, string arg1) /// The 'EmittedInstantiationError' diagnostic. /// /// -/// Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") /// public void EmittedInstantiationError(string arg0, string arg1) { @@ -274,7 +274,7 @@ public void EmittedInstantiationError(string arg0, string arg1) /// The 'EmittedIncompatibleClassChangeError' diagnostic. /// /// -/// Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") /// public void EmittedIncompatibleClassChangeError(string arg0, string arg1) { @@ -286,7 +286,7 @@ public void EmittedIncompatibleClassChangeError(string arg0, string arg1) /// The 'EmittedNoSuchFieldError' diagnostic. /// /// -/// Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") /// public void EmittedNoSuchFieldError(string arg0, string arg1) { @@ -298,7 +298,7 @@ public void EmittedNoSuchFieldError(string arg0, string arg1) /// The 'EmittedAbstractMethodError' diagnostic. /// /// -/// Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") /// public void EmittedAbstractMethodError(string arg0, string arg1) { @@ -310,7 +310,7 @@ public void EmittedAbstractMethodError(string arg0, string arg1) /// The 'EmittedNoSuchMethodError' diagnostic. /// /// -/// Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") /// public void EmittedNoSuchMethodError(string arg0, string arg1) { @@ -322,7 +322,7 @@ public void EmittedNoSuchMethodError(string arg0, string arg1) /// The 'EmittedLinkageError' diagnostic. /// /// -/// Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") /// public void EmittedLinkageError(string arg0, string arg1) { @@ -334,7 +334,7 @@ public void EmittedLinkageError(string arg0, string arg1) /// The 'EmittedVerificationError' diagnostic. /// /// -/// Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") /// public void EmittedVerificationError(string arg0, string arg1) { @@ -346,7 +346,7 @@ public void EmittedVerificationError(string arg0, string arg1) /// The 'EmittedClassFormatError' diagnostic. /// /// -/// Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") /// public void EmittedClassFormatError(string arg0, string arg1) { @@ -358,7 +358,7 @@ public void EmittedClassFormatError(string arg0, string arg1) /// The 'InvalidCustomAttribute' diagnostic. /// /// -/// Error emitting "{arg0}" custom attribute. ("{arg1}") +/// Warning: Error emitting "{arg0}" custom attribute. ("{arg1}") /// public void InvalidCustomAttribute(string arg0, string arg1) { @@ -370,7 +370,7 @@ public void InvalidCustomAttribute(string arg0, string arg1) /// The 'IgnoredCustomAttribute' diagnostic. /// /// -/// Custom attribute "{arg0}" was ignored. ("{arg1}") +/// Warning: Custom attribute "{arg0}" was ignored. ("{arg1}") /// public void IgnoredCustomAttribute(string arg0, string arg1) { @@ -382,7 +382,7 @@ public void IgnoredCustomAttribute(string arg0, string arg1) /// The 'AssumeAssemblyVersionMatch' diagnostic. /// /// -/// Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy +/// Warning: Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy /// public void AssumeAssemblyVersionMatch(string arg0, string arg1) { @@ -394,7 +394,7 @@ public void AssumeAssemblyVersionMatch(string arg0, string arg1) /// The 'InvalidDirectoryInLibOptionPath' diagnostic. /// /// -/// Directory "{arg0}" specified in -lib option is not valid. +/// Warning: Directory "{arg0}" specified in -lib option is not valid. /// public void InvalidDirectoryInLibOptionPath(string arg0) { @@ -406,7 +406,7 @@ public void InvalidDirectoryInLibOptionPath(string arg0) /// The 'InvalidDirectoryInLibEnvironmentPath' diagnostic. /// /// -/// Directory "{arg0}" specified in LIB environment is not valid. +/// Warning: Directory "{arg0}" specified in LIB environment is not valid. /// public void InvalidDirectoryInLibEnvironmentPath(string arg0) { @@ -418,7 +418,7 @@ public void InvalidDirectoryInLibEnvironmentPath(string arg0) /// The 'LegacySearchRule' diagnostic. /// /// -/// Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. +/// Warning: Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. /// public void LegacySearchRule(string arg0) { @@ -430,7 +430,7 @@ public void LegacySearchRule(string arg0) /// The 'AssemblyLocationIgnored' diagnostic. /// /// -/// Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". +/// Warning: Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". /// public void AssemblyLocationIgnored(string arg0, string arg1, string arg2) { @@ -442,7 +442,7 @@ public void AssemblyLocationIgnored(string arg0, string arg1, string arg2) /// The 'InterfaceMethodCantBeInternal' diagnostic. /// /// -/// Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") +/// Warning: Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") /// public void InterfaceMethodCantBeInternal(string arg0, string arg1, string arg2) { @@ -454,7 +454,7 @@ public void InterfaceMethodCantBeInternal(string arg0, string arg1, string arg2) /// The 'DuplicateAssemblyReference' diagnostic. /// /// -/// Duplicate assembly reference "{arg0}" +/// Warning: Duplicate assembly reference "{arg0}" /// public void DuplicateAssemblyReference(string arg0) { @@ -466,7 +466,7 @@ public void DuplicateAssemblyReference(string arg0) /// The 'UnableToResolveType' diagnostic. /// /// -/// Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. +/// Warning: Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. /// public void UnableToResolveType(string arg0, string arg1, string arg2) { @@ -478,7 +478,7 @@ public void UnableToResolveType(string arg0, string arg1, string arg2) /// The 'StubsAreDeprecated' diagnostic. /// /// -/// Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. +/// Warning: Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. /// public void StubsAreDeprecated(string arg0) { @@ -490,7 +490,7 @@ public void StubsAreDeprecated(string arg0) /// The 'WrongClassName' diagnostic. /// /// -/// Unable to compile "{arg0}" (wrong name: "{arg1}") +/// Warning: Unable to compile "{arg0}" (wrong name: "{arg1}") /// public void WrongClassName(string arg0, string arg1) { @@ -502,7 +502,7 @@ public void WrongClassName(string arg0, string arg1) /// The 'ReflectionCallerClassRequiresCallerID' diagnostic. /// /// -/// Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") +/// Warning: Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") /// public void ReflectionCallerClassRequiresCallerID(string arg0, string arg1, string arg2) { @@ -514,7 +514,7 @@ public void ReflectionCallerClassRequiresCallerID(string arg0, string arg1, stri /// The 'LegacyAssemblyAttributesFound' diagnostic. /// /// -/// Legacy assembly attributes container found. Please use the -assemblyattributes: option. +/// Warning: Legacy assembly attributes container found. Please use the -assemblyattributes: option. /// public void LegacyAssemblyAttributesFound() { @@ -526,7 +526,7 @@ public void LegacyAssemblyAttributesFound() /// The 'UnableToCreateLambdaFactory' diagnostic. /// /// -/// Unable to create static lambda factory. +/// Warning: Unable to create static lambda factory. /// public void UnableToCreateLambdaFactory() { @@ -538,7 +538,7 @@ public void UnableToCreateLambdaFactory() /// The 'UnknownWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void UnknownWarning(string arg0) { @@ -550,7 +550,7 @@ public void UnknownWarning(string arg0) /// The 'DuplicateIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// public void DuplicateIkvmLangProperty(string arg0, string arg1) { @@ -562,7 +562,7 @@ public void DuplicateIkvmLangProperty(string arg0, string arg1) /// The 'MalformedIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// public void MalformedIkvmLangProperty(string arg0, string arg1) { @@ -574,7 +574,7 @@ public void MalformedIkvmLangProperty(string arg0, string arg1) /// The 'GenericCompilerWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericCompilerWarning(string arg0) { @@ -586,7 +586,7 @@ public void GenericCompilerWarning(string arg0) /// The 'GenericClassLoadingWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericClassLoadingWarning(string arg0) { @@ -598,7 +598,7 @@ public void GenericClassLoadingWarning(string arg0) /// The 'GenericVerifierWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericVerifierWarning(string arg0) { @@ -610,7 +610,7 @@ public void GenericVerifierWarning(string arg0) /// The 'GenericRuntimeWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericRuntimeWarning(string arg0) { @@ -622,7 +622,7 @@ public void GenericRuntimeWarning(string arg0) /// The 'GenericJniWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericJniWarning(string arg0) { @@ -634,7 +634,7 @@ public void GenericJniWarning(string arg0) /// The 'UnableToCreateProxy' diagnostic. /// /// -/// Unable to create proxy "{arg0}". ("{arg1}") +/// Error: Unable to create proxy "{arg0}". ("{arg1}") /// public void UnableToCreateProxy(string arg0, string arg1) { @@ -646,7 +646,7 @@ public void UnableToCreateProxy(string arg0, string arg1) /// The 'DuplicateProxy' diagnostic. /// /// -/// Duplicate proxy "{arg0}". +/// Error: Duplicate proxy "{arg0}". /// public void DuplicateProxy(string arg0) { @@ -658,7 +658,7 @@ public void DuplicateProxy(string arg0) /// The 'MapXmlUnableToResolveOpCode' diagnostic. /// /// -/// Unable to resolve opcode in remap file: {arg0}. +/// Error: Unable to resolve opcode in remap file: {arg0}. /// public void MapXmlUnableToResolveOpCode(string arg0) { @@ -670,7 +670,7 @@ public void MapXmlUnableToResolveOpCode(string arg0) /// The 'MapXmlError' diagnostic. /// /// -/// Error in remap file: {arg0}. +/// Error: Error in remap file: {arg0}. /// public void MapXmlError(string arg0) { @@ -682,7 +682,7 @@ public void MapXmlError(string arg0) /// The 'InputFileNotFound' diagnostic. /// /// -/// Source file '{arg0}' not found. +/// Error: Source file '{arg0}' not found. /// public void InputFileNotFound(string arg0) { @@ -694,7 +694,7 @@ public void InputFileNotFound(string arg0) /// The 'UnknownFileType' diagnostic. /// /// -/// Unknown file type: {arg0}. +/// Error: Unknown file type: {arg0}. /// public void UnknownFileType(string arg0) { @@ -706,7 +706,7 @@ public void UnknownFileType(string arg0) /// The 'UnknownElementInMapFile' diagnostic. /// /// -/// Unknown element {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown element {arg0} in remap file, line {arg1}, column {arg2}. /// public void UnknownElementInMapFile(string arg0, string arg1, string arg2) { @@ -718,7 +718,7 @@ public void UnknownElementInMapFile(string arg0, string arg1, string arg2) /// The 'UnknownAttributeInMapFile' diagnostic. /// /// -/// Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. /// public void UnknownAttributeInMapFile(string arg0, string arg1, string arg2) { @@ -730,7 +730,7 @@ public void UnknownAttributeInMapFile(string arg0, string arg1, string arg2) /// The 'InvalidMemberNameInMapFile' diagnostic. /// /// -/// Invalid {arg0} name '{arg1}' in remap file in class {arg2}. +/// Error: Invalid {arg0} name '{arg1}' in remap file in class {arg2}. /// public void InvalidMemberNameInMapFile(string arg0, string arg1, string arg2) { @@ -742,7 +742,7 @@ public void InvalidMemberNameInMapFile(string arg0, string arg1, string arg2) /// The 'InvalidMemberSignatureInMapFile' diagnostic. /// /// -/// Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. +/// Error: Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. /// public void InvalidMemberSignatureInMapFile(string arg0, string arg1, string arg2, string arg3) { @@ -754,7 +754,7 @@ public void InvalidMemberSignatureInMapFile(string arg0, string arg1, string arg /// The 'InvalidPropertyNameInMapFile' diagnostic. /// /// -/// Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. /// public void InvalidPropertyNameInMapFile(string arg0, string arg1, string arg2, string arg3) { @@ -766,7 +766,7 @@ public void InvalidPropertyNameInMapFile(string arg0, string arg1, string arg2, /// The 'InvalidPropertySignatureInMapFile' diagnostic. /// /// -/// Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. /// public void InvalidPropertySignatureInMapFile(string arg0, string arg1, string arg2, string arg3) { @@ -778,7 +778,7 @@ public void InvalidPropertySignatureInMapFile(string arg0, string arg1, string a /// The 'NonPrimaryAssemblyReference' diagnostic. /// /// -/// Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. +/// Error: Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. /// public void NonPrimaryAssemblyReference(string arg0, string arg1) { @@ -790,7 +790,7 @@ public void NonPrimaryAssemblyReference(string arg0, string arg1) /// The 'MissingType' diagnostic. /// /// -/// Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. +/// Error: Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. /// public void MissingType(string arg0, string arg1) { @@ -802,7 +802,7 @@ public void MissingType(string arg0, string arg1) /// The 'MissingReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. +/// Error: The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. /// public void MissingReference(string arg0, string arg1) { @@ -814,7 +814,7 @@ public void MissingReference(string arg0, string arg1) /// The 'CallerSensitiveOnUnsupportedMethod' diagnostic. /// /// -/// CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") +/// Error: CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") /// public void CallerSensitiveOnUnsupportedMethod(string arg0, string arg1, string arg2) { @@ -826,7 +826,7 @@ public void CallerSensitiveOnUnsupportedMethod(string arg0, string arg1, string /// The 'RemappedTypeMissingDefaultInterfaceMethod' diagnostic. /// /// -/// {arg0} does not implement default interface method {arg1}. +/// Error: {arg0} does not implement default interface method {arg1}. /// public void RemappedTypeMissingDefaultInterfaceMethod(string arg0, string arg1) { @@ -838,7 +838,7 @@ public void RemappedTypeMissingDefaultInterfaceMethod(string arg0, string arg1) /// The 'GenericCompilerError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericCompilerError(string arg0) { @@ -850,7 +850,7 @@ public void GenericCompilerError(string arg0) /// The 'GenericClassLoadingError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericClassLoadingError(string arg0) { @@ -862,7 +862,7 @@ public void GenericClassLoadingError(string arg0) /// The 'GenericVerifierError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericVerifierError(string arg0) { @@ -874,7 +874,7 @@ public void GenericVerifierError(string arg0) /// The 'GenericRuntimeError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericRuntimeError(string arg0) { @@ -886,7 +886,7 @@ public void GenericRuntimeError(string arg0) /// The 'GenericJniError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericJniError(string arg0) { @@ -898,7 +898,7 @@ public void GenericJniError(string arg0) /// The 'ExportingImportsNotSupported' diagnostic. /// /// -/// Exporting previously imported assemblies is not supported. +/// Error: Exporting previously imported assemblies is not supported. /// public void ExportingImportsNotSupported() { @@ -910,7 +910,7 @@ public void ExportingImportsNotSupported() /// The 'ResponseFileDepthExceeded' diagnostic. /// /// -/// Response file nesting depth exceeded. +/// Fatal: Response file nesting depth exceeded. /// public void ResponseFileDepthExceeded() { @@ -922,7 +922,7 @@ public void ResponseFileDepthExceeded() /// The 'ErrorReadingFile' diagnostic. /// /// -/// Unable to read file: {arg0}. ({arg1}) +/// Fatal: Unable to read file: {arg0}. ({arg1}) /// public void ErrorReadingFile(string arg0, string arg1) { @@ -934,7 +934,7 @@ public void ErrorReadingFile(string arg0, string arg1) /// The 'NoTargetsFound' diagnostic. /// /// -/// No targets found +/// Fatal: No targets found /// public void NoTargetsFound() { @@ -946,7 +946,7 @@ public void NoTargetsFound() /// The 'FileFormatLimitationExceeded' diagnostic. /// /// -/// File format limitation exceeded: {arg0}. +/// Fatal: File format limitation exceeded: {arg0}. /// public void FileFormatLimitationExceeded(string arg0) { @@ -958,7 +958,7 @@ public void FileFormatLimitationExceeded(string arg0) /// The 'CannotSpecifyBothKeyFileAndContainer' diagnostic. /// /// -/// You cannot specify both a key file and container. +/// Fatal: You cannot specify both a key file and container. /// public void CannotSpecifyBothKeyFileAndContainer() { @@ -970,7 +970,7 @@ public void CannotSpecifyBothKeyFileAndContainer() /// The 'DelaySignRequiresKey' diagnostic. /// /// -/// You cannot delay sign without a key file or container. +/// Fatal: You cannot delay sign without a key file or container. /// public void DelaySignRequiresKey() { @@ -982,7 +982,7 @@ public void DelaySignRequiresKey() /// The 'InvalidStrongNameKeyPair' diagnostic. /// /// -/// Invalid key {arg0} specified. ("{arg1}") +/// Fatal: Invalid key {arg0} specified. ("{arg1}") /// public void InvalidStrongNameKeyPair(string arg0, string arg1) { @@ -994,7 +994,7 @@ public void InvalidStrongNameKeyPair(string arg0, string arg1) /// The 'ReferenceNotFound' diagnostic. /// /// -/// Reference not found: {arg0} +/// Fatal: Reference not found: {arg0} /// public void ReferenceNotFound(string arg0) { @@ -1006,7 +1006,7 @@ public void ReferenceNotFound(string arg0) /// The 'OptionsMustPreceedChildLevels' diagnostic. /// /// -/// You can only specify options before any child levels. +/// Fatal: You can only specify options before any child levels. /// public void OptionsMustPreceedChildLevels() { @@ -1018,7 +1018,7 @@ public void OptionsMustPreceedChildLevels() /// The 'UnrecognizedTargetType' diagnostic. /// /// -/// Invalid value '{arg0}' for -target option. +/// Fatal: Invalid value '{arg0}' for -target option. /// public void UnrecognizedTargetType(string arg0) { @@ -1030,7 +1030,7 @@ public void UnrecognizedTargetType(string arg0) /// The 'UnrecognizedPlatform' diagnostic. /// /// -/// Invalid value '{arg0}' for -platform option. +/// Fatal: Invalid value '{arg0}' for -platform option. /// public void UnrecognizedPlatform(string arg0) { @@ -1042,7 +1042,7 @@ public void UnrecognizedPlatform(string arg0) /// The 'UnrecognizedApartment' diagnostic. /// /// -/// Invalid value '{arg0}' for -apartment option. +/// Fatal: Invalid value '{arg0}' for -apartment option. /// public void UnrecognizedApartment(string arg0) { @@ -1054,7 +1054,7 @@ public void UnrecognizedApartment(string arg0) /// The 'MissingFileSpecification' diagnostic. /// /// -/// Missing file specification for '{arg0}' option. +/// Fatal: Missing file specification for '{arg0}' option. /// public void MissingFileSpecification(string arg0) { @@ -1066,7 +1066,7 @@ public void MissingFileSpecification(string arg0) /// The 'PathTooLong' diagnostic. /// /// -/// Path too long: {arg0}. +/// Fatal: Path too long: {arg0}. /// public void PathTooLong(string arg0) { @@ -1078,7 +1078,7 @@ public void PathTooLong(string arg0) /// The 'PathNotFound' diagnostic. /// /// -/// Path not found: {arg0}. +/// Fatal: Path not found: {arg0}. /// public void PathNotFound(string arg0) { @@ -1090,7 +1090,7 @@ public void PathNotFound(string arg0) /// The 'InvalidPath' diagnostic. /// /// -/// Invalid path: {arg0}. +/// Fatal: Invalid path: {arg0}. /// public void InvalidPath(string arg0) { @@ -1102,7 +1102,7 @@ public void InvalidPath(string arg0) /// The 'InvalidOptionSyntax' diagnostic. /// /// -/// Invalid option: {arg0}. +/// Fatal: Invalid option: {arg0}. /// public void InvalidOptionSyntax(string arg0) { @@ -1114,7 +1114,7 @@ public void InvalidOptionSyntax(string arg0) /// The 'ExternalResourceNotFound' diagnostic. /// /// -/// External resource file does not exist: {arg0}. +/// Fatal: External resource file does not exist: {arg0}. /// public void ExternalResourceNotFound(string arg0) { @@ -1126,7 +1126,7 @@ public void ExternalResourceNotFound(string arg0) /// The 'ExternalResourceNameInvalid' diagnostic. /// /// -/// External resource file may not include path specification: {arg0}. +/// Fatal: External resource file may not include path specification: {arg0}. /// public void ExternalResourceNameInvalid(string arg0) { @@ -1138,7 +1138,7 @@ public void ExternalResourceNameInvalid(string arg0) /// The 'InvalidVersionFormat' diagnostic. /// /// -/// Invalid version specified: {arg0}. +/// Fatal: Invalid version specified: {arg0}. /// public void InvalidVersionFormat(string arg0) { @@ -1150,7 +1150,7 @@ public void InvalidVersionFormat(string arg0) /// The 'InvalidFileAlignment' diagnostic. /// /// -/// Invalid value '{arg0}' for -filealign option. +/// Fatal: Invalid value '{arg0}' for -filealign option. /// public void InvalidFileAlignment(string arg0) { @@ -1162,7 +1162,7 @@ public void InvalidFileAlignment(string arg0) /// The 'ErrorWritingFile' diagnostic. /// /// -/// Unable to write file: {arg0}. ({arg1}) +/// Fatal: Unable to write file: {arg0}. ({arg1}) /// public void ErrorWritingFile(string arg0, string arg1) { @@ -1174,7 +1174,7 @@ public void ErrorWritingFile(string arg0, string arg1) /// The 'UnrecognizedOption' diagnostic. /// /// -/// Unrecognized option: {arg0}. +/// Fatal: Unrecognized option: {arg0}. /// public void UnrecognizedOption(string arg0) { @@ -1186,7 +1186,7 @@ public void UnrecognizedOption(string arg0) /// The 'NoOutputFileSpecified' diagnostic. /// /// -/// No output file specified. +/// Fatal: No output file specified. /// public void NoOutputFileSpecified() { @@ -1198,7 +1198,7 @@ public void NoOutputFileSpecified() /// The 'SharedClassLoaderCannotBeUsedOnModuleTarget' diagnostic. /// /// -/// Incompatible options: -target:module and -sharedclassloader cannot be combined. +/// Fatal: Incompatible options: -target:module and -sharedclassloader cannot be combined. /// public void SharedClassLoaderCannotBeUsedOnModuleTarget() { @@ -1210,7 +1210,7 @@ public void SharedClassLoaderCannotBeUsedOnModuleTarget() /// The 'RuntimeNotFound' diagnostic. /// /// -/// Unable to load runtime assembly. +/// Fatal: Unable to load runtime assembly. /// public void RuntimeNotFound() { @@ -1222,7 +1222,7 @@ public void RuntimeNotFound() /// The 'MainClassRequiresExe' diagnostic. /// /// -/// Main class cannot be specified for library or module. +/// Fatal: Main class cannot be specified for library or module. /// public void MainClassRequiresExe() { @@ -1234,7 +1234,7 @@ public void MainClassRequiresExe() /// The 'ExeRequiresMainClass' diagnostic. /// /// -/// No main method found. +/// Fatal: No main method found. /// public void ExeRequiresMainClass() { @@ -1246,7 +1246,7 @@ public void ExeRequiresMainClass() /// The 'PropertiesRequireExe' diagnostic. /// /// -/// Properties cannot be specified for library or module. +/// Fatal: Properties cannot be specified for library or module. /// public void PropertiesRequireExe() { @@ -1258,7 +1258,7 @@ public void PropertiesRequireExe() /// The 'ModuleCannotHaveClassLoader' diagnostic. /// /// -/// Cannot specify assembly class loader for modules. +/// Fatal: Cannot specify assembly class loader for modules. /// public void ModuleCannotHaveClassLoader() { @@ -1270,7 +1270,7 @@ public void ModuleCannotHaveClassLoader() /// The 'ErrorParsingMapFile' diagnostic. /// /// -/// Unable to parse remap file: {arg0}. ({arg1}) +/// Fatal: Unable to parse remap file: {arg0}. ({arg1}) /// public void ErrorParsingMapFile(string arg0, string arg1) { @@ -1282,7 +1282,7 @@ public void ErrorParsingMapFile(string arg0, string arg1) /// The 'BootstrapClassesMissing' diagnostic. /// /// -/// Bootstrap classes missing and core assembly not found. +/// Fatal: Bootstrap classes missing and core assembly not found. /// public void BootstrapClassesMissing() { @@ -1294,7 +1294,7 @@ public void BootstrapClassesMissing() /// The 'StrongNameRequiresStrongNamedRefs' diagnostic. /// /// -/// All referenced assemblies must be strong named, to be able to sign the output assembly. +/// Fatal: All referenced assemblies must be strong named, to be able to sign the output assembly. /// public void StrongNameRequiresStrongNamedRefs() { @@ -1306,7 +1306,7 @@ public void StrongNameRequiresStrongNamedRefs() /// The 'MainClassNotFound' diagnostic. /// /// -/// Main class not found. +/// Fatal: Main class not found. /// public void MainClassNotFound() { @@ -1318,7 +1318,7 @@ public void MainClassNotFound() /// The 'MainMethodNotFound' diagnostic. /// /// -/// Main method not found. +/// Fatal: Main method not found. /// public void MainMethodNotFound() { @@ -1330,7 +1330,7 @@ public void MainMethodNotFound() /// The 'UnsupportedMainMethod' diagnostic. /// /// -/// Redirected main method not supported. +/// Fatal: Redirected main method not supported. /// public void UnsupportedMainMethod() { @@ -1342,7 +1342,7 @@ public void UnsupportedMainMethod() /// The 'ExternalMainNotAccessible' diagnostic. /// /// -/// External main method must be public and in a public class. +/// Fatal: External main method must be public and in a public class. /// public void ExternalMainNotAccessible() { @@ -1354,7 +1354,7 @@ public void ExternalMainNotAccessible() /// The 'ClassLoaderNotFound' diagnostic. /// /// -/// Custom assembly class loader class not found. +/// Fatal: Custom assembly class loader class not found. /// public void ClassLoaderNotFound() { @@ -1366,7 +1366,7 @@ public void ClassLoaderNotFound() /// The 'ClassLoaderNotAccessible' diagnostic. /// /// -/// Custom assembly class loader class is not accessible. +/// Fatal: Custom assembly class loader class is not accessible. /// public void ClassLoaderNotAccessible() { @@ -1378,7 +1378,7 @@ public void ClassLoaderNotAccessible() /// The 'ClassLoaderIsAbstract' diagnostic. /// /// -/// Custom assembly class loader class is abstract. +/// Fatal: Custom assembly class loader class is abstract. /// public void ClassLoaderIsAbstract() { @@ -1390,7 +1390,7 @@ public void ClassLoaderIsAbstract() /// The 'ClassLoaderNotClassLoader' diagnostic. /// /// -/// Custom assembly class loader class does not extend java.lang.ClassLoader. +/// Fatal: Custom assembly class loader class does not extend java.lang.ClassLoader. /// public void ClassLoaderNotClassLoader() { @@ -1402,7 +1402,7 @@ public void ClassLoaderNotClassLoader() /// The 'ClassLoaderConstructorMissing' diagnostic. /// /// -/// Custom assembly class loader constructor is missing. +/// Fatal: Custom assembly class loader constructor is missing. /// public void ClassLoaderConstructorMissing() { @@ -1414,7 +1414,7 @@ public void ClassLoaderConstructorMissing() /// The 'MapFileTypeNotFound' diagnostic. /// /// -/// Type '{arg0}' referenced in remap file was not found. +/// Fatal: Type '{arg0}' referenced in remap file was not found. /// public void MapFileTypeNotFound(string arg0) { @@ -1426,7 +1426,7 @@ public void MapFileTypeNotFound(string arg0) /// The 'MapFileClassNotFound' diagnostic. /// /// -/// Class '{arg0}' referenced in remap file was not found. +/// Fatal: Class '{arg0}' referenced in remap file was not found. /// public void MapFileClassNotFound(string arg0) { @@ -1438,7 +1438,7 @@ public void MapFileClassNotFound(string arg0) /// The 'MaximumErrorCountReached' diagnostic. /// /// -/// Maximum error count reached. +/// Fatal: Maximum error count reached. /// public void MaximumErrorCountReached() { @@ -1450,7 +1450,7 @@ public void MaximumErrorCountReached() /// The 'LinkageError' diagnostic. /// /// -/// Link error: {arg0} +/// Fatal: Link error: {arg0} /// public void LinkageError(string arg0) { @@ -1462,7 +1462,7 @@ public void LinkageError(string arg0) /// The 'RuntimeMismatch' diagnostic. /// /// -/// Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} +/// Fatal: Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} /// public void RuntimeMismatch(string referencedAssemblyPath, string runtimeAssemblyName, string referencedAssemblyName) { @@ -1474,7 +1474,7 @@ public void RuntimeMismatch(string referencedAssemblyPath, string runtimeAssembl /// The 'RuntimeMismatchStrongName' diagnostic. /// /// -/// +/// Fatal: /// public void RuntimeMismatchStrongName() { @@ -1486,7 +1486,7 @@ public void RuntimeMismatchStrongName() /// The 'CoreClassesMissing' diagnostic. /// /// -/// Failed to find core classes in core library. +/// Fatal: Failed to find core classes in core library. /// public void CoreClassesMissing() { @@ -1498,7 +1498,7 @@ public void CoreClassesMissing() /// The 'CriticalClassNotFound' diagnostic. /// /// -/// Unable to load critical class '{arg0}'. +/// Fatal: Unable to load critical class '{arg0}'. /// public void CriticalClassNotFound(string arg0) { @@ -1510,7 +1510,7 @@ public void CriticalClassNotFound(string arg0) /// The 'AssemblyContainsDuplicateClassNames' diagnostic. /// /// -/// Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) +/// Fatal: Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) /// public void AssemblyContainsDuplicateClassNames(string arg0, string arg1, string arg2, string arg3) { @@ -1522,7 +1522,7 @@ public void AssemblyContainsDuplicateClassNames(string arg0, string arg1, string /// The 'CallerIDRequiresHasCallerIDAnnotation' diagnostic. /// /// -/// CallerID.getCallerID() requires a HasCallerID annotation. +/// Fatal: CallerID.getCallerID() requires a HasCallerID annotation. /// public void CallerIDRequiresHasCallerIDAnnotation() { @@ -1534,7 +1534,7 @@ public void CallerIDRequiresHasCallerIDAnnotation() /// The 'UnableToResolveInterface' diagnostic. /// /// -/// Unable to resolve interface '{arg0}' on type '{arg1}'. +/// Fatal: Unable to resolve interface '{arg0}' on type '{arg1}'. /// public void UnableToResolveInterface(string arg0, string arg1) { @@ -1546,7 +1546,7 @@ public void UnableToResolveInterface(string arg0, string arg1) /// The 'MissingBaseType' diagnostic. /// /// -/// The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. +/// Fatal: The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. /// public void MissingBaseType(string arg0, string arg1, string arg2, string arg3) { @@ -1558,7 +1558,7 @@ public void MissingBaseType(string arg0, string arg1, string arg2, string arg3) /// The 'MissingBaseTypeReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. +/// Fatal: The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. /// public void MissingBaseTypeReference(string arg0, string arg1) { @@ -1570,7 +1570,7 @@ public void MissingBaseTypeReference(string arg0, string arg1) /// The 'FileNotFound' diagnostic. /// /// -/// File not found: {arg0}. +/// Fatal: File not found: {arg0}. /// public void FileNotFound(string arg0) { @@ -1582,7 +1582,7 @@ public void FileNotFound(string arg0) /// The 'RuntimeMethodMissing' diagnostic. /// /// -/// Runtime method '{arg0}' not found. +/// Fatal: Runtime method '{arg0}' not found. /// public void RuntimeMethodMissing(string arg0) { @@ -1594,7 +1594,7 @@ public void RuntimeMethodMissing(string arg0) /// The 'MapFileFieldNotFound' diagnostic. /// /// -/// Field '{arg0}' referenced in remap file was not found in class '{arg1}'. +/// Fatal: Field '{arg0}' referenced in remap file was not found in class '{arg1}'. /// public void MapFileFieldNotFound(string arg0, string arg1) { @@ -1606,7 +1606,7 @@ public void MapFileFieldNotFound(string arg0, string arg1) /// The 'GhostInterfaceMethodMissing' diagnostic. /// /// -/// Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) +/// Fatal: Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) /// public void GhostInterfaceMethodMissing(string arg0, string arg1, string arg2, string arg3) { @@ -1618,7 +1618,7 @@ public void GhostInterfaceMethodMissing(string arg0, string arg1, string arg2, s /// The 'ModuleInitializerMethodRequirements' diagnostic. /// /// -/// Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. +/// Fatal: Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. /// public void ModuleInitializerMethodRequirements(string arg1, string arg2, string arg3) { @@ -1630,7 +1630,7 @@ public void ModuleInitializerMethodRequirements(string arg1, string arg2, string /// The 'InvalidZip' diagnostic. /// /// -/// Invalid zip: {name}. +/// Fatal: Invalid zip: {name}. /// public void InvalidZip(string name) { @@ -1638,11 +1638,23 @@ public void InvalidZip(string name) Report(Diagnostic.InvalidZip.Event([name])); } + /// + /// The 'CoreAssemblyVersionMismatch' diagnostic. + /// + /// +/// Fatal: Unable to load assembly '{0}' as it depends on a higher version of {1} than the one currently loaded. + /// + public void CoreAssemblyVersionMismatch(string arg0, string arg1) + { + if (IsEnabled(Diagnostic.CoreAssemblyVersionMismatch)) + Report(Diagnostic.CoreAssemblyVersionMismatch.Event([arg0, arg1])); + } + /// /// The 'GenericRuntimeTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public void GenericRuntimeTrace(string arg0) { @@ -1654,7 +1666,7 @@ public void GenericRuntimeTrace(string arg0) /// The 'GenericJniTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public void GenericJniTrace(string arg0) { @@ -1666,7 +1678,7 @@ public void GenericJniTrace(string arg0) /// The 'GenericCompilerTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public void GenericCompilerTrace(string arg0) { diff --git a/src/IKVM.CoreLib/Diagnostics/DiagnosticEventHandler.g.tt b/src/IKVM.CoreLib/Diagnostics/DiagnosticEventHandler.g.tt index 415e1deedb..328b47bcc8 100644 --- a/src/IKVM.CoreLib/Diagnostics/DiagnosticEventHandler.g.tt +++ b/src/IKVM.CoreLib/Diagnostics/DiagnosticEventHandler.g.tt @@ -45,7 +45,7 @@ foreach (var kvp in DiagnosticFile.Read(Host.ResolvePath(Path.Combine("Diagnosti /// <#= desc #> /// /// -<#= Util.ToCommentString(kvp.Value.Message ?? "") #> +<#= Util.ToCommentString(kvp.Value) #> /// public void <#= kvp.Key #>(<#= string.Join(", ", argDecl) #>) { diff --git a/src/IKVM.CoreLib/Diagnostics/DiagnosticLevel.cs b/src/IKVM.CoreLib/Diagnostics/DiagnosticLevel.cs index 3226f9f800..476fe8d784 100644 --- a/src/IKVM.CoreLib/Diagnostics/DiagnosticLevel.cs +++ b/src/IKVM.CoreLib/Diagnostics/DiagnosticLevel.cs @@ -6,6 +6,7 @@ enum DiagnosticLevel { + Unknown, Trace, Info, Warning, diff --git a/src/IKVM.CoreLib/Diagnostics/IDiagnosticHandler.g.cs b/src/IKVM.CoreLib/Diagnostics/IDiagnosticHandler.g.cs index bfa84e1165..cbd53a7275 100644 --- a/src/IKVM.CoreLib/Diagnostics/IDiagnosticHandler.g.cs +++ b/src/IKVM.CoreLib/Diagnostics/IDiagnosticHandler.g.cs @@ -10,7 +10,7 @@ partial interface IDiagnosticHandler /// The 'MainMethodFound' diagnostic. /// /// -/// Found main method in class "{arg0}". +/// Info: Found main method in class "{arg0}". /// void MainMethodFound(string arg0); @@ -18,7 +18,7 @@ partial interface IDiagnosticHandler /// The 'OutputFileIs' diagnostic. /// /// -/// Output file is "{arg0}". +/// Info: Output file is "{arg0}". /// void OutputFileIs(string arg0); @@ -26,7 +26,7 @@ partial interface IDiagnosticHandler /// The 'AutoAddRef' diagnostic. /// /// -/// Automatically adding reference to "{arg0}". +/// Info: Automatically adding reference to "{arg0}". /// void AutoAddRef(string arg0); @@ -34,7 +34,7 @@ partial interface IDiagnosticHandler /// The 'MainMethodFromManifest' diagnostic. /// /// -/// Using main class "{arg0}" based on jar manifest. +/// Info: Using main class "{arg0}" based on jar manifest. /// void MainMethodFromManifest(string arg0); @@ -42,7 +42,7 @@ partial interface IDiagnosticHandler /// The 'GenericCompilerInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// void GenericCompilerInfo(string arg0); @@ -50,7 +50,7 @@ partial interface IDiagnosticHandler /// The 'GenericClassLoadingInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// void GenericClassLoadingInfo(string arg0); @@ -58,7 +58,7 @@ partial interface IDiagnosticHandler /// The 'GenericVerifierInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// void GenericVerifierInfo(string arg0); @@ -66,7 +66,7 @@ partial interface IDiagnosticHandler /// The 'GenericRuntimeInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// void GenericRuntimeInfo(string arg0); @@ -74,7 +74,7 @@ partial interface IDiagnosticHandler /// The 'GenericJniInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// void GenericJniInfo(string arg0); @@ -82,7 +82,7 @@ partial interface IDiagnosticHandler /// The 'ClassNotFound' diagnostic. /// /// -/// Class "{arg0}" not found. +/// Warning: Class "{arg0}" not found. /// void ClassNotFound(string arg0); @@ -90,7 +90,7 @@ partial interface IDiagnosticHandler /// The 'ClassFormatError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (class format error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (class format error "{arg1}") /// void ClassFormatError(string arg0, string arg1); @@ -98,7 +98,7 @@ partial interface IDiagnosticHandler /// The 'DuplicateClassName' diagnostic. /// /// -/// Duplicate class name: "{arg0}". +/// Warning: Duplicate class name: "{arg0}". /// void DuplicateClassName(string arg0); @@ -106,7 +106,7 @@ partial interface IDiagnosticHandler /// The 'IllegalAccessError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (illegal access error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (illegal access error "{arg1}") /// void IllegalAccessError(string arg0, string arg1); @@ -114,7 +114,7 @@ partial interface IDiagnosticHandler /// The 'VerificationError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (verification error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (verification error "{arg1}") /// void VerificationError(string arg0, string arg1); @@ -122,7 +122,7 @@ partial interface IDiagnosticHandler /// The 'NoClassDefFoundError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (missing class "{arg1}") +/// Warning: Unable to compile class "{arg0}". (missing class "{arg1}") /// void NoClassDefFoundError(string arg0, string arg1); @@ -130,7 +130,7 @@ partial interface IDiagnosticHandler /// The 'GenericUnableToCompileError' diagnostic. /// /// -/// Unable to compile class "{arg0}". ("{arg1}": "{arg2}") +/// Warning: Unable to compile class "{arg0}". ("{arg1}": "{arg2}") /// void GenericUnableToCompileError(string arg0, string arg1, string arg2); @@ -138,7 +138,7 @@ partial interface IDiagnosticHandler /// The 'DuplicateResourceName' diagnostic. /// /// -/// Skipping resource (name clash): "{arg0}" +/// Warning: Skipping resource (name clash): "{arg0}" /// void DuplicateResourceName(string arg0); @@ -146,7 +146,7 @@ partial interface IDiagnosticHandler /// The 'SkippingReferencedClass' diagnostic. /// /// -/// Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") +/// Warning: Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") /// void SkippingReferencedClass(string arg0, string arg1); @@ -154,7 +154,7 @@ partial interface IDiagnosticHandler /// The 'NoJniRuntime' diagnostic. /// /// -/// Unable to load runtime JNI assembly. +/// Warning: Unable to load runtime JNI assembly. /// void NoJniRuntime(); @@ -162,7 +162,7 @@ partial interface IDiagnosticHandler /// The 'EmittedNoClassDefFoundError' diagnostic. /// /// -/// Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). +/// Warning: Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). /// void EmittedNoClassDefFoundError(string arg0, string arg1); @@ -170,7 +170,7 @@ partial interface IDiagnosticHandler /// The 'EmittedIllegalAccessError' diagnostic. /// /// -/// Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") /// void EmittedIllegalAccessError(string arg0, string arg1); @@ -178,7 +178,7 @@ partial interface IDiagnosticHandler /// The 'EmittedInstantiationError' diagnostic. /// /// -/// Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") /// void EmittedInstantiationError(string arg0, string arg1); @@ -186,7 +186,7 @@ partial interface IDiagnosticHandler /// The 'EmittedIncompatibleClassChangeError' diagnostic. /// /// -/// Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") /// void EmittedIncompatibleClassChangeError(string arg0, string arg1); @@ -194,7 +194,7 @@ partial interface IDiagnosticHandler /// The 'EmittedNoSuchFieldError' diagnostic. /// /// -/// Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") /// void EmittedNoSuchFieldError(string arg0, string arg1); @@ -202,7 +202,7 @@ partial interface IDiagnosticHandler /// The 'EmittedAbstractMethodError' diagnostic. /// /// -/// Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") /// void EmittedAbstractMethodError(string arg0, string arg1); @@ -210,7 +210,7 @@ partial interface IDiagnosticHandler /// The 'EmittedNoSuchMethodError' diagnostic. /// /// -/// Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") /// void EmittedNoSuchMethodError(string arg0, string arg1); @@ -218,7 +218,7 @@ partial interface IDiagnosticHandler /// The 'EmittedLinkageError' diagnostic. /// /// -/// Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") /// void EmittedLinkageError(string arg0, string arg1); @@ -226,7 +226,7 @@ partial interface IDiagnosticHandler /// The 'EmittedVerificationError' diagnostic. /// /// -/// Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") /// void EmittedVerificationError(string arg0, string arg1); @@ -234,7 +234,7 @@ partial interface IDiagnosticHandler /// The 'EmittedClassFormatError' diagnostic. /// /// -/// Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") /// void EmittedClassFormatError(string arg0, string arg1); @@ -242,7 +242,7 @@ partial interface IDiagnosticHandler /// The 'InvalidCustomAttribute' diagnostic. /// /// -/// Error emitting "{arg0}" custom attribute. ("{arg1}") +/// Warning: Error emitting "{arg0}" custom attribute. ("{arg1}") /// void InvalidCustomAttribute(string arg0, string arg1); @@ -250,7 +250,7 @@ partial interface IDiagnosticHandler /// The 'IgnoredCustomAttribute' diagnostic. /// /// -/// Custom attribute "{arg0}" was ignored. ("{arg1}") +/// Warning: Custom attribute "{arg0}" was ignored. ("{arg1}") /// void IgnoredCustomAttribute(string arg0, string arg1); @@ -258,7 +258,7 @@ partial interface IDiagnosticHandler /// The 'AssumeAssemblyVersionMatch' diagnostic. /// /// -/// Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy +/// Warning: Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy /// void AssumeAssemblyVersionMatch(string arg0, string arg1); @@ -266,7 +266,7 @@ partial interface IDiagnosticHandler /// The 'InvalidDirectoryInLibOptionPath' diagnostic. /// /// -/// Directory "{arg0}" specified in -lib option is not valid. +/// Warning: Directory "{arg0}" specified in -lib option is not valid. /// void InvalidDirectoryInLibOptionPath(string arg0); @@ -274,7 +274,7 @@ partial interface IDiagnosticHandler /// The 'InvalidDirectoryInLibEnvironmentPath' diagnostic. /// /// -/// Directory "{arg0}" specified in LIB environment is not valid. +/// Warning: Directory "{arg0}" specified in LIB environment is not valid. /// void InvalidDirectoryInLibEnvironmentPath(string arg0); @@ -282,7 +282,7 @@ partial interface IDiagnosticHandler /// The 'LegacySearchRule' diagnostic. /// /// -/// Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. +/// Warning: Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. /// void LegacySearchRule(string arg0); @@ -290,7 +290,7 @@ partial interface IDiagnosticHandler /// The 'AssemblyLocationIgnored' diagnostic. /// /// -/// Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". +/// Warning: Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". /// void AssemblyLocationIgnored(string arg0, string arg1, string arg2); @@ -298,7 +298,7 @@ partial interface IDiagnosticHandler /// The 'InterfaceMethodCantBeInternal' diagnostic. /// /// -/// Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") +/// Warning: Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") /// void InterfaceMethodCantBeInternal(string arg0, string arg1, string arg2); @@ -306,7 +306,7 @@ partial interface IDiagnosticHandler /// The 'DuplicateAssemblyReference' diagnostic. /// /// -/// Duplicate assembly reference "{arg0}" +/// Warning: Duplicate assembly reference "{arg0}" /// void DuplicateAssemblyReference(string arg0); @@ -314,7 +314,7 @@ partial interface IDiagnosticHandler /// The 'UnableToResolveType' diagnostic. /// /// -/// Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. +/// Warning: Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. /// void UnableToResolveType(string arg0, string arg1, string arg2); @@ -322,7 +322,7 @@ partial interface IDiagnosticHandler /// The 'StubsAreDeprecated' diagnostic. /// /// -/// Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. +/// Warning: Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. /// void StubsAreDeprecated(string arg0); @@ -330,7 +330,7 @@ partial interface IDiagnosticHandler /// The 'WrongClassName' diagnostic. /// /// -/// Unable to compile "{arg0}" (wrong name: "{arg1}") +/// Warning: Unable to compile "{arg0}" (wrong name: "{arg1}") /// void WrongClassName(string arg0, string arg1); @@ -338,7 +338,7 @@ partial interface IDiagnosticHandler /// The 'ReflectionCallerClassRequiresCallerID' diagnostic. /// /// -/// Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") +/// Warning: Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") /// void ReflectionCallerClassRequiresCallerID(string arg0, string arg1, string arg2); @@ -346,7 +346,7 @@ partial interface IDiagnosticHandler /// The 'LegacyAssemblyAttributesFound' diagnostic. /// /// -/// Legacy assembly attributes container found. Please use the -assemblyattributes: option. +/// Warning: Legacy assembly attributes container found. Please use the -assemblyattributes: option. /// void LegacyAssemblyAttributesFound(); @@ -354,7 +354,7 @@ partial interface IDiagnosticHandler /// The 'UnableToCreateLambdaFactory' diagnostic. /// /// -/// Unable to create static lambda factory. +/// Warning: Unable to create static lambda factory. /// void UnableToCreateLambdaFactory(); @@ -362,7 +362,7 @@ partial interface IDiagnosticHandler /// The 'UnknownWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// void UnknownWarning(string arg0); @@ -370,7 +370,7 @@ partial interface IDiagnosticHandler /// The 'DuplicateIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// void DuplicateIkvmLangProperty(string arg0, string arg1); @@ -378,7 +378,7 @@ partial interface IDiagnosticHandler /// The 'MalformedIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// void MalformedIkvmLangProperty(string arg0, string arg1); @@ -386,7 +386,7 @@ partial interface IDiagnosticHandler /// The 'GenericCompilerWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// void GenericCompilerWarning(string arg0); @@ -394,7 +394,7 @@ partial interface IDiagnosticHandler /// The 'GenericClassLoadingWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// void GenericClassLoadingWarning(string arg0); @@ -402,7 +402,7 @@ partial interface IDiagnosticHandler /// The 'GenericVerifierWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// void GenericVerifierWarning(string arg0); @@ -410,7 +410,7 @@ partial interface IDiagnosticHandler /// The 'GenericRuntimeWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// void GenericRuntimeWarning(string arg0); @@ -418,7 +418,7 @@ partial interface IDiagnosticHandler /// The 'GenericJniWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// void GenericJniWarning(string arg0); @@ -426,7 +426,7 @@ partial interface IDiagnosticHandler /// The 'UnableToCreateProxy' diagnostic. /// /// -/// Unable to create proxy "{arg0}". ("{arg1}") +/// Error: Unable to create proxy "{arg0}". ("{arg1}") /// void UnableToCreateProxy(string arg0, string arg1); @@ -434,7 +434,7 @@ partial interface IDiagnosticHandler /// The 'DuplicateProxy' diagnostic. /// /// -/// Duplicate proxy "{arg0}". +/// Error: Duplicate proxy "{arg0}". /// void DuplicateProxy(string arg0); @@ -442,7 +442,7 @@ partial interface IDiagnosticHandler /// The 'MapXmlUnableToResolveOpCode' diagnostic. /// /// -/// Unable to resolve opcode in remap file: {arg0}. +/// Error: Unable to resolve opcode in remap file: {arg0}. /// void MapXmlUnableToResolveOpCode(string arg0); @@ -450,7 +450,7 @@ partial interface IDiagnosticHandler /// The 'MapXmlError' diagnostic. /// /// -/// Error in remap file: {arg0}. +/// Error: Error in remap file: {arg0}. /// void MapXmlError(string arg0); @@ -458,7 +458,7 @@ partial interface IDiagnosticHandler /// The 'InputFileNotFound' diagnostic. /// /// -/// Source file '{arg0}' not found. +/// Error: Source file '{arg0}' not found. /// void InputFileNotFound(string arg0); @@ -466,7 +466,7 @@ partial interface IDiagnosticHandler /// The 'UnknownFileType' diagnostic. /// /// -/// Unknown file type: {arg0}. +/// Error: Unknown file type: {arg0}. /// void UnknownFileType(string arg0); @@ -474,7 +474,7 @@ partial interface IDiagnosticHandler /// The 'UnknownElementInMapFile' diagnostic. /// /// -/// Unknown element {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown element {arg0} in remap file, line {arg1}, column {arg2}. /// void UnknownElementInMapFile(string arg0, string arg1, string arg2); @@ -482,7 +482,7 @@ partial interface IDiagnosticHandler /// The 'UnknownAttributeInMapFile' diagnostic. /// /// -/// Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. /// void UnknownAttributeInMapFile(string arg0, string arg1, string arg2); @@ -490,7 +490,7 @@ partial interface IDiagnosticHandler /// The 'InvalidMemberNameInMapFile' diagnostic. /// /// -/// Invalid {arg0} name '{arg1}' in remap file in class {arg2}. +/// Error: Invalid {arg0} name '{arg1}' in remap file in class {arg2}. /// void InvalidMemberNameInMapFile(string arg0, string arg1, string arg2); @@ -498,7 +498,7 @@ partial interface IDiagnosticHandler /// The 'InvalidMemberSignatureInMapFile' diagnostic. /// /// -/// Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. +/// Error: Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. /// void InvalidMemberSignatureInMapFile(string arg0, string arg1, string arg2, string arg3); @@ -506,7 +506,7 @@ partial interface IDiagnosticHandler /// The 'InvalidPropertyNameInMapFile' diagnostic. /// /// -/// Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. /// void InvalidPropertyNameInMapFile(string arg0, string arg1, string arg2, string arg3); @@ -514,7 +514,7 @@ partial interface IDiagnosticHandler /// The 'InvalidPropertySignatureInMapFile' diagnostic. /// /// -/// Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. /// void InvalidPropertySignatureInMapFile(string arg0, string arg1, string arg2, string arg3); @@ -522,7 +522,7 @@ partial interface IDiagnosticHandler /// The 'NonPrimaryAssemblyReference' diagnostic. /// /// -/// Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. +/// Error: Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. /// void NonPrimaryAssemblyReference(string arg0, string arg1); @@ -530,7 +530,7 @@ partial interface IDiagnosticHandler /// The 'MissingType' diagnostic. /// /// -/// Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. +/// Error: Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. /// void MissingType(string arg0, string arg1); @@ -538,7 +538,7 @@ partial interface IDiagnosticHandler /// The 'MissingReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. +/// Error: The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. /// void MissingReference(string arg0, string arg1); @@ -546,7 +546,7 @@ partial interface IDiagnosticHandler /// The 'CallerSensitiveOnUnsupportedMethod' diagnostic. /// /// -/// CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") +/// Error: CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") /// void CallerSensitiveOnUnsupportedMethod(string arg0, string arg1, string arg2); @@ -554,7 +554,7 @@ partial interface IDiagnosticHandler /// The 'RemappedTypeMissingDefaultInterfaceMethod' diagnostic. /// /// -/// {arg0} does not implement default interface method {arg1}. +/// Error: {arg0} does not implement default interface method {arg1}. /// void RemappedTypeMissingDefaultInterfaceMethod(string arg0, string arg1); @@ -562,7 +562,7 @@ partial interface IDiagnosticHandler /// The 'GenericCompilerError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// void GenericCompilerError(string arg0); @@ -570,7 +570,7 @@ partial interface IDiagnosticHandler /// The 'GenericClassLoadingError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// void GenericClassLoadingError(string arg0); @@ -578,7 +578,7 @@ partial interface IDiagnosticHandler /// The 'GenericVerifierError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// void GenericVerifierError(string arg0); @@ -586,7 +586,7 @@ partial interface IDiagnosticHandler /// The 'GenericRuntimeError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// void GenericRuntimeError(string arg0); @@ -594,7 +594,7 @@ partial interface IDiagnosticHandler /// The 'GenericJniError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// void GenericJniError(string arg0); @@ -602,7 +602,7 @@ partial interface IDiagnosticHandler /// The 'ExportingImportsNotSupported' diagnostic. /// /// -/// Exporting previously imported assemblies is not supported. +/// Error: Exporting previously imported assemblies is not supported. /// void ExportingImportsNotSupported(); @@ -610,7 +610,7 @@ partial interface IDiagnosticHandler /// The 'ResponseFileDepthExceeded' diagnostic. /// /// -/// Response file nesting depth exceeded. +/// Fatal: Response file nesting depth exceeded. /// void ResponseFileDepthExceeded(); @@ -618,7 +618,7 @@ partial interface IDiagnosticHandler /// The 'ErrorReadingFile' diagnostic. /// /// -/// Unable to read file: {arg0}. ({arg1}) +/// Fatal: Unable to read file: {arg0}. ({arg1}) /// void ErrorReadingFile(string arg0, string arg1); @@ -626,7 +626,7 @@ partial interface IDiagnosticHandler /// The 'NoTargetsFound' diagnostic. /// /// -/// No targets found +/// Fatal: No targets found /// void NoTargetsFound(); @@ -634,7 +634,7 @@ partial interface IDiagnosticHandler /// The 'FileFormatLimitationExceeded' diagnostic. /// /// -/// File format limitation exceeded: {arg0}. +/// Fatal: File format limitation exceeded: {arg0}. /// void FileFormatLimitationExceeded(string arg0); @@ -642,7 +642,7 @@ partial interface IDiagnosticHandler /// The 'CannotSpecifyBothKeyFileAndContainer' diagnostic. /// /// -/// You cannot specify both a key file and container. +/// Fatal: You cannot specify both a key file and container. /// void CannotSpecifyBothKeyFileAndContainer(); @@ -650,7 +650,7 @@ partial interface IDiagnosticHandler /// The 'DelaySignRequiresKey' diagnostic. /// /// -/// You cannot delay sign without a key file or container. +/// Fatal: You cannot delay sign without a key file or container. /// void DelaySignRequiresKey(); @@ -658,7 +658,7 @@ partial interface IDiagnosticHandler /// The 'InvalidStrongNameKeyPair' diagnostic. /// /// -/// Invalid key {arg0} specified. ("{arg1}") +/// Fatal: Invalid key {arg0} specified. ("{arg1}") /// void InvalidStrongNameKeyPair(string arg0, string arg1); @@ -666,7 +666,7 @@ partial interface IDiagnosticHandler /// The 'ReferenceNotFound' diagnostic. /// /// -/// Reference not found: {arg0} +/// Fatal: Reference not found: {arg0} /// void ReferenceNotFound(string arg0); @@ -674,7 +674,7 @@ partial interface IDiagnosticHandler /// The 'OptionsMustPreceedChildLevels' diagnostic. /// /// -/// You can only specify options before any child levels. +/// Fatal: You can only specify options before any child levels. /// void OptionsMustPreceedChildLevels(); @@ -682,7 +682,7 @@ partial interface IDiagnosticHandler /// The 'UnrecognizedTargetType' diagnostic. /// /// -/// Invalid value '{arg0}' for -target option. +/// Fatal: Invalid value '{arg0}' for -target option. /// void UnrecognizedTargetType(string arg0); @@ -690,7 +690,7 @@ partial interface IDiagnosticHandler /// The 'UnrecognizedPlatform' diagnostic. /// /// -/// Invalid value '{arg0}' for -platform option. +/// Fatal: Invalid value '{arg0}' for -platform option. /// void UnrecognizedPlatform(string arg0); @@ -698,7 +698,7 @@ partial interface IDiagnosticHandler /// The 'UnrecognizedApartment' diagnostic. /// /// -/// Invalid value '{arg0}' for -apartment option. +/// Fatal: Invalid value '{arg0}' for -apartment option. /// void UnrecognizedApartment(string arg0); @@ -706,7 +706,7 @@ partial interface IDiagnosticHandler /// The 'MissingFileSpecification' diagnostic. /// /// -/// Missing file specification for '{arg0}' option. +/// Fatal: Missing file specification for '{arg0}' option. /// void MissingFileSpecification(string arg0); @@ -714,7 +714,7 @@ partial interface IDiagnosticHandler /// The 'PathTooLong' diagnostic. /// /// -/// Path too long: {arg0}. +/// Fatal: Path too long: {arg0}. /// void PathTooLong(string arg0); @@ -722,7 +722,7 @@ partial interface IDiagnosticHandler /// The 'PathNotFound' diagnostic. /// /// -/// Path not found: {arg0}. +/// Fatal: Path not found: {arg0}. /// void PathNotFound(string arg0); @@ -730,7 +730,7 @@ partial interface IDiagnosticHandler /// The 'InvalidPath' diagnostic. /// /// -/// Invalid path: {arg0}. +/// Fatal: Invalid path: {arg0}. /// void InvalidPath(string arg0); @@ -738,7 +738,7 @@ partial interface IDiagnosticHandler /// The 'InvalidOptionSyntax' diagnostic. /// /// -/// Invalid option: {arg0}. +/// Fatal: Invalid option: {arg0}. /// void InvalidOptionSyntax(string arg0); @@ -746,7 +746,7 @@ partial interface IDiagnosticHandler /// The 'ExternalResourceNotFound' diagnostic. /// /// -/// External resource file does not exist: {arg0}. +/// Fatal: External resource file does not exist: {arg0}. /// void ExternalResourceNotFound(string arg0); @@ -754,7 +754,7 @@ partial interface IDiagnosticHandler /// The 'ExternalResourceNameInvalid' diagnostic. /// /// -/// External resource file may not include path specification: {arg0}. +/// Fatal: External resource file may not include path specification: {arg0}. /// void ExternalResourceNameInvalid(string arg0); @@ -762,7 +762,7 @@ partial interface IDiagnosticHandler /// The 'InvalidVersionFormat' diagnostic. /// /// -/// Invalid version specified: {arg0}. +/// Fatal: Invalid version specified: {arg0}. /// void InvalidVersionFormat(string arg0); @@ -770,7 +770,7 @@ partial interface IDiagnosticHandler /// The 'InvalidFileAlignment' diagnostic. /// /// -/// Invalid value '{arg0}' for -filealign option. +/// Fatal: Invalid value '{arg0}' for -filealign option. /// void InvalidFileAlignment(string arg0); @@ -778,7 +778,7 @@ partial interface IDiagnosticHandler /// The 'ErrorWritingFile' diagnostic. /// /// -/// Unable to write file: {arg0}. ({arg1}) +/// Fatal: Unable to write file: {arg0}. ({arg1}) /// void ErrorWritingFile(string arg0, string arg1); @@ -786,7 +786,7 @@ partial interface IDiagnosticHandler /// The 'UnrecognizedOption' diagnostic. /// /// -/// Unrecognized option: {arg0}. +/// Fatal: Unrecognized option: {arg0}. /// void UnrecognizedOption(string arg0); @@ -794,7 +794,7 @@ partial interface IDiagnosticHandler /// The 'NoOutputFileSpecified' diagnostic. /// /// -/// No output file specified. +/// Fatal: No output file specified. /// void NoOutputFileSpecified(); @@ -802,7 +802,7 @@ partial interface IDiagnosticHandler /// The 'SharedClassLoaderCannotBeUsedOnModuleTarget' diagnostic. /// /// -/// Incompatible options: -target:module and -sharedclassloader cannot be combined. +/// Fatal: Incompatible options: -target:module and -sharedclassloader cannot be combined. /// void SharedClassLoaderCannotBeUsedOnModuleTarget(); @@ -810,7 +810,7 @@ partial interface IDiagnosticHandler /// The 'RuntimeNotFound' diagnostic. /// /// -/// Unable to load runtime assembly. +/// Fatal: Unable to load runtime assembly. /// void RuntimeNotFound(); @@ -818,7 +818,7 @@ partial interface IDiagnosticHandler /// The 'MainClassRequiresExe' diagnostic. /// /// -/// Main class cannot be specified for library or module. +/// Fatal: Main class cannot be specified for library or module. /// void MainClassRequiresExe(); @@ -826,7 +826,7 @@ partial interface IDiagnosticHandler /// The 'ExeRequiresMainClass' diagnostic. /// /// -/// No main method found. +/// Fatal: No main method found. /// void ExeRequiresMainClass(); @@ -834,7 +834,7 @@ partial interface IDiagnosticHandler /// The 'PropertiesRequireExe' diagnostic. /// /// -/// Properties cannot be specified for library or module. +/// Fatal: Properties cannot be specified for library or module. /// void PropertiesRequireExe(); @@ -842,7 +842,7 @@ partial interface IDiagnosticHandler /// The 'ModuleCannotHaveClassLoader' diagnostic. /// /// -/// Cannot specify assembly class loader for modules. +/// Fatal: Cannot specify assembly class loader for modules. /// void ModuleCannotHaveClassLoader(); @@ -850,7 +850,7 @@ partial interface IDiagnosticHandler /// The 'ErrorParsingMapFile' diagnostic. /// /// -/// Unable to parse remap file: {arg0}. ({arg1}) +/// Fatal: Unable to parse remap file: {arg0}. ({arg1}) /// void ErrorParsingMapFile(string arg0, string arg1); @@ -858,7 +858,7 @@ partial interface IDiagnosticHandler /// The 'BootstrapClassesMissing' diagnostic. /// /// -/// Bootstrap classes missing and core assembly not found. +/// Fatal: Bootstrap classes missing and core assembly not found. /// void BootstrapClassesMissing(); @@ -866,7 +866,7 @@ partial interface IDiagnosticHandler /// The 'StrongNameRequiresStrongNamedRefs' diagnostic. /// /// -/// All referenced assemblies must be strong named, to be able to sign the output assembly. +/// Fatal: All referenced assemblies must be strong named, to be able to sign the output assembly. /// void StrongNameRequiresStrongNamedRefs(); @@ -874,7 +874,7 @@ partial interface IDiagnosticHandler /// The 'MainClassNotFound' diagnostic. /// /// -/// Main class not found. +/// Fatal: Main class not found. /// void MainClassNotFound(); @@ -882,7 +882,7 @@ partial interface IDiagnosticHandler /// The 'MainMethodNotFound' diagnostic. /// /// -/// Main method not found. +/// Fatal: Main method not found. /// void MainMethodNotFound(); @@ -890,7 +890,7 @@ partial interface IDiagnosticHandler /// The 'UnsupportedMainMethod' diagnostic. /// /// -/// Redirected main method not supported. +/// Fatal: Redirected main method not supported. /// void UnsupportedMainMethod(); @@ -898,7 +898,7 @@ partial interface IDiagnosticHandler /// The 'ExternalMainNotAccessible' diagnostic. /// /// -/// External main method must be public and in a public class. +/// Fatal: External main method must be public and in a public class. /// void ExternalMainNotAccessible(); @@ -906,7 +906,7 @@ partial interface IDiagnosticHandler /// The 'ClassLoaderNotFound' diagnostic. /// /// -/// Custom assembly class loader class not found. +/// Fatal: Custom assembly class loader class not found. /// void ClassLoaderNotFound(); @@ -914,7 +914,7 @@ partial interface IDiagnosticHandler /// The 'ClassLoaderNotAccessible' diagnostic. /// /// -/// Custom assembly class loader class is not accessible. +/// Fatal: Custom assembly class loader class is not accessible. /// void ClassLoaderNotAccessible(); @@ -922,7 +922,7 @@ partial interface IDiagnosticHandler /// The 'ClassLoaderIsAbstract' diagnostic. /// /// -/// Custom assembly class loader class is abstract. +/// Fatal: Custom assembly class loader class is abstract. /// void ClassLoaderIsAbstract(); @@ -930,7 +930,7 @@ partial interface IDiagnosticHandler /// The 'ClassLoaderNotClassLoader' diagnostic. /// /// -/// Custom assembly class loader class does not extend java.lang.ClassLoader. +/// Fatal: Custom assembly class loader class does not extend java.lang.ClassLoader. /// void ClassLoaderNotClassLoader(); @@ -938,7 +938,7 @@ partial interface IDiagnosticHandler /// The 'ClassLoaderConstructorMissing' diagnostic. /// /// -/// Custom assembly class loader constructor is missing. +/// Fatal: Custom assembly class loader constructor is missing. /// void ClassLoaderConstructorMissing(); @@ -946,7 +946,7 @@ partial interface IDiagnosticHandler /// The 'MapFileTypeNotFound' diagnostic. /// /// -/// Type '{arg0}' referenced in remap file was not found. +/// Fatal: Type '{arg0}' referenced in remap file was not found. /// void MapFileTypeNotFound(string arg0); @@ -954,7 +954,7 @@ partial interface IDiagnosticHandler /// The 'MapFileClassNotFound' diagnostic. /// /// -/// Class '{arg0}' referenced in remap file was not found. +/// Fatal: Class '{arg0}' referenced in remap file was not found. /// void MapFileClassNotFound(string arg0); @@ -962,7 +962,7 @@ partial interface IDiagnosticHandler /// The 'MaximumErrorCountReached' diagnostic. /// /// -/// Maximum error count reached. +/// Fatal: Maximum error count reached. /// void MaximumErrorCountReached(); @@ -970,7 +970,7 @@ partial interface IDiagnosticHandler /// The 'LinkageError' diagnostic. /// /// -/// Link error: {arg0} +/// Fatal: Link error: {arg0} /// void LinkageError(string arg0); @@ -978,7 +978,7 @@ partial interface IDiagnosticHandler /// The 'RuntimeMismatch' diagnostic. /// /// -/// Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} +/// Fatal: Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} /// void RuntimeMismatch(string referencedAssemblyPath, string runtimeAssemblyName, string referencedAssemblyName); @@ -986,7 +986,7 @@ partial interface IDiagnosticHandler /// The 'RuntimeMismatchStrongName' diagnostic. /// /// -/// +/// Fatal: /// void RuntimeMismatchStrongName(); @@ -994,7 +994,7 @@ partial interface IDiagnosticHandler /// The 'CoreClassesMissing' diagnostic. /// /// -/// Failed to find core classes in core library. +/// Fatal: Failed to find core classes in core library. /// void CoreClassesMissing(); @@ -1002,7 +1002,7 @@ partial interface IDiagnosticHandler /// The 'CriticalClassNotFound' diagnostic. /// /// -/// Unable to load critical class '{arg0}'. +/// Fatal: Unable to load critical class '{arg0}'. /// void CriticalClassNotFound(string arg0); @@ -1010,7 +1010,7 @@ partial interface IDiagnosticHandler /// The 'AssemblyContainsDuplicateClassNames' diagnostic. /// /// -/// Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) +/// Fatal: Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) /// void AssemblyContainsDuplicateClassNames(string arg0, string arg1, string arg2, string arg3); @@ -1018,7 +1018,7 @@ partial interface IDiagnosticHandler /// The 'CallerIDRequiresHasCallerIDAnnotation' diagnostic. /// /// -/// CallerID.getCallerID() requires a HasCallerID annotation. +/// Fatal: CallerID.getCallerID() requires a HasCallerID annotation. /// void CallerIDRequiresHasCallerIDAnnotation(); @@ -1026,7 +1026,7 @@ partial interface IDiagnosticHandler /// The 'UnableToResolveInterface' diagnostic. /// /// -/// Unable to resolve interface '{arg0}' on type '{arg1}'. +/// Fatal: Unable to resolve interface '{arg0}' on type '{arg1}'. /// void UnableToResolveInterface(string arg0, string arg1); @@ -1034,7 +1034,7 @@ partial interface IDiagnosticHandler /// The 'MissingBaseType' diagnostic. /// /// -/// The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. +/// Fatal: The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. /// void MissingBaseType(string arg0, string arg1, string arg2, string arg3); @@ -1042,7 +1042,7 @@ partial interface IDiagnosticHandler /// The 'MissingBaseTypeReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. +/// Fatal: The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. /// void MissingBaseTypeReference(string arg0, string arg1); @@ -1050,7 +1050,7 @@ partial interface IDiagnosticHandler /// The 'FileNotFound' diagnostic. /// /// -/// File not found: {arg0}. +/// Fatal: File not found: {arg0}. /// void FileNotFound(string arg0); @@ -1058,7 +1058,7 @@ partial interface IDiagnosticHandler /// The 'RuntimeMethodMissing' diagnostic. /// /// -/// Runtime method '{arg0}' not found. +/// Fatal: Runtime method '{arg0}' not found. /// void RuntimeMethodMissing(string arg0); @@ -1066,7 +1066,7 @@ partial interface IDiagnosticHandler /// The 'MapFileFieldNotFound' diagnostic. /// /// -/// Field '{arg0}' referenced in remap file was not found in class '{arg1}'. +/// Fatal: Field '{arg0}' referenced in remap file was not found in class '{arg1}'. /// void MapFileFieldNotFound(string arg0, string arg1); @@ -1074,7 +1074,7 @@ partial interface IDiagnosticHandler /// The 'GhostInterfaceMethodMissing' diagnostic. /// /// -/// Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) +/// Fatal: Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) /// void GhostInterfaceMethodMissing(string arg0, string arg1, string arg2, string arg3); @@ -1082,7 +1082,7 @@ partial interface IDiagnosticHandler /// The 'ModuleInitializerMethodRequirements' diagnostic. /// /// -/// Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. +/// Fatal: Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. /// void ModuleInitializerMethodRequirements(string arg1, string arg2, string arg3); @@ -1090,15 +1090,23 @@ partial interface IDiagnosticHandler /// The 'InvalidZip' diagnostic. /// /// -/// Invalid zip: {name}. +/// Fatal: Invalid zip: {name}. /// void InvalidZip(string name); + /// + /// The 'CoreAssemblyVersionMismatch' diagnostic. + /// + /// +/// Fatal: Unable to load assembly '{0}' as it depends on a higher version of {1} than the one currently loaded. + /// + void CoreAssemblyVersionMismatch(string arg0, string arg1); + /// /// The 'GenericRuntimeTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// void GenericRuntimeTrace(string arg0); @@ -1106,7 +1114,7 @@ partial interface IDiagnosticHandler /// The 'GenericJniTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// void GenericJniTrace(string arg0); @@ -1114,7 +1122,7 @@ partial interface IDiagnosticHandler /// The 'GenericCompilerTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// void GenericCompilerTrace(string arg0); diff --git a/src/IKVM.CoreLib/Diagnostics/IDiagnosticHandler.g.tt b/src/IKVM.CoreLib/Diagnostics/IDiagnosticHandler.g.tt index 947391123f..4708f92331 100644 --- a/src/IKVM.CoreLib/Diagnostics/IDiagnosticHandler.g.tt +++ b/src/IKVM.CoreLib/Diagnostics/IDiagnosticHandler.g.tt @@ -41,7 +41,7 @@ foreach (var kvp in DiagnosticFile.Read(Host.ResolvePath(Path.Combine("Diagnosti /// <#= desc #> /// /// -<#= Util.ToCommentString(kvp.Value.Message ?? "") #> +<#= Util.ToCommentString(kvp.Value) #> /// void <#= kvp.Key #>(<#= string.Join(", ", argList) #>); diff --git a/src/IKVM.CoreLib/Diagnostics/NullDiagnosticHandler.g.cs b/src/IKVM.CoreLib/Diagnostics/NullDiagnosticHandler.g.cs index 8a20d769a1..77f88e4dbf 100644 --- a/src/IKVM.CoreLib/Diagnostics/NullDiagnosticHandler.g.cs +++ b/src/IKVM.CoreLib/Diagnostics/NullDiagnosticHandler.g.cs @@ -10,7 +10,7 @@ partial class NullDiagnosticHandler /// The 'MainMethodFound' diagnostic. /// /// -/// Found main method in class "{arg0}". +/// Info: Found main method in class "{arg0}". /// public void MainMethodFound(string arg0) { @@ -21,7 +21,7 @@ public void MainMethodFound(string arg0) /// The 'OutputFileIs' diagnostic. /// /// -/// Output file is "{arg0}". +/// Info: Output file is "{arg0}". /// public void OutputFileIs(string arg0) { @@ -32,7 +32,7 @@ public void OutputFileIs(string arg0) /// The 'AutoAddRef' diagnostic. /// /// -/// Automatically adding reference to "{arg0}". +/// Info: Automatically adding reference to "{arg0}". /// public void AutoAddRef(string arg0) { @@ -43,7 +43,7 @@ public void AutoAddRef(string arg0) /// The 'MainMethodFromManifest' diagnostic. /// /// -/// Using main class "{arg0}" based on jar manifest. +/// Info: Using main class "{arg0}" based on jar manifest. /// public void MainMethodFromManifest(string arg0) { @@ -54,7 +54,7 @@ public void MainMethodFromManifest(string arg0) /// The 'GenericCompilerInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericCompilerInfo(string arg0) { @@ -65,7 +65,7 @@ public void GenericCompilerInfo(string arg0) /// The 'GenericClassLoadingInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericClassLoadingInfo(string arg0) { @@ -76,7 +76,7 @@ public void GenericClassLoadingInfo(string arg0) /// The 'GenericVerifierInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericVerifierInfo(string arg0) { @@ -87,7 +87,7 @@ public void GenericVerifierInfo(string arg0) /// The 'GenericRuntimeInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericRuntimeInfo(string arg0) { @@ -98,7 +98,7 @@ public void GenericRuntimeInfo(string arg0) /// The 'GenericJniInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// public void GenericJniInfo(string arg0) { @@ -109,7 +109,7 @@ public void GenericJniInfo(string arg0) /// The 'ClassNotFound' diagnostic. /// /// -/// Class "{arg0}" not found. +/// Warning: Class "{arg0}" not found. /// public void ClassNotFound(string arg0) { @@ -120,7 +120,7 @@ public void ClassNotFound(string arg0) /// The 'ClassFormatError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (class format error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (class format error "{arg1}") /// public void ClassFormatError(string arg0, string arg1) { @@ -131,7 +131,7 @@ public void ClassFormatError(string arg0, string arg1) /// The 'DuplicateClassName' diagnostic. /// /// -/// Duplicate class name: "{arg0}". +/// Warning: Duplicate class name: "{arg0}". /// public void DuplicateClassName(string arg0) { @@ -142,7 +142,7 @@ public void DuplicateClassName(string arg0) /// The 'IllegalAccessError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (illegal access error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (illegal access error "{arg1}") /// public void IllegalAccessError(string arg0, string arg1) { @@ -153,7 +153,7 @@ public void IllegalAccessError(string arg0, string arg1) /// The 'VerificationError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (verification error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (verification error "{arg1}") /// public void VerificationError(string arg0, string arg1) { @@ -164,7 +164,7 @@ public void VerificationError(string arg0, string arg1) /// The 'NoClassDefFoundError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (missing class "{arg1}") +/// Warning: Unable to compile class "{arg0}". (missing class "{arg1}") /// public void NoClassDefFoundError(string arg0, string arg1) { @@ -175,7 +175,7 @@ public void NoClassDefFoundError(string arg0, string arg1) /// The 'GenericUnableToCompileError' diagnostic. /// /// -/// Unable to compile class "{arg0}". ("{arg1}": "{arg2}") +/// Warning: Unable to compile class "{arg0}". ("{arg1}": "{arg2}") /// public void GenericUnableToCompileError(string arg0, string arg1, string arg2) { @@ -186,7 +186,7 @@ public void GenericUnableToCompileError(string arg0, string arg1, string arg2) /// The 'DuplicateResourceName' diagnostic. /// /// -/// Skipping resource (name clash): "{arg0}" +/// Warning: Skipping resource (name clash): "{arg0}" /// public void DuplicateResourceName(string arg0) { @@ -197,7 +197,7 @@ public void DuplicateResourceName(string arg0) /// The 'SkippingReferencedClass' diagnostic. /// /// -/// Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") +/// Warning: Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") /// public void SkippingReferencedClass(string arg0, string arg1) { @@ -208,7 +208,7 @@ public void SkippingReferencedClass(string arg0, string arg1) /// The 'NoJniRuntime' diagnostic. /// /// -/// Unable to load runtime JNI assembly. +/// Warning: Unable to load runtime JNI assembly. /// public void NoJniRuntime() { @@ -219,7 +219,7 @@ public void NoJniRuntime() /// The 'EmittedNoClassDefFoundError' diagnostic. /// /// -/// Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). +/// Warning: Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). /// public void EmittedNoClassDefFoundError(string arg0, string arg1) { @@ -230,7 +230,7 @@ public void EmittedNoClassDefFoundError(string arg0, string arg1) /// The 'EmittedIllegalAccessError' diagnostic. /// /// -/// Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") /// public void EmittedIllegalAccessError(string arg0, string arg1) { @@ -241,7 +241,7 @@ public void EmittedIllegalAccessError(string arg0, string arg1) /// The 'EmittedInstantiationError' diagnostic. /// /// -/// Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") /// public void EmittedInstantiationError(string arg0, string arg1) { @@ -252,7 +252,7 @@ public void EmittedInstantiationError(string arg0, string arg1) /// The 'EmittedIncompatibleClassChangeError' diagnostic. /// /// -/// Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") /// public void EmittedIncompatibleClassChangeError(string arg0, string arg1) { @@ -263,7 +263,7 @@ public void EmittedIncompatibleClassChangeError(string arg0, string arg1) /// The 'EmittedNoSuchFieldError' diagnostic. /// /// -/// Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") /// public void EmittedNoSuchFieldError(string arg0, string arg1) { @@ -274,7 +274,7 @@ public void EmittedNoSuchFieldError(string arg0, string arg1) /// The 'EmittedAbstractMethodError' diagnostic. /// /// -/// Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") /// public void EmittedAbstractMethodError(string arg0, string arg1) { @@ -285,7 +285,7 @@ public void EmittedAbstractMethodError(string arg0, string arg1) /// The 'EmittedNoSuchMethodError' diagnostic. /// /// -/// Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") /// public void EmittedNoSuchMethodError(string arg0, string arg1) { @@ -296,7 +296,7 @@ public void EmittedNoSuchMethodError(string arg0, string arg1) /// The 'EmittedLinkageError' diagnostic. /// /// -/// Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") /// public void EmittedLinkageError(string arg0, string arg1) { @@ -307,7 +307,7 @@ public void EmittedLinkageError(string arg0, string arg1) /// The 'EmittedVerificationError' diagnostic. /// /// -/// Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") /// public void EmittedVerificationError(string arg0, string arg1) { @@ -318,7 +318,7 @@ public void EmittedVerificationError(string arg0, string arg1) /// The 'EmittedClassFormatError' diagnostic. /// /// -/// Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") /// public void EmittedClassFormatError(string arg0, string arg1) { @@ -329,7 +329,7 @@ public void EmittedClassFormatError(string arg0, string arg1) /// The 'InvalidCustomAttribute' diagnostic. /// /// -/// Error emitting "{arg0}" custom attribute. ("{arg1}") +/// Warning: Error emitting "{arg0}" custom attribute. ("{arg1}") /// public void InvalidCustomAttribute(string arg0, string arg1) { @@ -340,7 +340,7 @@ public void InvalidCustomAttribute(string arg0, string arg1) /// The 'IgnoredCustomAttribute' diagnostic. /// /// -/// Custom attribute "{arg0}" was ignored. ("{arg1}") +/// Warning: Custom attribute "{arg0}" was ignored. ("{arg1}") /// public void IgnoredCustomAttribute(string arg0, string arg1) { @@ -351,7 +351,7 @@ public void IgnoredCustomAttribute(string arg0, string arg1) /// The 'AssumeAssemblyVersionMatch' diagnostic. /// /// -/// Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy +/// Warning: Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy /// public void AssumeAssemblyVersionMatch(string arg0, string arg1) { @@ -362,7 +362,7 @@ public void AssumeAssemblyVersionMatch(string arg0, string arg1) /// The 'InvalidDirectoryInLibOptionPath' diagnostic. /// /// -/// Directory "{arg0}" specified in -lib option is not valid. +/// Warning: Directory "{arg0}" specified in -lib option is not valid. /// public void InvalidDirectoryInLibOptionPath(string arg0) { @@ -373,7 +373,7 @@ public void InvalidDirectoryInLibOptionPath(string arg0) /// The 'InvalidDirectoryInLibEnvironmentPath' diagnostic. /// /// -/// Directory "{arg0}" specified in LIB environment is not valid. +/// Warning: Directory "{arg0}" specified in LIB environment is not valid. /// public void InvalidDirectoryInLibEnvironmentPath(string arg0) { @@ -384,7 +384,7 @@ public void InvalidDirectoryInLibEnvironmentPath(string arg0) /// The 'LegacySearchRule' diagnostic. /// /// -/// Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. +/// Warning: Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. /// public void LegacySearchRule(string arg0) { @@ -395,7 +395,7 @@ public void LegacySearchRule(string arg0) /// The 'AssemblyLocationIgnored' diagnostic. /// /// -/// Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". +/// Warning: Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". /// public void AssemblyLocationIgnored(string arg0, string arg1, string arg2) { @@ -406,7 +406,7 @@ public void AssemblyLocationIgnored(string arg0, string arg1, string arg2) /// The 'InterfaceMethodCantBeInternal' diagnostic. /// /// -/// Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") +/// Warning: Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") /// public void InterfaceMethodCantBeInternal(string arg0, string arg1, string arg2) { @@ -417,7 +417,7 @@ public void InterfaceMethodCantBeInternal(string arg0, string arg1, string arg2) /// The 'DuplicateAssemblyReference' diagnostic. /// /// -/// Duplicate assembly reference "{arg0}" +/// Warning: Duplicate assembly reference "{arg0}" /// public void DuplicateAssemblyReference(string arg0) { @@ -428,7 +428,7 @@ public void DuplicateAssemblyReference(string arg0) /// The 'UnableToResolveType' diagnostic. /// /// -/// Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. +/// Warning: Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. /// public void UnableToResolveType(string arg0, string arg1, string arg2) { @@ -439,7 +439,7 @@ public void UnableToResolveType(string arg0, string arg1, string arg2) /// The 'StubsAreDeprecated' diagnostic. /// /// -/// Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. +/// Warning: Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. /// public void StubsAreDeprecated(string arg0) { @@ -450,7 +450,7 @@ public void StubsAreDeprecated(string arg0) /// The 'WrongClassName' diagnostic. /// /// -/// Unable to compile "{arg0}" (wrong name: "{arg1}") +/// Warning: Unable to compile "{arg0}" (wrong name: "{arg1}") /// public void WrongClassName(string arg0, string arg1) { @@ -461,7 +461,7 @@ public void WrongClassName(string arg0, string arg1) /// The 'ReflectionCallerClassRequiresCallerID' diagnostic. /// /// -/// Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") +/// Warning: Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") /// public void ReflectionCallerClassRequiresCallerID(string arg0, string arg1, string arg2) { @@ -472,7 +472,7 @@ public void ReflectionCallerClassRequiresCallerID(string arg0, string arg1, stri /// The 'LegacyAssemblyAttributesFound' diagnostic. /// /// -/// Legacy assembly attributes container found. Please use the -assemblyattributes: option. +/// Warning: Legacy assembly attributes container found. Please use the -assemblyattributes: option. /// public void LegacyAssemblyAttributesFound() { @@ -483,7 +483,7 @@ public void LegacyAssemblyAttributesFound() /// The 'UnableToCreateLambdaFactory' diagnostic. /// /// -/// Unable to create static lambda factory. +/// Warning: Unable to create static lambda factory. /// public void UnableToCreateLambdaFactory() { @@ -494,7 +494,7 @@ public void UnableToCreateLambdaFactory() /// The 'UnknownWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void UnknownWarning(string arg0) { @@ -505,7 +505,7 @@ public void UnknownWarning(string arg0) /// The 'DuplicateIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// public void DuplicateIkvmLangProperty(string arg0, string arg1) { @@ -516,7 +516,7 @@ public void DuplicateIkvmLangProperty(string arg0, string arg1) /// The 'MalformedIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// public void MalformedIkvmLangProperty(string arg0, string arg1) { @@ -527,7 +527,7 @@ public void MalformedIkvmLangProperty(string arg0, string arg1) /// The 'GenericCompilerWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericCompilerWarning(string arg0) { @@ -538,7 +538,7 @@ public void GenericCompilerWarning(string arg0) /// The 'GenericClassLoadingWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericClassLoadingWarning(string arg0) { @@ -549,7 +549,7 @@ public void GenericClassLoadingWarning(string arg0) /// The 'GenericVerifierWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericVerifierWarning(string arg0) { @@ -560,7 +560,7 @@ public void GenericVerifierWarning(string arg0) /// The 'GenericRuntimeWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericRuntimeWarning(string arg0) { @@ -571,7 +571,7 @@ public void GenericRuntimeWarning(string arg0) /// The 'GenericJniWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// public void GenericJniWarning(string arg0) { @@ -582,7 +582,7 @@ public void GenericJniWarning(string arg0) /// The 'UnableToCreateProxy' diagnostic. /// /// -/// Unable to create proxy "{arg0}". ("{arg1}") +/// Error: Unable to create proxy "{arg0}". ("{arg1}") /// public void UnableToCreateProxy(string arg0, string arg1) { @@ -593,7 +593,7 @@ public void UnableToCreateProxy(string arg0, string arg1) /// The 'DuplicateProxy' diagnostic. /// /// -/// Duplicate proxy "{arg0}". +/// Error: Duplicate proxy "{arg0}". /// public void DuplicateProxy(string arg0) { @@ -604,7 +604,7 @@ public void DuplicateProxy(string arg0) /// The 'MapXmlUnableToResolveOpCode' diagnostic. /// /// -/// Unable to resolve opcode in remap file: {arg0}. +/// Error: Unable to resolve opcode in remap file: {arg0}. /// public void MapXmlUnableToResolveOpCode(string arg0) { @@ -615,7 +615,7 @@ public void MapXmlUnableToResolveOpCode(string arg0) /// The 'MapXmlError' diagnostic. /// /// -/// Error in remap file: {arg0}. +/// Error: Error in remap file: {arg0}. /// public void MapXmlError(string arg0) { @@ -626,7 +626,7 @@ public void MapXmlError(string arg0) /// The 'InputFileNotFound' diagnostic. /// /// -/// Source file '{arg0}' not found. +/// Error: Source file '{arg0}' not found. /// public void InputFileNotFound(string arg0) { @@ -637,7 +637,7 @@ public void InputFileNotFound(string arg0) /// The 'UnknownFileType' diagnostic. /// /// -/// Unknown file type: {arg0}. +/// Error: Unknown file type: {arg0}. /// public void UnknownFileType(string arg0) { @@ -648,7 +648,7 @@ public void UnknownFileType(string arg0) /// The 'UnknownElementInMapFile' diagnostic. /// /// -/// Unknown element {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown element {arg0} in remap file, line {arg1}, column {arg2}. /// public void UnknownElementInMapFile(string arg0, string arg1, string arg2) { @@ -659,7 +659,7 @@ public void UnknownElementInMapFile(string arg0, string arg1, string arg2) /// The 'UnknownAttributeInMapFile' diagnostic. /// /// -/// Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. /// public void UnknownAttributeInMapFile(string arg0, string arg1, string arg2) { @@ -670,7 +670,7 @@ public void UnknownAttributeInMapFile(string arg0, string arg1, string arg2) /// The 'InvalidMemberNameInMapFile' diagnostic. /// /// -/// Invalid {arg0} name '{arg1}' in remap file in class {arg2}. +/// Error: Invalid {arg0} name '{arg1}' in remap file in class {arg2}. /// public void InvalidMemberNameInMapFile(string arg0, string arg1, string arg2) { @@ -681,7 +681,7 @@ public void InvalidMemberNameInMapFile(string arg0, string arg1, string arg2) /// The 'InvalidMemberSignatureInMapFile' diagnostic. /// /// -/// Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. +/// Error: Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. /// public void InvalidMemberSignatureInMapFile(string arg0, string arg1, string arg2, string arg3) { @@ -692,7 +692,7 @@ public void InvalidMemberSignatureInMapFile(string arg0, string arg1, string arg /// The 'InvalidPropertyNameInMapFile' diagnostic. /// /// -/// Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. /// public void InvalidPropertyNameInMapFile(string arg0, string arg1, string arg2, string arg3) { @@ -703,7 +703,7 @@ public void InvalidPropertyNameInMapFile(string arg0, string arg1, string arg2, /// The 'InvalidPropertySignatureInMapFile' diagnostic. /// /// -/// Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. /// public void InvalidPropertySignatureInMapFile(string arg0, string arg1, string arg2, string arg3) { @@ -714,7 +714,7 @@ public void InvalidPropertySignatureInMapFile(string arg0, string arg1, string a /// The 'NonPrimaryAssemblyReference' diagnostic. /// /// -/// Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. +/// Error: Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. /// public void NonPrimaryAssemblyReference(string arg0, string arg1) { @@ -725,7 +725,7 @@ public void NonPrimaryAssemblyReference(string arg0, string arg1) /// The 'MissingType' diagnostic. /// /// -/// Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. +/// Error: Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. /// public void MissingType(string arg0, string arg1) { @@ -736,7 +736,7 @@ public void MissingType(string arg0, string arg1) /// The 'MissingReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. +/// Error: The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. /// public void MissingReference(string arg0, string arg1) { @@ -747,7 +747,7 @@ public void MissingReference(string arg0, string arg1) /// The 'CallerSensitiveOnUnsupportedMethod' diagnostic. /// /// -/// CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") +/// Error: CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") /// public void CallerSensitiveOnUnsupportedMethod(string arg0, string arg1, string arg2) { @@ -758,7 +758,7 @@ public void CallerSensitiveOnUnsupportedMethod(string arg0, string arg1, string /// The 'RemappedTypeMissingDefaultInterfaceMethod' diagnostic. /// /// -/// {arg0} does not implement default interface method {arg1}. +/// Error: {arg0} does not implement default interface method {arg1}. /// public void RemappedTypeMissingDefaultInterfaceMethod(string arg0, string arg1) { @@ -769,7 +769,7 @@ public void RemappedTypeMissingDefaultInterfaceMethod(string arg0, string arg1) /// The 'GenericCompilerError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericCompilerError(string arg0) { @@ -780,7 +780,7 @@ public void GenericCompilerError(string arg0) /// The 'GenericClassLoadingError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericClassLoadingError(string arg0) { @@ -791,7 +791,7 @@ public void GenericClassLoadingError(string arg0) /// The 'GenericVerifierError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericVerifierError(string arg0) { @@ -802,7 +802,7 @@ public void GenericVerifierError(string arg0) /// The 'GenericRuntimeError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericRuntimeError(string arg0) { @@ -813,7 +813,7 @@ public void GenericRuntimeError(string arg0) /// The 'GenericJniError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// public void GenericJniError(string arg0) { @@ -824,7 +824,7 @@ public void GenericJniError(string arg0) /// The 'ExportingImportsNotSupported' diagnostic. /// /// -/// Exporting previously imported assemblies is not supported. +/// Error: Exporting previously imported assemblies is not supported. /// public void ExportingImportsNotSupported() { @@ -835,7 +835,7 @@ public void ExportingImportsNotSupported() /// The 'ResponseFileDepthExceeded' diagnostic. /// /// -/// Response file nesting depth exceeded. +/// Fatal: Response file nesting depth exceeded. /// public void ResponseFileDepthExceeded() { @@ -846,7 +846,7 @@ public void ResponseFileDepthExceeded() /// The 'ErrorReadingFile' diagnostic. /// /// -/// Unable to read file: {arg0}. ({arg1}) +/// Fatal: Unable to read file: {arg0}. ({arg1}) /// public void ErrorReadingFile(string arg0, string arg1) { @@ -857,7 +857,7 @@ public void ErrorReadingFile(string arg0, string arg1) /// The 'NoTargetsFound' diagnostic. /// /// -/// No targets found +/// Fatal: No targets found /// public void NoTargetsFound() { @@ -868,7 +868,7 @@ public void NoTargetsFound() /// The 'FileFormatLimitationExceeded' diagnostic. /// /// -/// File format limitation exceeded: {arg0}. +/// Fatal: File format limitation exceeded: {arg0}. /// public void FileFormatLimitationExceeded(string arg0) { @@ -879,7 +879,7 @@ public void FileFormatLimitationExceeded(string arg0) /// The 'CannotSpecifyBothKeyFileAndContainer' diagnostic. /// /// -/// You cannot specify both a key file and container. +/// Fatal: You cannot specify both a key file and container. /// public void CannotSpecifyBothKeyFileAndContainer() { @@ -890,7 +890,7 @@ public void CannotSpecifyBothKeyFileAndContainer() /// The 'DelaySignRequiresKey' diagnostic. /// /// -/// You cannot delay sign without a key file or container. +/// Fatal: You cannot delay sign without a key file or container. /// public void DelaySignRequiresKey() { @@ -901,7 +901,7 @@ public void DelaySignRequiresKey() /// The 'InvalidStrongNameKeyPair' diagnostic. /// /// -/// Invalid key {arg0} specified. ("{arg1}") +/// Fatal: Invalid key {arg0} specified. ("{arg1}") /// public void InvalidStrongNameKeyPair(string arg0, string arg1) { @@ -912,7 +912,7 @@ public void InvalidStrongNameKeyPair(string arg0, string arg1) /// The 'ReferenceNotFound' diagnostic. /// /// -/// Reference not found: {arg0} +/// Fatal: Reference not found: {arg0} /// public void ReferenceNotFound(string arg0) { @@ -923,7 +923,7 @@ public void ReferenceNotFound(string arg0) /// The 'OptionsMustPreceedChildLevels' diagnostic. /// /// -/// You can only specify options before any child levels. +/// Fatal: You can only specify options before any child levels. /// public void OptionsMustPreceedChildLevels() { @@ -934,7 +934,7 @@ public void OptionsMustPreceedChildLevels() /// The 'UnrecognizedTargetType' diagnostic. /// /// -/// Invalid value '{arg0}' for -target option. +/// Fatal: Invalid value '{arg0}' for -target option. /// public void UnrecognizedTargetType(string arg0) { @@ -945,7 +945,7 @@ public void UnrecognizedTargetType(string arg0) /// The 'UnrecognizedPlatform' diagnostic. /// /// -/// Invalid value '{arg0}' for -platform option. +/// Fatal: Invalid value '{arg0}' for -platform option. /// public void UnrecognizedPlatform(string arg0) { @@ -956,7 +956,7 @@ public void UnrecognizedPlatform(string arg0) /// The 'UnrecognizedApartment' diagnostic. /// /// -/// Invalid value '{arg0}' for -apartment option. +/// Fatal: Invalid value '{arg0}' for -apartment option. /// public void UnrecognizedApartment(string arg0) { @@ -967,7 +967,7 @@ public void UnrecognizedApartment(string arg0) /// The 'MissingFileSpecification' diagnostic. /// /// -/// Missing file specification for '{arg0}' option. +/// Fatal: Missing file specification for '{arg0}' option. /// public void MissingFileSpecification(string arg0) { @@ -978,7 +978,7 @@ public void MissingFileSpecification(string arg0) /// The 'PathTooLong' diagnostic. /// /// -/// Path too long: {arg0}. +/// Fatal: Path too long: {arg0}. /// public void PathTooLong(string arg0) { @@ -989,7 +989,7 @@ public void PathTooLong(string arg0) /// The 'PathNotFound' diagnostic. /// /// -/// Path not found: {arg0}. +/// Fatal: Path not found: {arg0}. /// public void PathNotFound(string arg0) { @@ -1000,7 +1000,7 @@ public void PathNotFound(string arg0) /// The 'InvalidPath' diagnostic. /// /// -/// Invalid path: {arg0}. +/// Fatal: Invalid path: {arg0}. /// public void InvalidPath(string arg0) { @@ -1011,7 +1011,7 @@ public void InvalidPath(string arg0) /// The 'InvalidOptionSyntax' diagnostic. /// /// -/// Invalid option: {arg0}. +/// Fatal: Invalid option: {arg0}. /// public void InvalidOptionSyntax(string arg0) { @@ -1022,7 +1022,7 @@ public void InvalidOptionSyntax(string arg0) /// The 'ExternalResourceNotFound' diagnostic. /// /// -/// External resource file does not exist: {arg0}. +/// Fatal: External resource file does not exist: {arg0}. /// public void ExternalResourceNotFound(string arg0) { @@ -1033,7 +1033,7 @@ public void ExternalResourceNotFound(string arg0) /// The 'ExternalResourceNameInvalid' diagnostic. /// /// -/// External resource file may not include path specification: {arg0}. +/// Fatal: External resource file may not include path specification: {arg0}. /// public void ExternalResourceNameInvalid(string arg0) { @@ -1044,7 +1044,7 @@ public void ExternalResourceNameInvalid(string arg0) /// The 'InvalidVersionFormat' diagnostic. /// /// -/// Invalid version specified: {arg0}. +/// Fatal: Invalid version specified: {arg0}. /// public void InvalidVersionFormat(string arg0) { @@ -1055,7 +1055,7 @@ public void InvalidVersionFormat(string arg0) /// The 'InvalidFileAlignment' diagnostic. /// /// -/// Invalid value '{arg0}' for -filealign option. +/// Fatal: Invalid value '{arg0}' for -filealign option. /// public void InvalidFileAlignment(string arg0) { @@ -1066,7 +1066,7 @@ public void InvalidFileAlignment(string arg0) /// The 'ErrorWritingFile' diagnostic. /// /// -/// Unable to write file: {arg0}. ({arg1}) +/// Fatal: Unable to write file: {arg0}. ({arg1}) /// public void ErrorWritingFile(string arg0, string arg1) { @@ -1077,7 +1077,7 @@ public void ErrorWritingFile(string arg0, string arg1) /// The 'UnrecognizedOption' diagnostic. /// /// -/// Unrecognized option: {arg0}. +/// Fatal: Unrecognized option: {arg0}. /// public void UnrecognizedOption(string arg0) { @@ -1088,7 +1088,7 @@ public void UnrecognizedOption(string arg0) /// The 'NoOutputFileSpecified' diagnostic. /// /// -/// No output file specified. +/// Fatal: No output file specified. /// public void NoOutputFileSpecified() { @@ -1099,7 +1099,7 @@ public void NoOutputFileSpecified() /// The 'SharedClassLoaderCannotBeUsedOnModuleTarget' diagnostic. /// /// -/// Incompatible options: -target:module and -sharedclassloader cannot be combined. +/// Fatal: Incompatible options: -target:module and -sharedclassloader cannot be combined. /// public void SharedClassLoaderCannotBeUsedOnModuleTarget() { @@ -1110,7 +1110,7 @@ public void SharedClassLoaderCannotBeUsedOnModuleTarget() /// The 'RuntimeNotFound' diagnostic. /// /// -/// Unable to load runtime assembly. +/// Fatal: Unable to load runtime assembly. /// public void RuntimeNotFound() { @@ -1121,7 +1121,7 @@ public void RuntimeNotFound() /// The 'MainClassRequiresExe' diagnostic. /// /// -/// Main class cannot be specified for library or module. +/// Fatal: Main class cannot be specified for library or module. /// public void MainClassRequiresExe() { @@ -1132,7 +1132,7 @@ public void MainClassRequiresExe() /// The 'ExeRequiresMainClass' diagnostic. /// /// -/// No main method found. +/// Fatal: No main method found. /// public void ExeRequiresMainClass() { @@ -1143,7 +1143,7 @@ public void ExeRequiresMainClass() /// The 'PropertiesRequireExe' diagnostic. /// /// -/// Properties cannot be specified for library or module. +/// Fatal: Properties cannot be specified for library or module. /// public void PropertiesRequireExe() { @@ -1154,7 +1154,7 @@ public void PropertiesRequireExe() /// The 'ModuleCannotHaveClassLoader' diagnostic. /// /// -/// Cannot specify assembly class loader for modules. +/// Fatal: Cannot specify assembly class loader for modules. /// public void ModuleCannotHaveClassLoader() { @@ -1165,7 +1165,7 @@ public void ModuleCannotHaveClassLoader() /// The 'ErrorParsingMapFile' diagnostic. /// /// -/// Unable to parse remap file: {arg0}. ({arg1}) +/// Fatal: Unable to parse remap file: {arg0}. ({arg1}) /// public void ErrorParsingMapFile(string arg0, string arg1) { @@ -1176,7 +1176,7 @@ public void ErrorParsingMapFile(string arg0, string arg1) /// The 'BootstrapClassesMissing' diagnostic. /// /// -/// Bootstrap classes missing and core assembly not found. +/// Fatal: Bootstrap classes missing and core assembly not found. /// public void BootstrapClassesMissing() { @@ -1187,7 +1187,7 @@ public void BootstrapClassesMissing() /// The 'StrongNameRequiresStrongNamedRefs' diagnostic. /// /// -/// All referenced assemblies must be strong named, to be able to sign the output assembly. +/// Fatal: All referenced assemblies must be strong named, to be able to sign the output assembly. /// public void StrongNameRequiresStrongNamedRefs() { @@ -1198,7 +1198,7 @@ public void StrongNameRequiresStrongNamedRefs() /// The 'MainClassNotFound' diagnostic. /// /// -/// Main class not found. +/// Fatal: Main class not found. /// public void MainClassNotFound() { @@ -1209,7 +1209,7 @@ public void MainClassNotFound() /// The 'MainMethodNotFound' diagnostic. /// /// -/// Main method not found. +/// Fatal: Main method not found. /// public void MainMethodNotFound() { @@ -1220,7 +1220,7 @@ public void MainMethodNotFound() /// The 'UnsupportedMainMethod' diagnostic. /// /// -/// Redirected main method not supported. +/// Fatal: Redirected main method not supported. /// public void UnsupportedMainMethod() { @@ -1231,7 +1231,7 @@ public void UnsupportedMainMethod() /// The 'ExternalMainNotAccessible' diagnostic. /// /// -/// External main method must be public and in a public class. +/// Fatal: External main method must be public and in a public class. /// public void ExternalMainNotAccessible() { @@ -1242,7 +1242,7 @@ public void ExternalMainNotAccessible() /// The 'ClassLoaderNotFound' diagnostic. /// /// -/// Custom assembly class loader class not found. +/// Fatal: Custom assembly class loader class not found. /// public void ClassLoaderNotFound() { @@ -1253,7 +1253,7 @@ public void ClassLoaderNotFound() /// The 'ClassLoaderNotAccessible' diagnostic. /// /// -/// Custom assembly class loader class is not accessible. +/// Fatal: Custom assembly class loader class is not accessible. /// public void ClassLoaderNotAccessible() { @@ -1264,7 +1264,7 @@ public void ClassLoaderNotAccessible() /// The 'ClassLoaderIsAbstract' diagnostic. /// /// -/// Custom assembly class loader class is abstract. +/// Fatal: Custom assembly class loader class is abstract. /// public void ClassLoaderIsAbstract() { @@ -1275,7 +1275,7 @@ public void ClassLoaderIsAbstract() /// The 'ClassLoaderNotClassLoader' diagnostic. /// /// -/// Custom assembly class loader class does not extend java.lang.ClassLoader. +/// Fatal: Custom assembly class loader class does not extend java.lang.ClassLoader. /// public void ClassLoaderNotClassLoader() { @@ -1286,7 +1286,7 @@ public void ClassLoaderNotClassLoader() /// The 'ClassLoaderConstructorMissing' diagnostic. /// /// -/// Custom assembly class loader constructor is missing. +/// Fatal: Custom assembly class loader constructor is missing. /// public void ClassLoaderConstructorMissing() { @@ -1297,7 +1297,7 @@ public void ClassLoaderConstructorMissing() /// The 'MapFileTypeNotFound' diagnostic. /// /// -/// Type '{arg0}' referenced in remap file was not found. +/// Fatal: Type '{arg0}' referenced in remap file was not found. /// public void MapFileTypeNotFound(string arg0) { @@ -1308,7 +1308,7 @@ public void MapFileTypeNotFound(string arg0) /// The 'MapFileClassNotFound' diagnostic. /// /// -/// Class '{arg0}' referenced in remap file was not found. +/// Fatal: Class '{arg0}' referenced in remap file was not found. /// public void MapFileClassNotFound(string arg0) { @@ -1319,7 +1319,7 @@ public void MapFileClassNotFound(string arg0) /// The 'MaximumErrorCountReached' diagnostic. /// /// -/// Maximum error count reached. +/// Fatal: Maximum error count reached. /// public void MaximumErrorCountReached() { @@ -1330,7 +1330,7 @@ public void MaximumErrorCountReached() /// The 'LinkageError' diagnostic. /// /// -/// Link error: {arg0} +/// Fatal: Link error: {arg0} /// public void LinkageError(string arg0) { @@ -1341,7 +1341,7 @@ public void LinkageError(string arg0) /// The 'RuntimeMismatch' diagnostic. /// /// -/// Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} +/// Fatal: Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} /// public void RuntimeMismatch(string referencedAssemblyPath, string runtimeAssemblyName, string referencedAssemblyName) { @@ -1352,7 +1352,7 @@ public void RuntimeMismatch(string referencedAssemblyPath, string runtimeAssembl /// The 'RuntimeMismatchStrongName' diagnostic. /// /// -/// +/// Fatal: /// public void RuntimeMismatchStrongName() { @@ -1363,7 +1363,7 @@ public void RuntimeMismatchStrongName() /// The 'CoreClassesMissing' diagnostic. /// /// -/// Failed to find core classes in core library. +/// Fatal: Failed to find core classes in core library. /// public void CoreClassesMissing() { @@ -1374,7 +1374,7 @@ public void CoreClassesMissing() /// The 'CriticalClassNotFound' diagnostic. /// /// -/// Unable to load critical class '{arg0}'. +/// Fatal: Unable to load critical class '{arg0}'. /// public void CriticalClassNotFound(string arg0) { @@ -1385,7 +1385,7 @@ public void CriticalClassNotFound(string arg0) /// The 'AssemblyContainsDuplicateClassNames' diagnostic. /// /// -/// Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) +/// Fatal: Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) /// public void AssemblyContainsDuplicateClassNames(string arg0, string arg1, string arg2, string arg3) { @@ -1396,7 +1396,7 @@ public void AssemblyContainsDuplicateClassNames(string arg0, string arg1, string /// The 'CallerIDRequiresHasCallerIDAnnotation' diagnostic. /// /// -/// CallerID.getCallerID() requires a HasCallerID annotation. +/// Fatal: CallerID.getCallerID() requires a HasCallerID annotation. /// public void CallerIDRequiresHasCallerIDAnnotation() { @@ -1407,7 +1407,7 @@ public void CallerIDRequiresHasCallerIDAnnotation() /// The 'UnableToResolveInterface' diagnostic. /// /// -/// Unable to resolve interface '{arg0}' on type '{arg1}'. +/// Fatal: Unable to resolve interface '{arg0}' on type '{arg1}'. /// public void UnableToResolveInterface(string arg0, string arg1) { @@ -1418,7 +1418,7 @@ public void UnableToResolveInterface(string arg0, string arg1) /// The 'MissingBaseType' diagnostic. /// /// -/// The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. +/// Fatal: The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. /// public void MissingBaseType(string arg0, string arg1, string arg2, string arg3) { @@ -1429,7 +1429,7 @@ public void MissingBaseType(string arg0, string arg1, string arg2, string arg3) /// The 'MissingBaseTypeReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. +/// Fatal: The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. /// public void MissingBaseTypeReference(string arg0, string arg1) { @@ -1440,7 +1440,7 @@ public void MissingBaseTypeReference(string arg0, string arg1) /// The 'FileNotFound' diagnostic. /// /// -/// File not found: {arg0}. +/// Fatal: File not found: {arg0}. /// public void FileNotFound(string arg0) { @@ -1451,7 +1451,7 @@ public void FileNotFound(string arg0) /// The 'RuntimeMethodMissing' diagnostic. /// /// -/// Runtime method '{arg0}' not found. +/// Fatal: Runtime method '{arg0}' not found. /// public void RuntimeMethodMissing(string arg0) { @@ -1462,7 +1462,7 @@ public void RuntimeMethodMissing(string arg0) /// The 'MapFileFieldNotFound' diagnostic. /// /// -/// Field '{arg0}' referenced in remap file was not found in class '{arg1}'. +/// Fatal: Field '{arg0}' referenced in remap file was not found in class '{arg1}'. /// public void MapFileFieldNotFound(string arg0, string arg1) { @@ -1473,7 +1473,7 @@ public void MapFileFieldNotFound(string arg0, string arg1) /// The 'GhostInterfaceMethodMissing' diagnostic. /// /// -/// Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) +/// Fatal: Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) /// public void GhostInterfaceMethodMissing(string arg0, string arg1, string arg2, string arg3) { @@ -1484,7 +1484,7 @@ public void GhostInterfaceMethodMissing(string arg0, string arg1, string arg2, s /// The 'ModuleInitializerMethodRequirements' diagnostic. /// /// -/// Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. +/// Fatal: Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. /// public void ModuleInitializerMethodRequirements(string arg1, string arg2, string arg3) { @@ -1495,18 +1495,29 @@ public void ModuleInitializerMethodRequirements(string arg1, string arg2, string /// The 'InvalidZip' diagnostic. /// /// -/// Invalid zip: {name}. +/// Fatal: Invalid zip: {name}. /// public void InvalidZip(string name) { } + /// + /// The 'CoreAssemblyVersionMismatch' diagnostic. + /// + /// +/// Fatal: Unable to load assembly '{0}' as it depends on a higher version of {1} than the one currently loaded. + /// + public void CoreAssemblyVersionMismatch(string arg0, string arg1) + { + + } + /// /// The 'GenericRuntimeTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public void GenericRuntimeTrace(string arg0) { @@ -1517,7 +1528,7 @@ public void GenericRuntimeTrace(string arg0) /// The 'GenericJniTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public void GenericJniTrace(string arg0) { @@ -1528,7 +1539,7 @@ public void GenericJniTrace(string arg0) /// The 'GenericCompilerTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// public void GenericCompilerTrace(string arg0) { diff --git a/src/IKVM.CoreLib/Diagnostics/NullDiagnosticHandler.g.tt b/src/IKVM.CoreLib/Diagnostics/NullDiagnosticHandler.g.tt index 10badb18b9..9d652e8078 100644 --- a/src/IKVM.CoreLib/Diagnostics/NullDiagnosticHandler.g.tt +++ b/src/IKVM.CoreLib/Diagnostics/NullDiagnosticHandler.g.tt @@ -45,7 +45,7 @@ foreach (var kvp in DiagnosticFile.Read(Host.ResolvePath(Path.Combine("Diagnosti /// <#= desc #> /// /// -<#= Util.ToCommentString(kvp.Value.Message ?? "") #> +<#= Util.ToCommentString(kvp.Value) #> /// public void <#= kvp.Key #>(<#= string.Join(", ", argDecl) #>) { diff --git a/src/IKVM.CoreLib/Diagnostics/Tracing/DiagnosticEventSource.g.cs b/src/IKVM.CoreLib/Diagnostics/Tracing/DiagnosticEventSource.g.cs index f6559bc13d..123b06795b 100644 --- a/src/IKVM.CoreLib/Diagnostics/Tracing/DiagnosticEventSource.g.cs +++ b/src/IKVM.CoreLib/Diagnostics/Tracing/DiagnosticEventSource.g.cs @@ -12,7 +12,7 @@ partial class DiagnosticEventSource /// The 'MainMethodFound' diagnostic. /// /// -/// Found main method in class "{arg0}". +/// Info: Found main method in class "{arg0}". /// [Event(1, Message = "Found main method in class \"{0}\".", Level = EventLevel.Informational)] public void MainMethodFound(string arg0) => WriteEvent(1, arg0); @@ -21,7 +21,7 @@ partial class DiagnosticEventSource /// The 'OutputFileIs' diagnostic. /// /// -/// Output file is "{arg0}". +/// Info: Output file is "{arg0}". /// [Event(2, Message = "Output file is \"{0}\".", Level = EventLevel.Informational)] public void OutputFileIs(string arg0) => WriteEvent(2, arg0); @@ -30,7 +30,7 @@ partial class DiagnosticEventSource /// The 'AutoAddRef' diagnostic. /// /// -/// Automatically adding reference to "{arg0}". +/// Info: Automatically adding reference to "{arg0}". /// [Event(3, Message = "Automatically adding reference to \"{0}\".", Level = EventLevel.Informational)] public void AutoAddRef(string arg0) => WriteEvent(3, arg0); @@ -39,7 +39,7 @@ partial class DiagnosticEventSource /// The 'MainMethodFromManifest' diagnostic. /// /// -/// Using main class "{arg0}" based on jar manifest. +/// Info: Using main class "{arg0}" based on jar manifest. /// [Event(4, Message = "Using main class \"{0}\" based on jar manifest.", Level = EventLevel.Informational)] public void MainMethodFromManifest(string arg0) => WriteEvent(4, arg0); @@ -48,7 +48,7 @@ partial class DiagnosticEventSource /// The 'GenericCompilerInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// [Event(5, Message = "{0}", Level = EventLevel.Informational)] public void GenericCompilerInfo(string arg0) => WriteEvent(5, arg0); @@ -57,7 +57,7 @@ partial class DiagnosticEventSource /// The 'GenericClassLoadingInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// [Event(6, Message = "{0}", Level = EventLevel.Informational)] public void GenericClassLoadingInfo(string arg0) => WriteEvent(6, arg0); @@ -66,7 +66,7 @@ partial class DiagnosticEventSource /// The 'GenericVerifierInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// [Event(7, Message = "{0}", Level = EventLevel.Informational)] public void GenericVerifierInfo(string arg0) => WriteEvent(7, arg0); @@ -75,7 +75,7 @@ partial class DiagnosticEventSource /// The 'GenericRuntimeInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// [Event(8, Message = "{0}", Level = EventLevel.Informational)] public void GenericRuntimeInfo(string arg0) => WriteEvent(8, arg0); @@ -84,7 +84,7 @@ partial class DiagnosticEventSource /// The 'GenericJniInfo' diagnostic. /// /// -/// {arg0} +/// Info: {arg0} /// [Event(9, Message = "{0}", Level = EventLevel.Informational)] public void GenericJniInfo(string arg0) => WriteEvent(9, arg0); @@ -93,7 +93,7 @@ partial class DiagnosticEventSource /// The 'ClassNotFound' diagnostic. /// /// -/// Class "{arg0}" not found. +/// Warning: Class "{arg0}" not found. /// [Event(100, Message = "Class \"{0}\" not found.", Level = EventLevel.Warning)] public void ClassNotFound(string arg0) => WriteEvent(100, arg0); @@ -102,7 +102,7 @@ partial class DiagnosticEventSource /// The 'ClassFormatError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (class format error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (class format error "{arg1}") /// [Event(101, Message = "Unable to compile class \"{0}\". (class format error \"{1}\")", Level = EventLevel.Warning)] public void ClassFormatError(string arg0, string arg1) => WriteEvent(101, arg0, arg1); @@ -111,7 +111,7 @@ partial class DiagnosticEventSource /// The 'DuplicateClassName' diagnostic. /// /// -/// Duplicate class name: "{arg0}". +/// Warning: Duplicate class name: "{arg0}". /// [Event(102, Message = "Duplicate class name: \"{0}\".", Level = EventLevel.Warning)] public void DuplicateClassName(string arg0) => WriteEvent(102, arg0); @@ -120,7 +120,7 @@ partial class DiagnosticEventSource /// The 'IllegalAccessError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (illegal access error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (illegal access error "{arg1}") /// [Event(103, Message = "Unable to compile class \"{0}\". (illegal access error \"{1}\")", Level = EventLevel.Warning)] public void IllegalAccessError(string arg0, string arg1) => WriteEvent(103, arg0, arg1); @@ -129,7 +129,7 @@ partial class DiagnosticEventSource /// The 'VerificationError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (verification error "{arg1}") +/// Warning: Unable to compile class "{arg0}". (verification error "{arg1}") /// [Event(104, Message = "Unable to compile class \"{0}\". (verification error \"{1}\")", Level = EventLevel.Warning)] public void VerificationError(string arg0, string arg1) => WriteEvent(104, arg0, arg1); @@ -138,7 +138,7 @@ partial class DiagnosticEventSource /// The 'NoClassDefFoundError' diagnostic. /// /// -/// Unable to compile class "{arg0}". (missing class "{arg1}") +/// Warning: Unable to compile class "{arg0}". (missing class "{arg1}") /// [Event(105, Message = "Unable to compile class \"{0}\". (missing class \"{1}\")", Level = EventLevel.Warning)] public void NoClassDefFoundError(string arg0, string arg1) => WriteEvent(105, arg0, arg1); @@ -147,7 +147,7 @@ partial class DiagnosticEventSource /// The 'GenericUnableToCompileError' diagnostic. /// /// -/// Unable to compile class "{arg0}". ("{arg1}": "{arg2}") +/// Warning: Unable to compile class "{arg0}". ("{arg1}": "{arg2}") /// [Event(106, Message = "Unable to compile class \"{0}\". (\"{1}\": \"{2}\")", Level = EventLevel.Warning)] public void GenericUnableToCompileError(string arg0, string arg1, string arg2) => WriteEvent(106, arg0, arg1, arg2); @@ -156,7 +156,7 @@ partial class DiagnosticEventSource /// The 'DuplicateResourceName' diagnostic. /// /// -/// Skipping resource (name clash): "{arg0}" +/// Warning: Skipping resource (name clash): "{arg0}" /// [Event(107, Message = "Skipping resource (name clash): \"{0}\"", Level = EventLevel.Warning)] public void DuplicateResourceName(string arg0) => WriteEvent(107, arg0); @@ -165,7 +165,7 @@ partial class DiagnosticEventSource /// The 'SkippingReferencedClass' diagnostic. /// /// -/// Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") +/// Warning: Skipping class: "{arg0}". (class is already available in referenced assembly "{arg1}") /// [Event(109, Message = "Skipping class: \"{0}\". (class is already available in referenced assembly \"{1}\")", Level = EventLevel.Warning)] public void SkippingReferencedClass(string arg0, string arg1) => WriteEvent(109, arg0, arg1); @@ -174,7 +174,7 @@ partial class DiagnosticEventSource /// The 'NoJniRuntime' diagnostic. /// /// -/// Unable to load runtime JNI assembly. +/// Warning: Unable to load runtime JNI assembly. /// [Event(110, Message = "Unable to load runtime JNI assembly.", Level = EventLevel.Warning)] public void NoJniRuntime() => WriteEvent(110); @@ -183,7 +183,7 @@ partial class DiagnosticEventSource /// The 'EmittedNoClassDefFoundError' diagnostic. /// /// -/// Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). +/// Warning: Emitted java.lang.NoClassDefFoundError in "{arg0}". ("{arg1}"). /// [Event(111, Message = "Emitted java.lang.NoClassDefFoundError in \"{0}\". (\"{1}\").", Level = EventLevel.Warning)] public void EmittedNoClassDefFoundError(string arg0, string arg1) => WriteEvent(111, arg0, arg1); @@ -192,7 +192,7 @@ partial class DiagnosticEventSource /// The 'EmittedIllegalAccessError' diagnostic. /// /// -/// Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IllegalAccessError in "{arg0}". ("{arg1}") /// [Event(112, Message = "Emitted java.lang.IllegalAccessError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedIllegalAccessError(string arg0, string arg1) => WriteEvent(112, arg0, arg1); @@ -201,7 +201,7 @@ partial class DiagnosticEventSource /// The 'EmittedInstantiationError' diagnostic. /// /// -/// Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.InstantiationError in "{arg0}". ("{arg1}") /// [Event(113, Message = "Emitted java.lang.InstantiationError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedInstantiationError(string arg0, string arg1) => WriteEvent(113, arg0, arg1); @@ -210,7 +210,7 @@ partial class DiagnosticEventSource /// The 'EmittedIncompatibleClassChangeError' diagnostic. /// /// -/// Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.IncompatibleClassChangeError in "{arg0}". ("{arg1}") /// [Event(114, Message = "Emitted java.lang.IncompatibleClassChangeError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedIncompatibleClassChangeError(string arg0, string arg1) => WriteEvent(114, arg0, arg1); @@ -219,7 +219,7 @@ partial class DiagnosticEventSource /// The 'EmittedNoSuchFieldError' diagnostic. /// /// -/// Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchFieldError in "{arg0}". ("{arg1}") /// [Event(115, Message = "Emitted java.lang.NoSuchFieldError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedNoSuchFieldError(string arg0, string arg1) => WriteEvent(115, arg0, arg1); @@ -228,7 +228,7 @@ partial class DiagnosticEventSource /// The 'EmittedAbstractMethodError' diagnostic. /// /// -/// Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.AbstractMethodError in "{arg0}". ("{arg1}") /// [Event(116, Message = "Emitted java.lang.AbstractMethodError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedAbstractMethodError(string arg0, string arg1) => WriteEvent(116, arg0, arg1); @@ -237,7 +237,7 @@ partial class DiagnosticEventSource /// The 'EmittedNoSuchMethodError' diagnostic. /// /// -/// Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.NoSuchMethodError in "{arg0}". ("{arg1}") /// [Event(117, Message = "Emitted java.lang.NoSuchMethodError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedNoSuchMethodError(string arg0, string arg1) => WriteEvent(117, arg0, arg1); @@ -246,7 +246,7 @@ partial class DiagnosticEventSource /// The 'EmittedLinkageError' diagnostic. /// /// -/// Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.LinkageError in "{arg0}". ("{arg1}") /// [Event(118, Message = "Emitted java.lang.LinkageError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedLinkageError(string arg0, string arg1) => WriteEvent(118, arg0, arg1); @@ -255,7 +255,7 @@ partial class DiagnosticEventSource /// The 'EmittedVerificationError' diagnostic. /// /// -/// Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.VerificationError in "{arg0}". ("{arg1}") /// [Event(119, Message = "Emitted java.lang.VerificationError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedVerificationError(string arg0, string arg1) => WriteEvent(119, arg0, arg1); @@ -264,7 +264,7 @@ partial class DiagnosticEventSource /// The 'EmittedClassFormatError' diagnostic. /// /// -/// Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") +/// Warning: Emitted java.lang.ClassFormatError in "{arg0}". ("{arg1}") /// [Event(120, Message = "Emitted java.lang.ClassFormatError in \"{0}\". (\"{1}\")", Level = EventLevel.Warning)] public void EmittedClassFormatError(string arg0, string arg1) => WriteEvent(120, arg0, arg1); @@ -273,7 +273,7 @@ partial class DiagnosticEventSource /// The 'InvalidCustomAttribute' diagnostic. /// /// -/// Error emitting "{arg0}" custom attribute. ("{arg1}") +/// Warning: Error emitting "{arg0}" custom attribute. ("{arg1}") /// [Event(121, Message = "Error emitting \"{0}\" custom attribute. (\"{1}\")", Level = EventLevel.Warning)] public void InvalidCustomAttribute(string arg0, string arg1) => WriteEvent(121, arg0, arg1); @@ -282,7 +282,7 @@ partial class DiagnosticEventSource /// The 'IgnoredCustomAttribute' diagnostic. /// /// -/// Custom attribute "{arg0}" was ignored. ("{arg1}") +/// Warning: Custom attribute "{arg0}" was ignored. ("{arg1}") /// [Event(122, Message = "Custom attribute \"{0}\" was ignored. (\"{1}\")", Level = EventLevel.Warning)] public void IgnoredCustomAttribute(string arg0, string arg1) => WriteEvent(122, arg0, arg1); @@ -291,7 +291,7 @@ partial class DiagnosticEventSource /// The 'AssumeAssemblyVersionMatch' diagnostic. /// /// -/// Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy +/// Warning: Assuming assembly reference "{arg0}" matches "{arg1}", you may need to supply runtime policy /// [Event(123, Message = "Assuming assembly reference \"{0}\" matches \"{1}\", you may need to supply runtime p" + "olicy", Level = EventLevel.Warning)] @@ -301,7 +301,7 @@ partial class DiagnosticEventSource /// The 'InvalidDirectoryInLibOptionPath' diagnostic. /// /// -/// Directory "{arg0}" specified in -lib option is not valid. +/// Warning: Directory "{arg0}" specified in -lib option is not valid. /// [Event(124, Message = "Directory \"{0}\" specified in -lib option is not valid.", Level = EventLevel.Warning)] public void InvalidDirectoryInLibOptionPath(string arg0) => WriteEvent(124, arg0); @@ -310,7 +310,7 @@ partial class DiagnosticEventSource /// The 'InvalidDirectoryInLibEnvironmentPath' diagnostic. /// /// -/// Directory "{arg0}" specified in LIB environment is not valid. +/// Warning: Directory "{arg0}" specified in LIB environment is not valid. /// [Event(125, Message = "Directory \"{0}\" specified in LIB environment is not valid.", Level = EventLevel.Warning)] public void InvalidDirectoryInLibEnvironmentPath(string arg0) => WriteEvent(125, arg0); @@ -319,7 +319,7 @@ partial class DiagnosticEventSource /// The 'LegacySearchRule' diagnostic. /// /// -/// Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. +/// Warning: Found assembly "{arg0}" using legacy search rule, please append '.dll' to the reference. /// [Event(126, Message = "Found assembly \"{0}\" using legacy search rule, please append \'.dll\' to the refere" + "nce.", Level = EventLevel.Warning)] @@ -329,7 +329,7 @@ partial class DiagnosticEventSource /// The 'AssemblyLocationIgnored' diagnostic. /// /// -/// Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". +/// Warning: Assembly "{arg0}" is ignored as previously loaded assembly "{arg1}" has the same identity "{arg2}". /// [Event(127, Message = "Assembly \"{0}\" is ignored as previously loaded assembly \"{1}\" has the same identi" + "ty \"{2}\".", Level = EventLevel.Warning)] @@ -339,7 +339,7 @@ partial class DiagnosticEventSource /// The 'InterfaceMethodCantBeInternal' diagnostic. /// /// -/// Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") +/// Warning: Ignoring @ikvm.lang.Internal annotation on interface method. ("{arg0}.{arg1}{arg2}") /// [Event(128, Message = "Ignoring @ikvm.lang.Internal annotation on interface method. (\"{0}.{1}{2}\")", Level = EventLevel.Warning)] public void InterfaceMethodCantBeInternal(string arg0, string arg1, string arg2) => WriteEvent(128, arg0, arg1, arg2); @@ -348,7 +348,7 @@ partial class DiagnosticEventSource /// The 'DuplicateAssemblyReference' diagnostic. /// /// -/// Duplicate assembly reference "{arg0}" +/// Warning: Duplicate assembly reference "{arg0}" /// [Event(132, Message = "Duplicate assembly reference \"{0}\"", Level = EventLevel.Warning)] public void DuplicateAssemblyReference(string arg0) => WriteEvent(132, arg0); @@ -357,7 +357,7 @@ partial class DiagnosticEventSource /// The 'UnableToResolveType' diagnostic. /// /// -/// Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. +/// Warning: Reference in "{arg0}" to type "{arg1}" claims it is defined in "{arg2}", but it could not be found. /// [Event(133, Message = "Reference in \"{0}\" to type \"{1}\" claims it is defined in \"{2}\", but it could not " + "be found.", Level = EventLevel.Warning)] @@ -367,7 +367,7 @@ partial class DiagnosticEventSource /// The 'StubsAreDeprecated' diagnostic. /// /// -/// Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. +/// Warning: Compiling stubs is deprecated. Please add a reference to assembly "{arg0}" instead. /// [Event(134, Message = "Compiling stubs is deprecated. Please add a reference to assembly \"{0}\" instead.", Level = EventLevel.Warning)] public void StubsAreDeprecated(string arg0) => WriteEvent(134, arg0); @@ -376,7 +376,7 @@ partial class DiagnosticEventSource /// The 'WrongClassName' diagnostic. /// /// -/// Unable to compile "{arg0}" (wrong name: "{arg1}") +/// Warning: Unable to compile "{arg0}" (wrong name: "{arg1}") /// [Event(135, Message = "Unable to compile \"{0}\" (wrong name: \"{1}\")", Level = EventLevel.Warning)] public void WrongClassName(string arg0, string arg1) => WriteEvent(135, arg0, arg1); @@ -385,7 +385,7 @@ partial class DiagnosticEventSource /// The 'ReflectionCallerClassRequiresCallerID' diagnostic. /// /// -/// Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") +/// Warning: Reflection.getCallerClass() called from non-CallerID method. ("{arg0}.{arg1}{arg2}") /// [Event(136, Message = "Reflection.getCallerClass() called from non-CallerID method. (\"{0}.{1}{2}\")", Level = EventLevel.Warning)] public void ReflectionCallerClassRequiresCallerID(string arg0, string arg1, string arg2) => WriteEvent(136, arg0, arg1, arg2); @@ -394,7 +394,7 @@ partial class DiagnosticEventSource /// The 'LegacyAssemblyAttributesFound' diagnostic. /// /// -/// Legacy assembly attributes container found. Please use the -assemblyattributes: option. +/// Warning: Legacy assembly attributes container found. Please use the -assemblyattributes: option. /// [Event(137, Message = "Legacy assembly attributes container found. Please use the -assemblyattributes: option.", Level = EventLevel.Warning)] @@ -404,7 +404,7 @@ partial class DiagnosticEventSource /// The 'UnableToCreateLambdaFactory' diagnostic. /// /// -/// Unable to create static lambda factory. +/// Warning: Unable to create static lambda factory. /// [Event(138, Message = "Unable to create static lambda factory.", Level = EventLevel.Warning)] public void UnableToCreateLambdaFactory() => WriteEvent(138); @@ -413,7 +413,7 @@ partial class DiagnosticEventSource /// The 'UnknownWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// [Event(999, Message = "{0}", Level = EventLevel.Warning)] public void UnknownWarning(string arg0) => WriteEvent(999, arg0); @@ -422,7 +422,7 @@ partial class DiagnosticEventSource /// The 'DuplicateIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// [Event(139, Message = "Ignoring duplicate ikvm.lang.Property annotation on {0}.{1}.", Level = EventLevel.Warning)] public void DuplicateIkvmLangProperty(string arg0, string arg1) => WriteEvent(139, arg0, arg1); @@ -431,7 +431,7 @@ partial class DiagnosticEventSource /// The 'MalformedIkvmLangProperty' diagnostic. /// /// -/// Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. +/// Warning: Ignoring duplicate ikvm.lang.Property annotation on {arg0}.{arg1}. /// [Event(140, Message = "Ignoring duplicate ikvm.lang.Property annotation on {0}.{1}.", Level = EventLevel.Warning)] public void MalformedIkvmLangProperty(string arg0, string arg1) => WriteEvent(140, arg0, arg1); @@ -440,7 +440,7 @@ partial class DiagnosticEventSource /// The 'GenericCompilerWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// [Event(141, Message = "{0}", Level = EventLevel.Warning)] public void GenericCompilerWarning(string arg0) => WriteEvent(141, arg0); @@ -449,7 +449,7 @@ partial class DiagnosticEventSource /// The 'GenericClassLoadingWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// [Event(142, Message = "{0}", Level = EventLevel.Warning)] public void GenericClassLoadingWarning(string arg0) => WriteEvent(142, arg0); @@ -458,7 +458,7 @@ partial class DiagnosticEventSource /// The 'GenericVerifierWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// [Event(143, Message = "{0}", Level = EventLevel.Warning)] public void GenericVerifierWarning(string arg0) => WriteEvent(143, arg0); @@ -467,7 +467,7 @@ partial class DiagnosticEventSource /// The 'GenericRuntimeWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// [Event(144, Message = "{0}", Level = EventLevel.Warning)] public void GenericRuntimeWarning(string arg0) => WriteEvent(144, arg0); @@ -476,7 +476,7 @@ partial class DiagnosticEventSource /// The 'GenericJniWarning' diagnostic. /// /// -/// {arg0} +/// Warning: {arg0} /// [Event(145, Message = "{0}", Level = EventLevel.Warning)] public void GenericJniWarning(string arg0) => WriteEvent(145, arg0); @@ -485,7 +485,7 @@ partial class DiagnosticEventSource /// The 'UnableToCreateProxy' diagnostic. /// /// -/// Unable to create proxy "{arg0}". ("{arg1}") +/// Error: Unable to create proxy "{arg0}". ("{arg1}") /// [Event(4001, Message = "Unable to create proxy \"{0}\". (\"{1}\")", Level = EventLevel.Error)] public void UnableToCreateProxy(string arg0, string arg1) => WriteEvent(4001, arg0, arg1); @@ -494,7 +494,7 @@ partial class DiagnosticEventSource /// The 'DuplicateProxy' diagnostic. /// /// -/// Duplicate proxy "{arg0}". +/// Error: Duplicate proxy "{arg0}". /// [Event(4002, Message = "Duplicate proxy \"{0}\".", Level = EventLevel.Error)] public void DuplicateProxy(string arg0) => WriteEvent(4002, arg0); @@ -503,7 +503,7 @@ partial class DiagnosticEventSource /// The 'MapXmlUnableToResolveOpCode' diagnostic. /// /// -/// Unable to resolve opcode in remap file: {arg0}. +/// Error: Unable to resolve opcode in remap file: {arg0}. /// [Event(4003, Message = "Unable to resolve opcode in remap file: {0}.", Level = EventLevel.Error)] public void MapXmlUnableToResolveOpCode(string arg0) => WriteEvent(4003, arg0); @@ -512,7 +512,7 @@ partial class DiagnosticEventSource /// The 'MapXmlError' diagnostic. /// /// -/// Error in remap file: {arg0}. +/// Error: Error in remap file: {arg0}. /// [Event(4004, Message = "Error in remap file: {0}.", Level = EventLevel.Error)] public void MapXmlError(string arg0) => WriteEvent(4004, arg0); @@ -521,7 +521,7 @@ partial class DiagnosticEventSource /// The 'InputFileNotFound' diagnostic. /// /// -/// Source file '{arg0}' not found. +/// Error: Source file '{arg0}' not found. /// [Event(4005, Message = "Source file \'{0}\' not found.", Level = EventLevel.Error)] public void InputFileNotFound(string arg0) => WriteEvent(4005, arg0); @@ -530,7 +530,7 @@ partial class DiagnosticEventSource /// The 'UnknownFileType' diagnostic. /// /// -/// Unknown file type: {arg0}. +/// Error: Unknown file type: {arg0}. /// [Event(4006, Message = "Unknown file type: {0}.", Level = EventLevel.Error)] public void UnknownFileType(string arg0) => WriteEvent(4006, arg0); @@ -539,7 +539,7 @@ partial class DiagnosticEventSource /// The 'UnknownElementInMapFile' diagnostic. /// /// -/// Unknown element {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown element {arg0} in remap file, line {arg1}, column {arg2}. /// [Event(4007, Message = "Unknown element {0} in remap file, line {1}, column {2}.", Level = EventLevel.Error)] public void UnknownElementInMapFile(string arg0, string arg1, string arg2) => WriteEvent(4007, arg0, arg1, arg2); @@ -548,7 +548,7 @@ partial class DiagnosticEventSource /// The 'UnknownAttributeInMapFile' diagnostic. /// /// -/// Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. +/// Error: Unknown attribute {arg0} in remap file, line {arg1}, column {arg2}. /// [Event(4008, Message = "Unknown attribute {0} in remap file, line {1}, column {2}.", Level = EventLevel.Error)] public void UnknownAttributeInMapFile(string arg0, string arg1, string arg2) => WriteEvent(4008, arg0, arg1, arg2); @@ -557,7 +557,7 @@ partial class DiagnosticEventSource /// The 'InvalidMemberNameInMapFile' diagnostic. /// /// -/// Invalid {arg0} name '{arg1}' in remap file in class {arg2}. +/// Error: Invalid {arg0} name '{arg1}' in remap file in class {arg2}. /// [Event(4009, Message = "Invalid {0} name \'{1}\' in remap file in class {2}.", Level = EventLevel.Error)] public void InvalidMemberNameInMapFile(string arg0, string arg1, string arg2) => WriteEvent(4009, arg0, arg1, arg2); @@ -566,7 +566,7 @@ partial class DiagnosticEventSource /// The 'InvalidMemberSignatureInMapFile' diagnostic. /// /// -/// Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. +/// Error: Invalid {arg0} signature '{arg3}' in remap file for {arg0} {arg1}.{arg2}. /// [Event(4010, Message = "Invalid {0} signature \'{3}\' in remap file for {0} {1}.{2}.", Level = EventLevel.Error)] public void InvalidMemberSignatureInMapFile(string arg0, string arg1, string arg2, string arg3) => WriteEvent(4010, arg0, arg1, arg2, arg3); @@ -575,7 +575,7 @@ partial class DiagnosticEventSource /// The 'InvalidPropertyNameInMapFile' diagnostic. /// /// -/// Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} name '{arg3}' in remap file for property {arg1}.{arg2}. /// [Event(4011, Message = "Invalid property {0} name \'{3}\' in remap file for property {1}.{2}.", Level = EventLevel.Error)] public void InvalidPropertyNameInMapFile(string arg0, string arg1, string arg2, string arg3) => WriteEvent(4011, arg0, arg1, arg2, arg3); @@ -584,7 +584,7 @@ partial class DiagnosticEventSource /// The 'InvalidPropertySignatureInMapFile' diagnostic. /// /// -/// Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. +/// Error: Invalid property {arg0} signature '{arg3}' in remap file for property {arg1}.{arg2}. /// [Event(4012, Message = "Invalid property {0} signature \'{3}\' in remap file for property {1}.{2}.", Level = EventLevel.Error)] public void InvalidPropertySignatureInMapFile(string arg0, string arg1, string arg2, string arg3) => WriteEvent(4012, arg0, arg1, arg2, arg3); @@ -593,7 +593,7 @@ partial class DiagnosticEventSource /// The 'NonPrimaryAssemblyReference' diagnostic. /// /// -/// Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. +/// Error: Referenced assembly "{arg0}" is not the primary assembly of a shared class loader group, please reference primary assembly "{arg1}" instead. /// [Event(4013, Message = "Referenced assembly \"{0}\" is not the primary assembly of a shared class loader gr" + "oup, please reference primary assembly \"{1}\" instead.", Level = EventLevel.Error)] @@ -603,7 +603,7 @@ partial class DiagnosticEventSource /// The 'MissingType' diagnostic. /// /// -/// Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. +/// Error: Reference to type "{arg0}" claims it is defined in "{arg1}", but it could not be found. /// [Event(4014, Message = "Reference to type \"{0}\" claims it is defined in \"{1}\", but it could not be found." + "", Level = EventLevel.Error)] @@ -613,7 +613,7 @@ partial class DiagnosticEventSource /// The 'MissingReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. +/// Error: The type '{arg0}' is defined in an assembly that is notResponseFileDepthExceeded referenced. You must add a reference to assembly '{arg1}'. /// [Event(4015, Message = "The type \'{0}\' is defined in an assembly that is notResponseFileDepthExceeded ref" + "erenced. You must add a reference to assembly \'{1}\'.", Level = EventLevel.Error)] @@ -623,7 +623,7 @@ partial class DiagnosticEventSource /// The 'CallerSensitiveOnUnsupportedMethod' diagnostic. /// /// -/// CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") +/// Error: CallerSensitive annotation on unsupported method. ("{arg0}.{arg1}{arg2}") /// [Event(4016, Message = "CallerSensitive annotation on unsupported method. (\"{0}.{1}{2}\")", Level = EventLevel.Error)] public void CallerSensitiveOnUnsupportedMethod(string arg0, string arg1, string arg2) => WriteEvent(4016, arg0, arg1, arg2); @@ -632,7 +632,7 @@ partial class DiagnosticEventSource /// The 'RemappedTypeMissingDefaultInterfaceMethod' diagnostic. /// /// -/// {arg0} does not implement default interface method {arg1}. +/// Error: {arg0} does not implement default interface method {arg1}. /// [Event(4017, Message = "{0} does not implement default interface method {1}.", Level = EventLevel.Error)] public void RemappedTypeMissingDefaultInterfaceMethod(string arg0, string arg1) => WriteEvent(4017, arg0, arg1); @@ -641,7 +641,7 @@ partial class DiagnosticEventSource /// The 'GenericCompilerError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// [Event(4018, Message = "{0}", Level = EventLevel.Error)] public void GenericCompilerError(string arg0) => WriteEvent(4018, arg0); @@ -650,7 +650,7 @@ partial class DiagnosticEventSource /// The 'GenericClassLoadingError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// [Event(4019, Message = "{0}", Level = EventLevel.Error)] public void GenericClassLoadingError(string arg0) => WriteEvent(4019, arg0); @@ -659,7 +659,7 @@ partial class DiagnosticEventSource /// The 'GenericVerifierError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// [Event(4020, Message = "{0}", Level = EventLevel.Error)] public void GenericVerifierError(string arg0) => WriteEvent(4020, arg0); @@ -668,7 +668,7 @@ partial class DiagnosticEventSource /// The 'GenericRuntimeError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// [Event(4021, Message = "{0}", Level = EventLevel.Error)] public void GenericRuntimeError(string arg0) => WriteEvent(4021, arg0); @@ -677,7 +677,7 @@ partial class DiagnosticEventSource /// The 'GenericJniError' diagnostic. /// /// -/// {arg0} +/// Error: {arg0} /// [Event(4022, Message = "{0}", Level = EventLevel.Error)] public void GenericJniError(string arg0) => WriteEvent(4022, arg0); @@ -686,7 +686,7 @@ partial class DiagnosticEventSource /// The 'ExportingImportsNotSupported' diagnostic. /// /// -/// Exporting previously imported assemblies is not supported. +/// Error: Exporting previously imported assemblies is not supported. /// [Event(4023, Message = "Exporting previously imported assemblies is not supported.", Level = EventLevel.Error)] public void ExportingImportsNotSupported() => WriteEvent(4023); @@ -695,7 +695,7 @@ partial class DiagnosticEventSource /// The 'ResponseFileDepthExceeded' diagnostic. /// /// -/// Response file nesting depth exceeded. +/// Fatal: Response file nesting depth exceeded. /// [Event(5000, Message = "Response file nesting depth exceeded.", Level = EventLevel.Critical)] public void ResponseFileDepthExceeded() => WriteEvent(5000); @@ -704,7 +704,7 @@ partial class DiagnosticEventSource /// The 'ErrorReadingFile' diagnostic. /// /// -/// Unable to read file: {arg0}. ({arg1}) +/// Fatal: Unable to read file: {arg0}. ({arg1}) /// [Event(5001, Message = "Unable to read file: {0}. ({1})", Level = EventLevel.Critical)] public void ErrorReadingFile(string arg0, string arg1) => WriteEvent(5001, arg0, arg1); @@ -713,7 +713,7 @@ partial class DiagnosticEventSource /// The 'NoTargetsFound' diagnostic. /// /// -/// No targets found +/// Fatal: No targets found /// [Event(5002, Message = "No targets found", Level = EventLevel.Critical)] public void NoTargetsFound() => WriteEvent(5002); @@ -722,7 +722,7 @@ partial class DiagnosticEventSource /// The 'FileFormatLimitationExceeded' diagnostic. /// /// -/// File format limitation exceeded: {arg0}. +/// Fatal: File format limitation exceeded: {arg0}. /// [Event(5003, Message = "File format limitation exceeded: {0}.", Level = EventLevel.Critical)] public void FileFormatLimitationExceeded(string arg0) => WriteEvent(5003, arg0); @@ -731,7 +731,7 @@ partial class DiagnosticEventSource /// The 'CannotSpecifyBothKeyFileAndContainer' diagnostic. /// /// -/// You cannot specify both a key file and container. +/// Fatal: You cannot specify both a key file and container. /// [Event(5004, Message = "You cannot specify both a key file and container.", Level = EventLevel.Critical)] public void CannotSpecifyBothKeyFileAndContainer() => WriteEvent(5004); @@ -740,7 +740,7 @@ partial class DiagnosticEventSource /// The 'DelaySignRequiresKey' diagnostic. /// /// -/// You cannot delay sign without a key file or container. +/// Fatal: You cannot delay sign without a key file or container. /// [Event(5005, Message = "You cannot delay sign without a key file or container.", Level = EventLevel.Critical)] public void DelaySignRequiresKey() => WriteEvent(5005); @@ -749,7 +749,7 @@ partial class DiagnosticEventSource /// The 'InvalidStrongNameKeyPair' diagnostic. /// /// -/// Invalid key {arg0} specified. ("{arg1}") +/// Fatal: Invalid key {arg0} specified. ("{arg1}") /// [Event(5006, Message = "Invalid key {0} specified. (\"{1}\")", Level = EventLevel.Critical)] public void InvalidStrongNameKeyPair(string arg0, string arg1) => WriteEvent(5006, arg0, arg1); @@ -758,7 +758,7 @@ partial class DiagnosticEventSource /// The 'ReferenceNotFound' diagnostic. /// /// -/// Reference not found: {arg0} +/// Fatal: Reference not found: {arg0} /// [Event(5007, Message = "Reference not found: {0}", Level = EventLevel.Critical)] public void ReferenceNotFound(string arg0) => WriteEvent(5007, arg0); @@ -767,7 +767,7 @@ partial class DiagnosticEventSource /// The 'OptionsMustPreceedChildLevels' diagnostic. /// /// -/// You can only specify options before any child levels. +/// Fatal: You can only specify options before any child levels. /// [Event(5008, Message = "You can only specify options before any child levels.", Level = EventLevel.Critical)] public void OptionsMustPreceedChildLevels() => WriteEvent(5008); @@ -776,7 +776,7 @@ partial class DiagnosticEventSource /// The 'UnrecognizedTargetType' diagnostic. /// /// -/// Invalid value '{arg0}' for -target option. +/// Fatal: Invalid value '{arg0}' for -target option. /// [Event(5009, Message = "Invalid value \'{0}\' for -target option.", Level = EventLevel.Critical)] public void UnrecognizedTargetType(string arg0) => WriteEvent(5009, arg0); @@ -785,7 +785,7 @@ partial class DiagnosticEventSource /// The 'UnrecognizedPlatform' diagnostic. /// /// -/// Invalid value '{arg0}' for -platform option. +/// Fatal: Invalid value '{arg0}' for -platform option. /// [Event(5010, Message = "Invalid value \'{0}\' for -platform option.", Level = EventLevel.Critical)] public void UnrecognizedPlatform(string arg0) => WriteEvent(5010, arg0); @@ -794,7 +794,7 @@ partial class DiagnosticEventSource /// The 'UnrecognizedApartment' diagnostic. /// /// -/// Invalid value '{arg0}' for -apartment option. +/// Fatal: Invalid value '{arg0}' for -apartment option. /// [Event(5011, Message = "Invalid value \'{0}\' for -apartment option.", Level = EventLevel.Critical)] public void UnrecognizedApartment(string arg0) => WriteEvent(5011, arg0); @@ -803,7 +803,7 @@ partial class DiagnosticEventSource /// The 'MissingFileSpecification' diagnostic. /// /// -/// Missing file specification for '{arg0}' option. +/// Fatal: Missing file specification for '{arg0}' option. /// [Event(5012, Message = "Missing file specification for \'{0}\' option.", Level = EventLevel.Critical)] public void MissingFileSpecification(string arg0) => WriteEvent(5012, arg0); @@ -812,7 +812,7 @@ partial class DiagnosticEventSource /// The 'PathTooLong' diagnostic. /// /// -/// Path too long: {arg0}. +/// Fatal: Path too long: {arg0}. /// [Event(5013, Message = "Path too long: {0}.", Level = EventLevel.Critical)] public void PathTooLong(string arg0) => WriteEvent(5013, arg0); @@ -821,7 +821,7 @@ partial class DiagnosticEventSource /// The 'PathNotFound' diagnostic. /// /// -/// Path not found: {arg0}. +/// Fatal: Path not found: {arg0}. /// [Event(5014, Message = "Path not found: {0}.", Level = EventLevel.Critical)] public void PathNotFound(string arg0) => WriteEvent(5014, arg0); @@ -830,7 +830,7 @@ partial class DiagnosticEventSource /// The 'InvalidPath' diagnostic. /// /// -/// Invalid path: {arg0}. +/// Fatal: Invalid path: {arg0}. /// [Event(5015, Message = "Invalid path: {0}.", Level = EventLevel.Critical)] public void InvalidPath(string arg0) => WriteEvent(5015, arg0); @@ -839,7 +839,7 @@ partial class DiagnosticEventSource /// The 'InvalidOptionSyntax' diagnostic. /// /// -/// Invalid option: {arg0}. +/// Fatal: Invalid option: {arg0}. /// [Event(5016, Message = "Invalid option: {0}.", Level = EventLevel.Critical)] public void InvalidOptionSyntax(string arg0) => WriteEvent(5016, arg0); @@ -848,7 +848,7 @@ partial class DiagnosticEventSource /// The 'ExternalResourceNotFound' diagnostic. /// /// -/// External resource file does not exist: {arg0}. +/// Fatal: External resource file does not exist: {arg0}. /// [Event(5017, Message = "External resource file does not exist: {0}.", Level = EventLevel.Critical)] public void ExternalResourceNotFound(string arg0) => WriteEvent(5017, arg0); @@ -857,7 +857,7 @@ partial class DiagnosticEventSource /// The 'ExternalResourceNameInvalid' diagnostic. /// /// -/// External resource file may not include path specification: {arg0}. +/// Fatal: External resource file may not include path specification: {arg0}. /// [Event(5018, Message = "External resource file may not include path specification: {0}.", Level = EventLevel.Critical)] public void ExternalResourceNameInvalid(string arg0) => WriteEvent(5018, arg0); @@ -866,7 +866,7 @@ partial class DiagnosticEventSource /// The 'InvalidVersionFormat' diagnostic. /// /// -/// Invalid version specified: {arg0}. +/// Fatal: Invalid version specified: {arg0}. /// [Event(5019, Message = "Invalid version specified: {0}.", Level = EventLevel.Critical)] public void InvalidVersionFormat(string arg0) => WriteEvent(5019, arg0); @@ -875,7 +875,7 @@ partial class DiagnosticEventSource /// The 'InvalidFileAlignment' diagnostic. /// /// -/// Invalid value '{arg0}' for -filealign option. +/// Fatal: Invalid value '{arg0}' for -filealign option. /// [Event(5020, Message = "Invalid value \'{0}\' for -filealign option.", Level = EventLevel.Critical)] public void InvalidFileAlignment(string arg0) => WriteEvent(5020, arg0); @@ -884,7 +884,7 @@ partial class DiagnosticEventSource /// The 'ErrorWritingFile' diagnostic. /// /// -/// Unable to write file: {arg0}. ({arg1}) +/// Fatal: Unable to write file: {arg0}. ({arg1}) /// [Event(5021, Message = "Unable to write file: {0}. ({1})", Level = EventLevel.Critical)] public void ErrorWritingFile(string arg0, string arg1) => WriteEvent(5021, arg0, arg1); @@ -893,7 +893,7 @@ partial class DiagnosticEventSource /// The 'UnrecognizedOption' diagnostic. /// /// -/// Unrecognized option: {arg0}. +/// Fatal: Unrecognized option: {arg0}. /// [Event(5022, Message = "Unrecognized option: {0}.", Level = EventLevel.Critical)] public void UnrecognizedOption(string arg0) => WriteEvent(5022, arg0); @@ -902,7 +902,7 @@ partial class DiagnosticEventSource /// The 'NoOutputFileSpecified' diagnostic. /// /// -/// No output file specified. +/// Fatal: No output file specified. /// [Event(5023, Message = "No output file specified.", Level = EventLevel.Critical)] public void NoOutputFileSpecified() => WriteEvent(5023); @@ -911,7 +911,7 @@ partial class DiagnosticEventSource /// The 'SharedClassLoaderCannotBeUsedOnModuleTarget' diagnostic. /// /// -/// Incompatible options: -target:module and -sharedclassloader cannot be combined. +/// Fatal: Incompatible options: -target:module and -sharedclassloader cannot be combined. /// [Event(5024, Message = "Incompatible options: -target:module and -sharedclassloader cannot be combined.", Level = EventLevel.Critical)] public void SharedClassLoaderCannotBeUsedOnModuleTarget() => WriteEvent(5024); @@ -920,7 +920,7 @@ partial class DiagnosticEventSource /// The 'RuntimeNotFound' diagnostic. /// /// -/// Unable to load runtime assembly. +/// Fatal: Unable to load runtime assembly. /// [Event(5025, Message = "Unable to load runtime assembly.", Level = EventLevel.Critical)] public void RuntimeNotFound() => WriteEvent(5025); @@ -929,7 +929,7 @@ partial class DiagnosticEventSource /// The 'MainClassRequiresExe' diagnostic. /// /// -/// Main class cannot be specified for library or module. +/// Fatal: Main class cannot be specified for library or module. /// [Event(5026, Message = "Main class cannot be specified for library or module.", Level = EventLevel.Critical)] public void MainClassRequiresExe() => WriteEvent(5026); @@ -938,7 +938,7 @@ partial class DiagnosticEventSource /// The 'ExeRequiresMainClass' diagnostic. /// /// -/// No main method found. +/// Fatal: No main method found. /// [Event(5027, Message = "No main method found.", Level = EventLevel.Critical)] public void ExeRequiresMainClass() => WriteEvent(5027); @@ -947,7 +947,7 @@ partial class DiagnosticEventSource /// The 'PropertiesRequireExe' diagnostic. /// /// -/// Properties cannot be specified for library or module. +/// Fatal: Properties cannot be specified for library or module. /// [Event(5028, Message = "Properties cannot be specified for library or module.", Level = EventLevel.Critical)] public void PropertiesRequireExe() => WriteEvent(5028); @@ -956,7 +956,7 @@ partial class DiagnosticEventSource /// The 'ModuleCannotHaveClassLoader' diagnostic. /// /// -/// Cannot specify assembly class loader for modules. +/// Fatal: Cannot specify assembly class loader for modules. /// [Event(5029, Message = "Cannot specify assembly class loader for modules.", Level = EventLevel.Critical)] public void ModuleCannotHaveClassLoader() => WriteEvent(5029); @@ -965,7 +965,7 @@ partial class DiagnosticEventSource /// The 'ErrorParsingMapFile' diagnostic. /// /// -/// Unable to parse remap file: {arg0}. ({arg1}) +/// Fatal: Unable to parse remap file: {arg0}. ({arg1}) /// [Event(5030, Message = "Unable to parse remap file: {0}. ({1})", Level = EventLevel.Critical)] public void ErrorParsingMapFile(string arg0, string arg1) => WriteEvent(5030, arg0, arg1); @@ -974,7 +974,7 @@ partial class DiagnosticEventSource /// The 'BootstrapClassesMissing' diagnostic. /// /// -/// Bootstrap classes missing and core assembly not found. +/// Fatal: Bootstrap classes missing and core assembly not found. /// [Event(5031, Message = "Bootstrap classes missing and core assembly not found.", Level = EventLevel.Critical)] public void BootstrapClassesMissing() => WriteEvent(5031); @@ -983,7 +983,7 @@ partial class DiagnosticEventSource /// The 'StrongNameRequiresStrongNamedRefs' diagnostic. /// /// -/// All referenced assemblies must be strong named, to be able to sign the output assembly. +/// Fatal: All referenced assemblies must be strong named, to be able to sign the output assembly. /// [Event(5032, Message = "All referenced assemblies must be strong named, to be able to sign the output ass" + "embly.", Level = EventLevel.Critical)] @@ -993,7 +993,7 @@ partial class DiagnosticEventSource /// The 'MainClassNotFound' diagnostic. /// /// -/// Main class not found. +/// Fatal: Main class not found. /// [Event(5033, Message = "Main class not found.", Level = EventLevel.Critical)] public void MainClassNotFound() => WriteEvent(5033); @@ -1002,7 +1002,7 @@ partial class DiagnosticEventSource /// The 'MainMethodNotFound' diagnostic. /// /// -/// Main method not found. +/// Fatal: Main method not found. /// [Event(5034, Message = "Main method not found.", Level = EventLevel.Critical)] public void MainMethodNotFound() => WriteEvent(5034); @@ -1011,7 +1011,7 @@ partial class DiagnosticEventSource /// The 'UnsupportedMainMethod' diagnostic. /// /// -/// Redirected main method not supported. +/// Fatal: Redirected main method not supported. /// [Event(5035, Message = "Redirected main method not supported.", Level = EventLevel.Critical)] public void UnsupportedMainMethod() => WriteEvent(5035); @@ -1020,7 +1020,7 @@ partial class DiagnosticEventSource /// The 'ExternalMainNotAccessible' diagnostic. /// /// -/// External main method must be public and in a public class. +/// Fatal: External main method must be public and in a public class. /// [Event(5036, Message = "External main method must be public and in a public class.", Level = EventLevel.Critical)] public void ExternalMainNotAccessible() => WriteEvent(5036); @@ -1029,7 +1029,7 @@ partial class DiagnosticEventSource /// The 'ClassLoaderNotFound' diagnostic. /// /// -/// Custom assembly class loader class not found. +/// Fatal: Custom assembly class loader class not found. /// [Event(5037, Message = "Custom assembly class loader class not found.", Level = EventLevel.Critical)] public void ClassLoaderNotFound() => WriteEvent(5037); @@ -1038,7 +1038,7 @@ partial class DiagnosticEventSource /// The 'ClassLoaderNotAccessible' diagnostic. /// /// -/// Custom assembly class loader class is not accessible. +/// Fatal: Custom assembly class loader class is not accessible. /// [Event(5038, Message = "Custom assembly class loader class is not accessible.", Level = EventLevel.Critical)] public void ClassLoaderNotAccessible() => WriteEvent(5038); @@ -1047,7 +1047,7 @@ partial class DiagnosticEventSource /// The 'ClassLoaderIsAbstract' diagnostic. /// /// -/// Custom assembly class loader class is abstract. +/// Fatal: Custom assembly class loader class is abstract. /// [Event(5039, Message = "Custom assembly class loader class is abstract.", Level = EventLevel.Critical)] public void ClassLoaderIsAbstract() => WriteEvent(5039); @@ -1056,7 +1056,7 @@ partial class DiagnosticEventSource /// The 'ClassLoaderNotClassLoader' diagnostic. /// /// -/// Custom assembly class loader class does not extend java.lang.ClassLoader. +/// Fatal: Custom assembly class loader class does not extend java.lang.ClassLoader. /// [Event(5040, Message = "Custom assembly class loader class does not extend java.lang.ClassLoader.", Level = EventLevel.Critical)] public void ClassLoaderNotClassLoader() => WriteEvent(5040); @@ -1065,7 +1065,7 @@ partial class DiagnosticEventSource /// The 'ClassLoaderConstructorMissing' diagnostic. /// /// -/// Custom assembly class loader constructor is missing. +/// Fatal: Custom assembly class loader constructor is missing. /// [Event(5041, Message = "Custom assembly class loader constructor is missing.", Level = EventLevel.Critical)] public void ClassLoaderConstructorMissing() => WriteEvent(5041); @@ -1074,7 +1074,7 @@ partial class DiagnosticEventSource /// The 'MapFileTypeNotFound' diagnostic. /// /// -/// Type '{arg0}' referenced in remap file was not found. +/// Fatal: Type '{arg0}' referenced in remap file was not found. /// [Event(5042, Message = "Type \'{0}\' referenced in remap file was not found.", Level = EventLevel.Critical)] public void MapFileTypeNotFound(string arg0) => WriteEvent(5042, arg0); @@ -1083,7 +1083,7 @@ partial class DiagnosticEventSource /// The 'MapFileClassNotFound' diagnostic. /// /// -/// Class '{arg0}' referenced in remap file was not found. +/// Fatal: Class '{arg0}' referenced in remap file was not found. /// [Event(5043, Message = "Class \'{0}\' referenced in remap file was not found.", Level = EventLevel.Critical)] public void MapFileClassNotFound(string arg0) => WriteEvent(5043, arg0); @@ -1092,7 +1092,7 @@ partial class DiagnosticEventSource /// The 'MaximumErrorCountReached' diagnostic. /// /// -/// Maximum error count reached. +/// Fatal: Maximum error count reached. /// [Event(5044, Message = "Maximum error count reached.", Level = EventLevel.Critical)] public void MaximumErrorCountReached() => WriteEvent(5044); @@ -1101,7 +1101,7 @@ partial class DiagnosticEventSource /// The 'LinkageError' diagnostic. /// /// -/// Link error: {arg0} +/// Fatal: Link error: {arg0} /// [Event(5045, Message = "Link error: {0}", Level = EventLevel.Critical)] public void LinkageError(string arg0) => WriteEvent(5045, arg0); @@ -1110,7 +1110,7 @@ partial class DiagnosticEventSource /// The 'RuntimeMismatch' diagnostic. /// /// -/// Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} +/// Fatal: Referenced assembly {referencedAssemblyPath} was compiled with an incompatible IKVM.Runtime version. Current runtime: {runtimeAssemblyName}. Referenced assembly runtime: {referencedAssemblyName} /// [Event(5046, Message = "Referenced assembly {0} was compiled with an incompatible IKVM.Runtime version. C" + "urrent runtime: {1}. Referenced assembly runtime: {2}", Level = EventLevel.Critical)] @@ -1120,7 +1120,7 @@ partial class DiagnosticEventSource /// The 'RuntimeMismatchStrongName' diagnostic. /// /// -/// +/// Fatal: /// [Event(5047, Message = "", Level = EventLevel.Critical)] public void RuntimeMismatchStrongName() => WriteEvent(5047); @@ -1129,7 +1129,7 @@ partial class DiagnosticEventSource /// The 'CoreClassesMissing' diagnostic. /// /// -/// Failed to find core classes in core library. +/// Fatal: Failed to find core classes in core library. /// [Event(5048, Message = "Failed to find core classes in core library.", Level = EventLevel.Critical)] public void CoreClassesMissing() => WriteEvent(5048); @@ -1138,7 +1138,7 @@ partial class DiagnosticEventSource /// The 'CriticalClassNotFound' diagnostic. /// /// -/// Unable to load critical class '{arg0}'. +/// Fatal: Unable to load critical class '{arg0}'. /// [Event(5049, Message = "Unable to load critical class \'{0}\'.", Level = EventLevel.Critical)] public void CriticalClassNotFound(string arg0) => WriteEvent(5049, arg0); @@ -1147,7 +1147,7 @@ partial class DiagnosticEventSource /// The 'AssemblyContainsDuplicateClassNames' diagnostic. /// /// -/// Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) +/// Fatal: Type '{arg0}' and '{arg1}' both map to the same name '{arg2}'. ({arg3}) /// [Event(5050, Message = "Type \'{0}\' and \'{1}\' both map to the same name \'{2}\'. ({3})", Level = EventLevel.Critical)] public void AssemblyContainsDuplicateClassNames(string arg0, string arg1, string arg2, string arg3) => WriteEvent(5050, arg0, arg1, arg2, arg3); @@ -1156,7 +1156,7 @@ partial class DiagnosticEventSource /// The 'CallerIDRequiresHasCallerIDAnnotation' diagnostic. /// /// -/// CallerID.getCallerID() requires a HasCallerID annotation. +/// Fatal: CallerID.getCallerID() requires a HasCallerID annotation. /// [Event(5051, Message = "CallerID.getCallerID() requires a HasCallerID annotation.", Level = EventLevel.Critical)] public void CallerIDRequiresHasCallerIDAnnotation() => WriteEvent(5051); @@ -1165,7 +1165,7 @@ partial class DiagnosticEventSource /// The 'UnableToResolveInterface' diagnostic. /// /// -/// Unable to resolve interface '{arg0}' on type '{arg1}'. +/// Fatal: Unable to resolve interface '{arg0}' on type '{arg1}'. /// [Event(5052, Message = "Unable to resolve interface \'{0}\' on type \'{1}\'.", Level = EventLevel.Critical)] public void UnableToResolveInterface(string arg0, string arg1) => WriteEvent(5052, arg0, arg1); @@ -1174,7 +1174,7 @@ partial class DiagnosticEventSource /// The 'MissingBaseType' diagnostic. /// /// -/// The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. +/// Fatal: The base class or interface '{arg0}' in assembly '{arg1}' referenced by type '{arg2}' in '{arg3}' could not be resolved. /// [Event(5053, Message = "The base class or interface \'{0}\' in assembly \'{1}\' referenced by type \'{2}\' in \'" + "{3}\' could not be resolved.", Level = EventLevel.Critical)] @@ -1184,7 +1184,7 @@ partial class DiagnosticEventSource /// The 'MissingBaseTypeReference' diagnostic. /// /// -/// The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. +/// Fatal: The type '{arg0}' is defined in an assembly that is not referenced. You must add a reference to assembly '{arg1}'. /// [Event(5054, Message = "The type \'{0}\' is defined in an assembly that is not referenced. You must add a r" + "eference to assembly \'{1}\'.", Level = EventLevel.Critical)] @@ -1194,7 +1194,7 @@ partial class DiagnosticEventSource /// The 'FileNotFound' diagnostic. /// /// -/// File not found: {arg0}. +/// Fatal: File not found: {arg0}. /// [Event(5055, Message = "File not found: {0}.", Level = EventLevel.Critical)] public void FileNotFound(string arg0) => WriteEvent(5055, arg0); @@ -1203,7 +1203,7 @@ partial class DiagnosticEventSource /// The 'RuntimeMethodMissing' diagnostic. /// /// -/// Runtime method '{arg0}' not found. +/// Fatal: Runtime method '{arg0}' not found. /// [Event(5056, Message = "Runtime method \'{0}\' not found.", Level = EventLevel.Critical)] public void RuntimeMethodMissing(string arg0) => WriteEvent(5056, arg0); @@ -1212,7 +1212,7 @@ partial class DiagnosticEventSource /// The 'MapFileFieldNotFound' diagnostic. /// /// -/// Field '{arg0}' referenced in remap file was not found in class '{arg1}'. +/// Fatal: Field '{arg0}' referenced in remap file was not found in class '{arg1}'. /// [Event(5057, Message = "Field \'{0}\' referenced in remap file was not found in class \'{1}\'.", Level = EventLevel.Critical)] public void MapFileFieldNotFound(string arg0, string arg1) => WriteEvent(5057, arg0, arg1); @@ -1221,7 +1221,7 @@ partial class DiagnosticEventSource /// The 'GhostInterfaceMethodMissing' diagnostic. /// /// -/// Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) +/// Fatal: Remapped class '{arg0}' does not implement ghost interface method. ({arg1}.{arg2}{arg3}) /// [Event(5058, Message = "Remapped class \'{0}\' does not implement ghost interface method. ({1}.{2}{3})", Level = EventLevel.Critical)] public void GhostInterfaceMethodMissing(string arg0, string arg1, string arg2, string arg3) => WriteEvent(5058, arg0, arg1, arg2, arg3); @@ -1230,7 +1230,7 @@ partial class DiagnosticEventSource /// The 'ModuleInitializerMethodRequirements' diagnostic. /// /// -/// Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. +/// Fatal: Method '{arg1}.{arg2}{arg3}' does not meet the requirements of a module initializer. /// [Event(5059, Message = "Method \'{0}.{1}{2}\' does not meet the requirements of a module initializer.", Level = EventLevel.Critical)] public void ModuleInitializerMethodRequirements(string arg1, string arg2, string arg3) => WriteEvent(5059, arg1, arg2, arg3); @@ -1239,16 +1239,26 @@ partial class DiagnosticEventSource /// The 'InvalidZip' diagnostic. /// /// -/// Invalid zip: {name}. +/// Fatal: Invalid zip: {name}. /// [Event(5060, Message = "Invalid zip: {0}.", Level = EventLevel.Critical)] public void InvalidZip(string name) => WriteEvent(5060, name); + /// + /// The 'CoreAssemblyVersionMismatch' diagnostic. + /// + /// +/// Fatal: Unable to load assembly '{0}' as it depends on a higher version of {1} than the one currently loaded. + /// + [Event(5061, Message = "Unable to load assembly \'{-1}\' as it depends on a higher version of {-1} than the" + + " one currently loaded.", Level = EventLevel.Critical)] + public void CoreAssemblyVersionMismatch(string arg0, string arg1) => WriteEvent(5061, arg0, arg1); + /// /// The 'GenericRuntimeTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// [Event(6000, Message = "{0}", Level = EventLevel.Verbose)] public void GenericRuntimeTrace(string arg0) => WriteEvent(6000, arg0); @@ -1257,7 +1267,7 @@ partial class DiagnosticEventSource /// The 'GenericJniTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// [Event(6001, Message = "{0}", Level = EventLevel.Verbose)] public void GenericJniTrace(string arg0) => WriteEvent(6001, arg0); @@ -1266,7 +1276,7 @@ partial class DiagnosticEventSource /// The 'GenericCompilerTrace' diagnostic. /// /// -/// {arg0} +/// Trace: {arg0} /// [Event(6002, Message = "{0}", Level = EventLevel.Verbose)] public void GenericCompilerTrace(string arg0) => WriteEvent(6002, arg0); diff --git a/src/IKVM.CoreLib/Diagnostics/Tracing/DiagnosticEventSource.g.tt b/src/IKVM.CoreLib/Diagnostics/Tracing/DiagnosticEventSource.g.tt index 8bf9d174f4..c689e2f47c 100644 --- a/src/IKVM.CoreLib/Diagnostics/Tracing/DiagnosticEventSource.g.tt +++ b/src/IKVM.CoreLib/Diagnostics/Tracing/DiagnosticEventSource.g.tt @@ -38,6 +38,8 @@ foreach (var kvp in DiagnosticFile.Read(Host.ResolvePath(Path.Combine("..", "Dia var level = kvp.Value.Level; if (level == "Fatal") level = "Critical"; + if (level == "Info") + level = "Informational"; if (level == "Trace") level = "Verbose"; @@ -59,7 +61,7 @@ foreach (var kvp in DiagnosticFile.Read(Host.ResolvePath(Path.Combine("..", "Dia /// <#= desc #> /// /// -<#= Util.ToCommentString(kvp.Value.Message) #> +<#= Util.ToCommentString(kvp.Value) #> /// [Event(<#= kvp.Value.Id #>, Message = <#= Util.ToStringLiteral(string.Join("", message)) #>, Level = EventLevel.<#= level #>)] public void <#= kvp.Key #>(<#= string.Join(", ", argDecl) #>) => WriteEvent(<#= string.Join(", ", argList) #>); diff --git a/src/IKVM.CoreLib/IKVM.CoreLib.csproj b/src/IKVM.CoreLib/IKVM.CoreLib.csproj index 13dcd4e99f..3a83c6cffd 100644 --- a/src/IKVM.CoreLib/IKVM.CoreLib.csproj +++ b/src/IKVM.CoreLib/IKVM.CoreLib.csproj @@ -5,6 +5,38 @@ enable true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -20,11 +52,17 @@ - + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + + diff --git a/src/IKVM.CoreLib/IkvmReflection/IkvmReflectionExtensions.cs b/src/IKVM.CoreLib/IkvmReflection/IkvmReflectionExtensions.cs new file mode 100644 index 0000000000..57fcc97302 --- /dev/null +++ b/src/IKVM.CoreLib/IkvmReflection/IkvmReflectionExtensions.cs @@ -0,0 +1,26 @@ +using IKVM.Reflection; + +namespace IKVM.CoreLib.IkvmReflection +{ + + public static class IkvmReflectionExtensions + { + + /// + /// Gets the parameters types of the specified method or constructor. + /// + /// + /// + public static Type[] GetParameterTypes(this MethodBase method) + { + var p = method.GetParameters(); + var a = p.Length > 0 ? new Type[p.Length] : []; + for (int i = 0; i < p.Length; i++) + a[i] = p[i].ParameterType; + + return a; + } + + } + +} diff --git a/src/IKVM.CoreLib/Reflection/AssemblyNameEqualityComparer.cs b/src/IKVM.CoreLib/Reflection/AssemblyNameEqualityComparer.cs new file mode 100644 index 0000000000..fe1a16f44e --- /dev/null +++ b/src/IKVM.CoreLib/Reflection/AssemblyNameEqualityComparer.cs @@ -0,0 +1,130 @@ +using System; +using System.Collections.Generic; +using System.Reflection; + +namespace IKVM.CoreLib.Reflection +{ + + class AssemblyNameEqualityComparer : IEqualityComparer + { + + /// + /// Gets the default instance of this comparer. + /// + public static readonly AssemblyNameEqualityComparer Instance = new(); + + /// + /// Initializes a new instance. + /// + public AssemblyNameEqualityComparer() + { + + } + + + /// + public bool Equals(AssemblyName? x, AssemblyName? y) + { + // this expects non-null AssemblyName + if (x == null || y == null) + return false; + + if (ReferenceEquals(x, y)) + return true; + + if (x.Name != null && y.Name != null) + { + if (string.Compare(x.Name, y.Name, StringComparison.OrdinalIgnoreCase) != 0) + return false; + } + else if (!(x.Name == null && y.Name == null)) + { + return false; + } + + if (x.Version != null && y.Version != null) + { + if (x.Version != y.Version) + return false; + } + else if (!(x.Version == null && y.Version == null)) + { + return false; + } + + if (x.CultureInfo != null && y.CultureInfo != null) + { + if (!x.CultureInfo.Equals(y.CultureInfo)) + return false; + } + else if (!(x.CultureInfo == null && y.CultureInfo == null)) + { + return false; + } + + var xArray = x.GetPublicKeyToken(); + var yArray = y.GetPublicKeyToken(); + if (!IsSameKeyToken(xArray, yArray)) + return false; + + return true; + } + + /// + public int GetHashCode(AssemblyName obj) + { + int hashcode = 0; + + if (obj.Name != null) + hashcode ^= obj.Name.GetHashCode(); + + if (obj.Version != null) + hashcode ^= obj.Version.GetHashCode(); + + if (obj.CultureInfo != null) + hashcode ^= obj.CultureInfo.GetHashCode(); + + var objArray = obj.GetPublicKeyToken(); + if (objArray != null) + { + // distinguishing no PKToken from "PKToken = null" which is an array of length=0 + hashcode ^= objArray.Length.GetHashCode() + 1; + if (objArray.Length > 0) + hashcode ^= BitConverter.ToUInt64(objArray, 0).GetHashCode(); + } + + return hashcode; + } + + static bool IsSameKeyToken(byte[]? reqKeyToken, byte[]? curKeyToken) + { + bool isSame = false; + + if (reqKeyToken == null && curKeyToken == null) + { + // Both Key Tokens are not set, treat them as same. + isSame = true; + } + else if (reqKeyToken != null && curKeyToken != null) + { + // Both KeyTokens are set. + if (reqKeyToken.Length == curKeyToken.Length) + { + isSame = true; + for (int i = 0; i < reqKeyToken.Length; i++) + { + if (reqKeyToken[i] != curKeyToken[i]) + { + isSame = false; + break; + } + } + } + } + + return isSame; + } + + } + +} diff --git a/src/IKVM.CoreLib/Reflection/ReflectionExtensions.cs b/src/IKVM.CoreLib/Reflection/ReflectionExtensions.cs new file mode 100644 index 0000000000..263c938be2 --- /dev/null +++ b/src/IKVM.CoreLib/Reflection/ReflectionExtensions.cs @@ -0,0 +1,839 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq.Expressions; +using System.Reflection; +using System.Reflection.Emit; +using System.Reflection.Metadata.Ecma335; + +namespace IKVM.CoreLib.Reflection +{ + + static class ReflectionExtensions + { + + static readonly ParameterExpression _constructorInfoParameter = Expression.Parameter(typeof(ConstructorInfo), "p"); + static readonly ParameterExpression _methodInfoParameter = Expression.Parameter(typeof(MethodInfo), "p"); + static readonly ParameterExpression _fieldInfoParameter = Expression.Parameter(typeof(FieldInfo), "p"); + + static readonly ParameterExpression _assemblyBuilderRuntimeAssemblyParameter = Expression.Parameter(typeof(AssemblyBuilder), "p"); + static readonly ParameterExpression _propertyBuilderParameter = Expression.Parameter(typeof(PropertyBuilder), "p"); + static readonly ParameterExpression _eventBuilderParameter = Expression.Parameter(typeof(EventBuilder), "p"); + static readonly ParameterExpression _parameterBuilderParameter = Expression.Parameter(typeof(ParameterBuilder), "p"); + + static readonly Type _methodBuilderInstantiationType = typeof(TypeBuilder).Assembly.GetType("System.Reflection.Emit.MethodBuilderInstantiation", true)!; + static readonly Type _constructorOnTypeBuilderInstantiationType = typeof(TypeBuilder).Assembly.GetType("System.Reflection.Emit.ConstructorOnTypeBuilderInstantiation", true)!; + static readonly Type _methodOnTypeBuilderInstantiationType = typeof(TypeBuilder).Assembly.GetType("System.Reflection.Emit.MethodOnTypeBuilderInstantiation", true)!; + static readonly Type _fieldOnTypeBuilderInstantiationType = typeof(TypeBuilder).Assembly.GetType("System.Reflection.Emit.FieldOnTypeBuilderInstantiation", true)!; + +#if NET + +#if NET8_0_OR_GREATER + + static readonly Type _assemblyBuilderType = typeof(AssemblyBuilder).Assembly.GetType("System.Reflection.Emit.RuntimeAssemblyBuilder", true)!; + static readonly Type _propertyBuilderType = typeof(PropertyBuilder).Assembly.GetType("System.Reflection.Emit.RuntimePropertyBuilder", true)!; + static readonly Type _eventBuilderType = typeof(EventBuilder).Assembly.GetType("System.Reflection.Emit.RuntimeEventBuilder", true)!; + static readonly Type _parameterBuilderType = typeof(ParameterBuilder).Assembly.GetType("System.Reflection.Emit.RuntimeParameterBuilder", true)!; + + static readonly Func _getConstructorOnTypeBuilderInstantiationConstructorFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_constructorInfoParameter, _constructorOnTypeBuilderInstantiationType), + _constructorOnTypeBuilderInstantiationType.GetField("_ctor", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _constructorInfoParameter) + .Compile(); + + static readonly Func _getMethodOnTypeBuilderInstantiationMethodFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_methodInfoParameter, _methodOnTypeBuilderInstantiationType), + _methodOnTypeBuilderInstantiationType.GetField("_method", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _methodInfoParameter) + .Compile(); + + static readonly Func _getFieldOnTypeBuilderInstantiationFieldFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_fieldInfoParameter, _fieldOnTypeBuilderInstantiationType), + _fieldOnTypeBuilderInstantiationType.GetField("_field", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _fieldInfoParameter) + .Compile(); + +#else + + static readonly Type _assemblyBuilderType = typeof(AssemblyBuilder).Assembly.GetType("System.Reflection.Emit.AssemblyBuilder", true)!; + static readonly Type _propertyBuilderType = typeof(PropertyBuilder).Assembly.GetType("System.Reflection.Emit.PropertyBuilder", true)!; + static readonly Type _eventBuilderType = typeof(EventBuilder).Assembly.GetType("System.Reflection.Emit.EventBuilder", true)!; + static readonly Type _parameterBuilderType = typeof(ParameterBuilder).Assembly.GetType("System.Reflection.Emit.ParameterBuilder", true)!; + + static readonly Func _getConstructorOnTypeBuilderInstantiationConstructorFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_constructorInfoParameter, _constructorOnTypeBuilderInstantiationType), + _constructorOnTypeBuilderInstantiationType.GetField("m_ctor", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _constructorInfoParameter) + .Compile(); + + static readonly Func _getMethodOnTypeBuilderInstantiationMethodFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_methodInfoParameter, _methodOnTypeBuilderInstantiationType), + _methodOnTypeBuilderInstantiationType.GetField("m_method", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _methodInfoParameter) + .Compile(); + + static readonly Func _getFieldOnTypeBuilderInstantiationFieldFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_fieldInfoParameter, _fieldOnTypeBuilderInstantiationType), + _fieldOnTypeBuilderInstantiationType.GetField("m_field", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _fieldInfoParameter) + .Compile(); + +#endif + + static readonly Func _getAssemblyBuilderRuntimeAssemblyFunc = Expression.Lambda>( + Expression.Property( + Expression.ConvertChecked(_assemblyBuilderRuntimeAssemblyParameter, _assemblyBuilderType), + _assemblyBuilderType.GetProperty("InternalAssembly", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _assemblyBuilderRuntimeAssemblyParameter) + .Compile(); + + static readonly Func _getPropertyMetadataTokenFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_propertyBuilderParameter, _propertyBuilderType), + _propertyBuilderType.GetField("m_tkProperty", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _propertyBuilderParameter) + .Compile(); + + static readonly Func _getEventMetadataTokenFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_eventBuilderParameter, _eventBuilderType), + _eventBuilderType.GetField("m_evToken", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _eventBuilderParameter) + .Compile(); + + static readonly Func _getParameterMethodBuilderFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_parameterBuilderParameter, _parameterBuilderType), + _parameterBuilderType.GetField("_methodBuilder", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _parameterBuilderParameter) + .Compile(); + + static readonly Func _getParameterMetadataTokenFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_parameterBuilderParameter, _parameterBuilderType), + _parameterBuilderType.GetField("_token", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _parameterBuilderParameter) + .Compile(); + +#else + + static readonly Type _assemblyBuilderType = typeof(AssemblyBuilder).Assembly.GetType("System.Reflection.Emit.AssemblyBuilder", true)!; + static readonly Type _eventBuilderType = typeof(EventBuilder).Assembly.GetType("System.Reflection.Emit.EventBuilder", true)!; + static readonly Type _parameterBuilderType = typeof(ParameterBuilder).Assembly.GetType("System.Reflection.Emit.ParameterBuilder", true)!; + + static readonly Func _getConstructorOnTypeBuilderInstantiationConstructorFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_constructorInfoParameter, _constructorOnTypeBuilderInstantiationType), + _constructorOnTypeBuilderInstantiationType.GetField("m_ctor", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _constructorInfoParameter) + .Compile(); + + static readonly Func _getMethodOnTypeBuilderInstantiationMethodFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_methodInfoParameter, _methodOnTypeBuilderInstantiationType), + _methodOnTypeBuilderInstantiationType.GetField("m_method", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _methodInfoParameter) + .Compile(); + + static readonly Func _getFieldOnTypeBuilderInstantiationFieldFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_fieldInfoParameter, _fieldOnTypeBuilderInstantiationType), + _fieldOnTypeBuilderInstantiationType.GetField("m_field", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _fieldInfoParameter) + .Compile(); + + static readonly Func _getAssemblyBuilderRuntimeAssemblyFunc = Expression.Lambda>( + Expression.Call( + Expression.ConvertChecked(_assemblyBuilderRuntimeAssemblyParameter, _assemblyBuilderType), + _assemblyBuilderType.GetMethod("GetNativeHandle", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _assemblyBuilderRuntimeAssemblyParameter) + .Compile(); + + static readonly Func _getParameterMethodBuilderFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_parameterBuilderParameter, _parameterBuilderType), + _parameterBuilderType.GetField("m_methodBuilder", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _parameterBuilderParameter) + .Compile(); + +#endif + + static readonly Func _getEventModuleBuilderFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_eventBuilderParameter, _eventBuilderType), + _eventBuilderType.GetField("m_module", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _eventBuilderParameter) + .Compile(); + + static readonly Func _getEventTypeBuilderFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_eventBuilderParameter, _eventBuilderType), + _eventBuilderType.GetField("m_type", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _eventBuilderParameter) + .Compile(); + + static readonly Func _getEventNameFunc = Expression.Lambda>( + Expression.Field( + Expression.ConvertChecked(_eventBuilderParameter, _eventBuilderType), + _eventBuilderType.GetField("m_name", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + _eventBuilderParameter) + .Compile(); + + static readonly Func _getEventAttributesFunc = Expression.Lambda>( + Expression.ConvertChecked( + Expression.Field( + Expression.ConvertChecked(_eventBuilderParameter, _eventBuilderType), + _eventBuilderType.GetField("m_attributes", BindingFlags.NonPublic | BindingFlags.Instance) ?? throw new InvalidOperationException()), + typeof(EventAttributes)), + _eventBuilderParameter) + .Compile(); + + /// + /// Gets the type. + /// + public static Type MethodBuilderInstantiationType => _methodBuilderInstantiationType; + + /// + /// Gets the type. + /// + public static Type MethodOnTypeBuilderInstantiationType => _methodOnTypeBuilderInstantiationType; + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + public static int GetMetadataTokenSafe(this Module module) + { + var t = module.MetadataToken; + if (t == 0) + throw new InvalidOperationException(); + + return t; + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this Module module) + { + return MetadataTokens.GetRowNumber(MetadataTokens.EntityHandle(module.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + public static int GetMetadataTokenSafe(this MemberInfo member) + { + return member switch + { + Type t => t.GetMetadataTokenSafe(), + MethodBase m => m.GetMetadataTokenSafe(), + FieldInfo f => f.GetMetadataTokenSafe(), + PropertyInfo p => p.GetMetadataTokenSafe(), + EventInfo e => e.GetMetadataTokenSafe(), + _ => throw new InvalidOperationException(), + }; + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + public static int GetMetadataTokenSafe(this Type type) + { +#if NETFRAMEWORK + if (type is TypeBuilder b) + { + var t = b.TypeToken.Token; + if (t == 0) + throw new InvalidOperationException(); + + return t; + } +#endif + + return type.GetMetadataToken(); + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this Type type) + { + return MetadataTokens.GetRowNumber(MetadataTokens.TypeDefinitionHandle(type.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + public static int GetMetadataTokenSafe(this FieldInfo field) + { +#if NETFRAMEWORK + if (field is FieldBuilder b) + { + var t = b.GetToken().Token; + if (t == 0) + throw new InvalidOperationException(); + + return t; + } +#endif + +#if NET8_0_OR_GREATER || NETFRAMEWORK + // field is instance of FieldOnTypeBuilderInstantiation + if (_fieldOnTypeBuilderInstantiationType.IsInstanceOfType(field)) + { + var f = _getFieldOnTypeBuilderInstantiationFieldFunc(field); + return f.GetMetadataTokenSafe(); + } +#endif + + return field.GetMetadataToken(); + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this FieldInfo field) + { + return MetadataTokens.GetRowNumber(MetadataTokens.FieldDefinitionHandle(field.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + /// + public static int GetMetadataTokenSafe(this MethodBase method) + { + return method switch + { + ConstructorInfo c => c.GetMetadataTokenSafe(), + MethodInfo m => m.GetMetadataTokenSafe(), + _ => throw new InvalidOperationException(), + }; + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this MethodBase method) + { + return method switch + { + ConstructorInfo c => c.GetMetadataTokenRowNumberSafe(), + MethodInfo m => m.GetMetadataTokenRowNumberSafe(), + _ => throw new InvalidOperationException(), + }; + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + public static int GetMetadataTokenSafe(this ConstructorInfo ctor) + { +#if NETFRAMEWORK + if (ctor is ConstructorBuilder b) + { + var t = b.GetToken().Token; + if (t == 0) + throw new InvalidOperationException(); + + return t; + } +#endif + +#if NET8_0_OR_GREATER || NETFRAMEWORK + // ctor is instance of ConstructorOnTypeBuilderInstantiation + if (_constructorOnTypeBuilderInstantiationType.IsInstanceOfType(ctor)) + { + var c = _getConstructorOnTypeBuilderInstantiationConstructorFunc(ctor); + return c.GetMetadataTokenSafe(); + } +#endif + + return ctor.GetMetadataToken(); + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this ConstructorInfo ctor) + { + return MetadataTokens.GetRowNumber(MetadataTokens.MethodDefinitionHandle(ctor.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + public static int GetMetadataTokenSafe(this MethodInfo method) + { +#if NETFRAMEWORK + if (method is MethodBuilder b) + { + var t = b.GetToken().Token; + if (t == 0) + throw new InvalidOperationException(); + + return t; + } +#endif + +#if NET8_0_OR_GREATER || NETFRAMEWORK + // method is instance of MethodOnTypeBuilderInstantiation + if (_methodOnTypeBuilderInstantiationType.IsInstanceOfType(method)) + { + var m = _getMethodOnTypeBuilderInstantiationMethodFunc(method); + return m.GetMetadataTokenSafe(); + } +#endif + +#if NET6_0 + // method is instance of MethodOnTypeBuilderInstantiation + if (_methodOnTypeBuilderInstantiationType.IsInstanceOfType(method)) + { + var m = _getMethodOnTypeBuilderInstantiationMethodFunc(method); + return m.GetMetadataTokenSafe(); + } +#endif + + return method.GetMetadataToken(); + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this MethodInfo method) + { + return MetadataTokens.GetRowNumber(MetadataTokens.MethodDefinitionHandle(method.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + /// + public static int GetMetadataTokenSafe(this PropertyInfo property) + { + if (property is PropertyBuilder b) + { +#if NETFRAMEWORK + var t = b.PropertyToken.Token; +#else + var t = _getPropertyMetadataTokenFunc(b); +#endif + if (t == 0) + throw new InvalidOperationException(); + + return t; + } + + return property.GetMetadataToken(); + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this PropertyInfo property) + { + return MetadataTokens.GetRowNumber(MetadataTokens.PropertyDefinitionHandle(property.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + /// + public static int GetMetadataTokenSafe(this EventInfo @event) + { + return @event.GetMetadataToken(); + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this EventInfo @event) + { + return MetadataTokens.GetRowNumber(MetadataTokens.EventDefinitionHandle(@event.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + /// + /// + public static int GetMetadataToken(this EventBuilder @event) + { +#if NETFRAMEWORK + return @event.GetEventToken().Token; +#else + return _getEventMetadataTokenFunc(@event); +#endif + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + /// + /// + public static int GetMetadataTokenSafe(this EventBuilder @event) + { + var t = @event.GetMetadataToken(); + if (t == 0) + throw new InvalidOperationException(); + + return t; + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this EventBuilder @event) + { + return MetadataTokens.GetRowNumber(MetadataTokens.EventDefinitionHandle(@event.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + /// + public static int GetMetadataTokenSafe(this ParameterInfo parameter) + { + var t = parameter.MetadataToken; + if (t == 0) + throw new InvalidOperationException(); + + return t; + } + + /// + /// Gets the metadata row number for the specified . + /// + /// + /// + public static int GetMetadataTokenRowNumberSafe(this ParameterInfo parameter) + { + return MetadataTokens.GetRowNumber(MetadataTokens.ParameterHandle(parameter.GetMetadataTokenSafe())); + } + + /// + /// Gets the metadata token for the specified . + /// + /// + /// + /// + /// + public static int GetMetadataToken(this ParameterBuilder parameter) + { +#if NETFRAMEWORK + return parameter.GetToken().Token; +#else + return _getParameterMetadataTokenFunc(parameter); +#endif + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static Assembly GetRuntimeAssembly(this AssemblyBuilder assembly) + { + return _getAssemblyBuilderRuntimeAssemblyFunc(assembly); + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static ModuleBuilder GetModuleBuilder(this ParameterBuilder parameter) + { + return (ModuleBuilder)_getParameterMethodBuilderFunc(parameter).Module; + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static TypeBuilder GetTypeBuilder(this ParameterBuilder parameter) + { + return (TypeBuilder?)_getParameterMethodBuilderFunc(parameter).DeclaringType ?? throw new InvalidOperationException(); + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static ModuleBuilder GetModuleBuilder(this FieldBuilder field) + { + return (ModuleBuilder)field.Module; + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static TypeBuilder GetTypeBuilder(this FieldBuilder field) + { + return (TypeBuilder?)field.DeclaringType ?? throw new InvalidOperationException(); + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static ModuleBuilder GetModuleBuilder(this PropertyBuilder property) + { + return (ModuleBuilder)property.Module; + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static TypeBuilder GetTypeBuilder(this PropertyBuilder property) + { + return (TypeBuilder)property.DeclaringType!; + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static ModuleBuilder GetModuleBuilder(this EventBuilder @event) + { + return _getEventModuleBuilderFunc(@event); + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static TypeBuilder GetTypeBuilder(this EventBuilder @event) + { + return _getEventTypeBuilderFunc(@event); + } + + /// + /// Gets the name associated with a . + /// + /// + /// + public static string GetEventName(this EventBuilder @event) + { + return _getEventNameFunc(@event); + } + + /// + /// Gets the attributes associated with a . + /// + /// + /// + public static EventAttributes GetEventAttributes(this EventBuilder @event) + { + return _getEventAttributesFunc(@event); + } + + /// + /// Gets the associated with a . + /// + /// + /// + public static MethodBuilder GetMethodBuilder(this ParameterBuilder parameter) + { + return _getParameterMethodBuilderFunc(parameter); + } + + /// + /// Returns true if the is a SZArray. + /// + /// + /// + public static bool IsSZArray(this Type type) + { +#if NET + return type.IsSZArray; +#else + return type.IsArray && type.Name.EndsWith("[]"); +#endif + } + + /// + /// Gets the parameters types of the specified method or constructor. + /// + /// + /// + public static Type[] GetParameterTypes(this MethodBase method) + { + var p = method.GetParameters(); + var a = new Type[p.Length]; + for (int i = 0; i < p.Length; i++) + a[i] = p[i].ParameterType; + + return a; + } + + /// + /// Implements GetcustomAttributeData with support for examining inheritence. + /// + /// + public static IEnumerable GetCustomAttributesData(this Type type, bool inherit) + { + foreach (var i in type.GetCustomAttributesData()) + yield return i; + + if (inherit) + for (var baseType = type.BaseType; baseType != null; baseType = baseType.BaseType) + foreach (var cad in baseType.GetCustomAttributesData()) + if (cad.AttributeType.GetCustomAttribute()?.Inherited ?? false) + yield return cad; + } + + /// + /// Implements GetcustomAttributeData with support for examining inheritence. + /// + /// + public static IEnumerable GetInheritedCustomAttributesData(this Type type) + { + for (var baseType = type.BaseType; baseType != null; baseType = baseType.BaseType) + foreach (var cad in baseType.GetCustomAttributesData()) + if (cad.AttributeType.GetCustomAttribute()?.Inherited ?? false) + yield return cad; + } + + /// + /// Implements GetcustomAttributeData with support for examining inheritence. + /// + /// + /// + public static IEnumerable GetCustomAttributesData(this MethodInfo method, bool inherit) + { + foreach (var i in method.GetCustomAttributesData()) + yield return i; + + if (inherit) + for (var baseMethod = method.GetBaseDefinition(); baseMethod != null; baseMethod = baseMethod.GetBaseDefinition()) + foreach (var cad in baseMethod.GetCustomAttributesData()) + if (cad.AttributeType.GetCustomAttribute()?.Inherited ?? false) + yield return cad; + } + + /// + /// Implements GetcustomAttributeData with support for examining inheritence. + /// + /// + /// + public static IEnumerable GetInheritedCustomAttributesData(this MethodInfo method) + { + for (var baseMethod = method.GetBaseDefinition(); baseMethod != null; baseMethod = baseMethod.GetBaseDefinition()) + foreach (var cad in baseMethod.GetCustomAttributesData()) + if (cad.AttributeType.GetCustomAttribute()?.Inherited ?? false) + yield return cad; + } + + /// + /// Implements GetcustomAttributeData with support for examining inheritence. + /// + /// + /// + public static IEnumerable GetCustomAttributesData(this MemberInfo member, bool inherit) + { + if (member is Type type) + return GetCustomAttributesData(type, inherit); + + if (member is MethodInfo method) + return GetCustomAttributesData(method, inherit); + + return member.GetCustomAttributesData(); + } + + /// + /// Gets the interfaces that are directly declared on the specified type. The method is imperfect, as + /// GetInterfaceMap provides no way to discover interfaces on a type that have no implementation methods. + /// + /// + /// + public static IReadOnlyList GetDeclaredInterfaces(this Type type) + { + var b = new List(); + + foreach (var iface in type.GetInterfaces()) + if (IsInterfaceDirectlyImplementedOnType(type, iface)) + b.Add(iface); + + return b; + } + + /// + /// Returns true if the is directly implemented by . + /// + /// + /// + /// + static bool IsInterfaceDirectlyImplementedOnType(Type type, Type interfaceType) + { + var map = type.GetInterfaceMap(interfaceType); + + // if any of the target methods are declared on this type, the interface is implemented by this type + foreach (var method in map.TargetMethods) + if (method.DeclaringType == type) + return true; + + return false; + } + + } + +} \ No newline at end of file diff --git a/src/IKVM.CoreLib/Reflection/TypeListEqualityComparer.cs b/src/IKVM.CoreLib/Reflection/TypeListEqualityComparer.cs new file mode 100644 index 0000000000..c7349923bf --- /dev/null +++ b/src/IKVM.CoreLib/Reflection/TypeListEqualityComparer.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Compares two array instances for equality. + /// + class TypeListEqualityComparer : IEqualityComparer + { + + public static readonly TypeListEqualityComparer Instance = new(); + + public bool Equals(Type[]? x, Type[]? y) + { + if (x == y) + return true; + + if (x == null || y == null) + return false; + + if (x.Length != y.Length) + return false; + + for (int i = 0; i < x.Length; i++) + if (x[i] != y[i]) + return false; + + return true; + } + + public int GetHashCode(Type[] obj) + { + int result = 17; + + for (int i = 0; i < obj.Length; i++) + { + unchecked + { + result = result * 41 + obj[i].GetHashCode(); + } + } + + return result; + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/ArrayTypeSymbol.cs b/src/IKVM.CoreLib/Symbols/ArrayTypeSymbol.cs new file mode 100644 index 0000000000..e5e28fa04b --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/ArrayTypeSymbol.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols +{ + + class ArrayTypeSymbol : HasElementSymbol + { + + readonly int _rank; + readonly ImmutableArray _sizes; + readonly ImmutableArray _lowerBounds; + + string? _nameSuffix; + ImmutableArray _interfaces; + ImmutableArray _methods; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + public ArrayTypeSymbol(SymbolContext context, TypeSymbol elementType, int rank, ImmutableArray sizes, ImmutableArray lowerBounds) : + base(context, elementType) + { + _rank = rank; + _sizes = sizes; + _lowerBounds = lowerBounds; + } + + /// + protected override string NameSuffix => _nameSuffix ??= ComputeNameSuffix(); + + /// + /// Computes the value for . + /// + /// + string ComputeNameSuffix() + { + if (_rank == 1) + return "[*]"; + else + return "[" + new string(',', _rank - 1) + "]"; + } + + /// + public sealed override TypeAttributes Attributes => TypeAttributes.AutoLayout | TypeAttributes.AnsiClass | TypeAttributes.Class | TypeAttributes.Public | TypeAttributes.Sealed | TypeAttributes.Serializable; + + /// + public sealed override bool IsArray => true; + + /// + public sealed override TypeSymbol? BaseType => Context.ResolveCoreType("System.Array"); + + /// + public sealed override int GetArrayRank() + { + return _rank; + } + + /// + internal override ImmutableArray GetDeclaredInterfaces() + { + return ImmutableArray.Empty; + } + + /// + internal override ImmutableArray GetDeclaredMethods() + { + if (_methods == default) + { + var int32 = Context.ResolveCoreType("System.Int32"); + + var ctor1Args = ImmutableArray.CreateBuilder(_rank); + var ctor2Args = ImmutableArray.CreateBuilder(_rank * 2); + for (int i = 0; i < _rank; i++) + { + ctor1Args.Add(int32); + ctor2Args.Add(int32); + ctor2Args.Add(int32); + } + + // get and set args start at the same length + var argBuilder = ImmutableArray.CreateBuilder(_rank); + for (int i = 0; i < _rank; i++) + argBuilder.Add(int32); + + var args = argBuilder.DrainToImmutable(); + var getArgs = args; + var setArgs = args.Add(GetElementType()!); // set args takes a value + + ImmutableInterlocked.InterlockedInitialize(ref _methods, + [ + new SyntheticConstructorSymbol(Context, Module, this, MethodAttributes.Public, CallingConventions.Standard | CallingConventions.HasThis, ctor1Args.DrainToImmutable()), + new SyntheticConstructorSymbol(Context, Module, this, MethodAttributes.Public, CallingConventions.Standard | CallingConventions.HasThis, ctor2Args.DrainToImmutable()), + new SyntheticMethodSymbol(Context, Module, this, "Set", MethodAttributes.Public, CallingConventions.Standard | CallingConventions.HasThis, null, setArgs), + new SyntheticMethodSymbol(Context, Module, this, "Address", MethodAttributes.Public, CallingConventions.Standard | CallingConventions.HasThis, GetElementType()!.MakeByRefType(), getArgs), + new SyntheticMethodSymbol(Context, Module, this, "Get", MethodAttributes.Public, CallingConventions.Standard | CallingConventions.HasThis, GetElementType(), getArgs), + ]); + } + + return _methods; + } + + /// + internal override MethodImplementationMapping GetMethodImplementations() + { + return MethodImplementationMapping.CreateEmpty(this); + } + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() + { + return ImmutableArray.Empty; + } + + /// + internal override TypeSymbol Specialize(GenericContext context) + { + if (ContainsGenericParameters == false) + return this; + + var elementType = GetElementType() ?? throw new InvalidOperationException(); + return elementType.Specialize(context).MakeArrayType(GetArrayRank()); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/AssemblyDefinition.cs b/src/IKVM.CoreLib/Symbols/AssemblyDefinition.cs new file mode 100644 index 0000000000..2e92cfde85 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/AssemblyDefinition.cs @@ -0,0 +1,68 @@ +using System.Collections.Immutable; +using System.IO; + +namespace IKVM.CoreLib.Symbols +{ + + abstract class AssemblyDefinition + { + + /// + /// Gets the image runtime version. + /// + /// + public abstract string GetImageRuntimeVersion(); + + /// + /// Gets the location. + /// + /// + public abstract string GetLocation(); + + /// + /// Gets the entry point. + /// + /// + public abstract MethodSymbol? GetEntryPoint(); + + /// + /// Gets the manifest module of this assembly. + /// + /// + public abstract ModuleSymbol GetManifestModule(); + + /// + /// Gets the modules declared of this assembly. + /// + /// + public abstract ImmutableArray GetModules(); + + /// + /// Gets the information about a specific manifest from this assembly. + /// + /// + /// + public abstract ManifestResourceInfo? GetManifestResourceInfo(string resourceName); + + /// + /// Gets a stream to read a manifest resource from this assembly. + /// + /// + /// + public abstract Stream? GetManifestResourceStream(string name); + + /// + /// Gets the referenced assemblies of this assembly. + /// + /// + public abstract ImmutableArray GetReferencedAssemblies(); + + /// + /// Gets the custom attributes of this assembly. + /// + /// + public abstract ImmutableArray GetCustomAttributes(); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/AssemblyIdentity.cs b/src/IKVM.CoreLib/Symbols/AssemblyIdentity.cs new file mode 100644 index 0000000000..847be2426e --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/AssemblyIdentity.cs @@ -0,0 +1,337 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Reflection; +using System.Security.Cryptography; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Represents an identity of an assembly as defined by CLI metadata specification. + /// + public class AssemblyIdentity + { + + /// + /// Determines whether two instances are equal. + /// + /// The operand appearing on the left side of the operator. + /// The operand appearing on the right side of the operator. + public static bool operator ==(AssemblyIdentity? left, AssemblyIdentity? right) + { + return EqualityComparer.Default.Equals(left!, right!); + } + + /// + /// Determines whether two instances are not equal. + /// + /// The operand appearing on the left side of the operator. + /// The operand appearing on the right side of the operator. + public static bool operator !=(AssemblyIdentity? left, AssemblyIdentity? right) + { + return !(left == right); + } + + /// + /// Returns true (false) if specified assembly identities are (not) equal + /// regardless of unification, retargeting or other assembly binding policies. + /// Returns null if these policies must be consulted to determine name equivalence. + /// + public static bool? MemberwiseEqual(AssemblyIdentity x, AssemblyIdentity y) + { + if (ReferenceEquals(x, y)) + return true; + + if (!AssemblyIdentityComparer.SimpleNameComparer.Equals(x._name, y._name)) + return false; + + if (x._version.Equals(y._version) && EqualIgnoringNameAndVersion(x, y)) + return true; + + return null; + } + + /// + /// Returns true if the components of the assembly names, other than name and version, are equal. + /// + /// + /// + /// + public static bool EqualIgnoringNameAndVersion(AssemblyIdentity x, AssemblyIdentity y) + { + return x.ContentType == y.ContentType && AssemblyIdentityComparer.CultureComparer.Equals(x.CultureName, y.CultureName) && KeysEqual(x, y); + } + + /// + /// Returns true if the public keys of both identities are equal. + /// + /// + /// + /// + public static bool KeysEqual(AssemblyIdentity x, AssemblyIdentity y) + { + var xToken = x._publicKeyToken; + var yToken = y._publicKeyToken; + + // weak names or both strong names with initialized PKT - compare tokens: + if (!xToken.IsDefault && !yToken.IsDefault) + return xToken.SequenceEqual(yToken); + + // both are strong names with uninitialized PKT - compare full keys: + if (xToken.IsDefault && yToken.IsDefault) + return x._publicKey.SequenceEqual(y._publicKey); + + // one of the strong names doesn't have PK, other doesn't have PTK initialized. + if (xToken.IsDefault) + return x.PublicKeyToken.SequenceEqual(yToken); + else + return xToken.SequenceEqual(y.PublicKeyToken); + } + + /// + /// Initializes the publickey and publickeytoken values. + /// + /// + /// + /// + /// + static void InitializeKey(ImmutableArray publicKeyOrToken, bool hasPublicKey, out ImmutableArray publicKey, out ImmutableArray publicKeyToken) + { + if (hasPublicKey) + { + publicKey = publicKeyOrToken; + publicKeyToken = default; + } + else + { + publicKey = ImmutableArray.Empty; + publicKeyToken = publicKeyOrToken.IsDefault ? ImmutableArray.Empty : publicKeyOrToken; + } + } + + /// + /// Calculates the public key token from the given public key. + /// + /// + /// + static ImmutableArray CalculatePublicKeyToken(ImmutableArray publicKey) + { + var hash = SHA1.Create().ComputeHash(publicKey.ToArray()); + + // SHA1 hash is always 160 bits: + Debug.Assert(hash.Length == 20); + + // PublicKeyToken is the low 64 bits of the SHA-1 hash of the public key. + int l = hash.Length - 1; + var result = ImmutableArray.CreateBuilder(8); + for (int i = 0; i < 8; i++) + result.Add(hash[l - i]); + + return result.DrainToImmutable(); + } + + /// + /// Parses a span of characters into a assembly name. + /// + /// A span containing the characters representing the assembly name to parse. + /// Parsed type name. + /// Provided assembly name was invalid. + public static AssemblyIdentity Parse(ReadOnlySpan assemblyName) => TryParse(assemblyName, out AssemblyIdentity? result) ? result! : throw new ArgumentException("Invalid assembly name.", nameof(assemblyName)); + + /// + /// Tries to parse a span of characters into an assembly name. + /// + /// A span containing the characters representing the assembly name to parse. + /// Contains the result when parsing succeeds. + /// true if assembly name was converted successfully, otherwise, false. + public static bool TryParse(ReadOnlySpan assemblyName, [NotNullWhen(true)] out AssemblyIdentity? result) + { + AssemblyIdentityParser.AssemblyIdentityParts parts = default; + if (!assemblyName.IsEmpty && AssemblyIdentityParser.TryParse(assemblyName, ref parts)) + { + result = new(parts._name, parts._version, parts._cultureName, parts._publicKeyOrToken?.ToImmutableArray() ?? [], parts._publicKeyOrToken != null); + return true; + } + + result = null; + return false; + } + + readonly string _name; + readonly Version _version; + readonly string? _cultureName; + readonly AssemblyContentType _contentType; + readonly ProcessorArchitecture _processorArchitecture; + + string? _fullName; + ImmutableArray _publicKey; + ImmutableArray _publicKeyToken; + + int _hashCode = 0; + + /// + /// Initializes a new instance of the class. + /// + /// The simple name of the assembly. + /// The version of the assembly. + /// The name of the culture associated with the assembly. + /// The public key or its token. + /// is null. + public AssemblyIdentity(string name, Version? version = null, string? cultureName = null, ImmutableArray publicKeyOrToken = default, bool hasPublicKey = false, AssemblyContentType contentType = default, ProcessorArchitecture processorArchitecture = ProcessorArchitecture.None) + { + _name = name ?? throw new ArgumentNullException(nameof(name)); + _version = version ?? new Version(0, 0, 0, 0); + _cultureName = cultureName; + _contentType = contentType; + _processorArchitecture = processorArchitecture; + InitializeKey(publicKeyOrToken, hasPublicKey, out _publicKey, out _publicKeyToken); + } + + /// + /// Gets the simple name of the assembly. + /// + public string Name => _name; + + /// + /// Gets the version of the assembly. + /// + public Version? Version => _version; + + /// + /// Gets the name of the culture associated with the assembly. + /// + /// + /// Do not create a instance from this string unless + /// you know the string has originated from a trustworthy source. + /// + public string? CultureName => _cultureName; + + /// + /// Returns true if a public key is available. + /// + public bool HasPublicKey => _publicKey.Length > 0; + + /// + /// Gets the public key or the public key token of the assembly. + /// + public ImmutableArray PublicKey => _publicKey; + + /// + /// Low 8 bytes of SHA1 hash of the public key, or empty. + /// + public ImmutableArray PublicKeyToken + { + get + { + if (_publicKeyToken.IsDefault) + ImmutableInterlocked.InterlockedCompareExchange(ref _publicKeyToken, CalculatePublicKeyToken(_publicKey), default); + + return _publicKeyToken; + } + } + + /// + /// Gets the full name of the assembly, also known as the display name. + /// + /// In contrary to it does not validate public key token neither computes it based on the provided public key. + public string FullName => _fullName ??= AssemblyNameFormatter.ComputeDisplayName(Name, Version, CultureName, PublicKeyToken, Flags, ContentType, PublicKey); + + /// + /// Gets the . + /// + public AssemblyNameFlags Flags => HasPublicKey ? AssemblyNameFlags.PublicKey : AssemblyNameFlags.None; + + /// + /// Specifies the binding model for how this object will be treated in comparisons. + /// + public AssemblyContentType ContentType => _contentType; + + /// + /// Gets the processor architecture of the assembly name. + /// + public ProcessorArchitecture ProcessorArchitecture => _processorArchitecture; + + /// + /// True if the assembly identity has a strong name, ie. either a full public key or a token. + /// + public bool IsStrongName => HasPublicKey || _publicKeyToken.Length > 0; + + /// + /// Determines whether the specified instance is equal to the current instance. + /// + /// The object to be compared with the current instance. + public bool Equals(AssemblyIdentity? obj) + { + return !ReferenceEquals(obj, null) && (_hashCode == 0 || obj._hashCode == 0 || _hashCode == obj._hashCode) && MemberwiseEqual(this, obj) == true; + } + + /// + /// Determines whether the specified instance is equal to the current instance. + /// + /// The object to be compared with the current instance. + public override bool Equals(object? obj) + { + return Equals(obj as AssemblyIdentity); + } + + /// + /// Returns the hash code for the current instance. + /// + /// + public override int GetHashCode() + { + if (_hashCode == 0) + { + // Do not include PK/PKT in the hash - collisions on PK/PKT are rare (assembly identities differ only in PKT/PK) + // and we can't calculate hash of PKT if only PK is available + _hashCode = + HashCode.Combine(AssemblyIdentityComparer.SimpleNameComparer.GetHashCode(_name), + HashCode.Combine(_version?.GetHashCode(), GetHashCodeIgnoringNameAndVersion())); + } + + return _hashCode; + } + + /// + /// Gets the hashcode for this instance, without considering the name and version. + /// + /// + int GetHashCodeIgnoringNameAndVersion() + { + return HashCode.Combine((int)_contentType, AssemblyIdentityComparer.CultureComparer.GetHashCode(_cultureName ?? "")); + } + + /// + /// Initializes a new instance of the class based on the stored information. + /// + /// + /// Do not create an instance with string unless + /// you know the string has originated from a trustworthy source. + /// + public AssemblyName ToAssemblyName() + { + AssemblyName assemblyName = new(); + assemblyName.Name = Name; + assemblyName.CultureName = CultureName; + assemblyName.Version = Version; + assemblyName.Flags = Flags; + assemblyName.ContentType = ContentType; +#pragma warning disable SYSLIB0037 // Type or member is obsolete + assemblyName.ProcessorArchitecture = ProcessorArchitecture; +#pragma warning restore SYSLIB0037 // Type or member is obsolete + + if (HasPublicKey) + assemblyName.SetPublicKey(PublicKey.ToArray()); + else if (PublicKeyToken.IsDefaultOrEmpty == false) + assemblyName.SetPublicKeyToken(PublicKeyToken.ToArray()); + + return assemblyName; + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/AssemblyIdentityComparer.cs b/src/IKVM.CoreLib/Symbols/AssemblyIdentityComparer.cs new file mode 100644 index 0000000000..a4727d08cf --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/AssemblyIdentityComparer.cs @@ -0,0 +1,23 @@ +using System; + +namespace IKVM.CoreLib.Symbols +{ + + class AssemblyIdentityComparer + { + + public static AssemblyIdentityComparer Default { get; } = new AssemblyIdentityComparer(); + + public static StringComparer SimpleNameComparer + { + get { return StringComparer.OrdinalIgnoreCase; } + } + + public static StringComparer CultureComparer + { + get { return StringComparer.OrdinalIgnoreCase; } + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/AssemblyIdentityParts.cs b/src/IKVM.CoreLib/Symbols/AssemblyIdentityParts.cs new file mode 100644 index 0000000000..73aaf0ddfa --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/AssemblyIdentityParts.cs @@ -0,0 +1,489 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Globalization; +using System.Reflection; +using System.Runtime.CompilerServices; + +using IKVM.CoreLib.Text; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Parses an assembly name. + /// + internal ref partial struct AssemblyIdentityParser + { + + public readonly struct AssemblyIdentityParts + { + + public AssemblyIdentityParts(string name, Version? version, string? cultureName, AssemblyNameFlags flags, byte[]? publicKeyOrToken) + { + _name = name; + _version = version; + _cultureName = cultureName; + _flags = flags; + _publicKeyOrToken = publicKeyOrToken; + } + + public readonly string _name; + public readonly Version? _version; + public readonly string? _cultureName; + public readonly AssemblyNameFlags _flags; + public readonly byte[]? _publicKeyOrToken; + + } + + /// + /// Token categories for the lexer. + /// + private enum Token + { + Equals = 1, + Comma = 2, + String = 3, + End = 4, + } + + private enum AttributeKind + { + Version = 1, + Culture = 2, + PublicKeyOrToken = 4, + ProcessorArchitecture = 8, + Retargetable = 16, + ContentType = 32 + } + + private readonly ReadOnlySpan _input; + private int _index; + + private AssemblyIdentityParser(ReadOnlySpan input) + { + if (input.Length == 0) + throw new ArgumentException(nameof(input)); + + _input = input; + _index = 0; + } + + internal static bool TryParse(ReadOnlySpan name, ref AssemblyIdentityParts parts) + { + AssemblyIdentityParser parser = new(name); + return parser.TryParse(ref parts); + } + + private static bool TryRecordNewSeen(scoped ref AttributeKind seenAttributes, AttributeKind newAttribute) + { + if ((seenAttributes & newAttribute) != 0) + { + return false; + } + seenAttributes |= newAttribute; + return true; + } + + private bool TryParse(ref AssemblyIdentityParts result) + { + // Name must come first. + if (!TryGetNextToken(out string name, out Token token) || token != Token.String || string.IsNullOrEmpty(name)) + return false; + + Version? version = null; + string? cultureName = null; + byte[]? pkt = null; + AssemblyNameFlags flags = 0; + + AttributeKind alreadySeen = default; + if (!TryGetNextToken(out _, out token)) + return false; + + while (token != Token.End) + { + if (token != Token.Comma) + return false; + + if (!TryGetNextToken(out string attributeName, out token) || token != Token.String) + return false; + + if (!TryGetNextToken(out _, out token) || token != Token.Equals) + return false; + + if (!TryGetNextToken(out string attributeValue, out token) || token != Token.String) + return false; + + if (attributeName == string.Empty) + return false; + + if (IsAttribute(attributeName, "Version")) + { + if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.Version)) + { + return false; + } + if (!TryParseVersion(attributeValue, ref version)) + { + return false; + } + } + else if (IsAttribute(attributeName, "Culture")) + { + if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.Culture)) + { + return false; + } + if (!TryParseCulture(attributeValue, out cultureName)) + { + return false; + } + } + else if (IsAttribute(attributeName, "PublicKeyToken")) + { + if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.PublicKeyOrToken)) + { + return false; + } + if (!TryParsePKT(attributeValue, isToken: true, out pkt)) + { + return false; + } + } + else if (IsAttribute(attributeName, "PublicKey")) + { + if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.PublicKeyOrToken)) + { + return false; + } + if (!TryParsePKT(attributeValue, isToken: false, out pkt)) + { + return false; + } + flags |= AssemblyNameFlags.PublicKey; + } + else if (IsAttribute(attributeName, "ProcessorArchitecture")) + { + if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.ProcessorArchitecture)) + { + return false; + } + if (!TryParseProcessorArchitecture(attributeValue, out ProcessorArchitecture arch)) + { + return false; + } + flags |= (AssemblyNameFlags)(((int)arch) << 4); + } + else if (IsAttribute(attributeName, "Retargetable")) + { + if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.Retargetable)) + { + return false; + } + + if (attributeValue.Equals("Yes", StringComparison.OrdinalIgnoreCase)) + { + flags |= AssemblyNameFlags.Retargetable; + } + else if (attributeValue.Equals("No", StringComparison.OrdinalIgnoreCase)) + { + // nothing to do + } + else + { + return false; + } + } + else if (IsAttribute(attributeName, "ContentType")) + { + if (!TryRecordNewSeen(ref alreadySeen, AttributeKind.ContentType)) + { + return false; + } + + if (attributeValue.Equals("WindowsRuntime", StringComparison.OrdinalIgnoreCase)) + { + flags |= (AssemblyNameFlags)(((int)AssemblyContentType.WindowsRuntime) << 9); + } + else + { + return false; + } + } + else + { + // Desktop compat: If we got here, the attribute name is unknown to us. Ignore it. + } + + if (!TryGetNextToken(out _, out token)) + { + return false; + } + } + + result = new AssemblyIdentityParts(name, version, cultureName, flags, pkt); + return true; + } + + private static bool IsAttribute(string candidate, string attributeKind) + => candidate.Equals(attributeKind, StringComparison.OrdinalIgnoreCase); + + private static bool TryParseVersion(string attributeValue, ref Version? version) + { +#if NET8_0_OR_GREATER + ReadOnlySpan attributeValueSpan = attributeValue; + Span parts = stackalloc Range[5]; + parts = parts.Slice(0, attributeValueSpan.Split(parts, '.')); +#else + string[] parts = attributeValue.Split('.'); +#endif + if (parts.Length is < 2 or > 4) + { + return false; + } + + Span versionNumbers = [ushort.MaxValue, ushort.MaxValue, ushort.MaxValue, ushort.MaxValue]; + for (int i = 0; i < parts.Length; i++) + { + if (!ushort.TryParse( +#if NET8_0_OR_GREATER + attributeValueSpan[parts[i]], +#else + parts[i], +#endif + NumberStyles.None, NumberFormatInfo.InvariantInfo, out versionNumbers[i])) + { + return false; + } + } + + if (versionNumbers[0] == ushort.MaxValue || + versionNumbers[1] == ushort.MaxValue) + { + return false; + } + + version = + versionNumbers[2] == ushort.MaxValue ? new Version(versionNumbers[0], versionNumbers[1]) : + versionNumbers[3] == ushort.MaxValue ? new Version(versionNumbers[0], versionNumbers[1], versionNumbers[2]) : + new Version(versionNumbers[0], versionNumbers[1], versionNumbers[2], versionNumbers[3]); + + return true; + } + + private static bool TryParseCulture(string attributeValue, out string? result) + { + if (attributeValue.Equals("Neutral", StringComparison.OrdinalIgnoreCase)) + { + result = ""; + return true; + } + + result = attributeValue; + return true; + } + + private static bool TryParsePKT(string attributeValue, bool isToken, out byte[]? result) + { + if (attributeValue.Equals("null", StringComparison.OrdinalIgnoreCase) || attributeValue == string.Empty) + { + result = Array.Empty(); + return true; + } + + if (attributeValue.Length % 2 != 0 || (isToken && attributeValue.Length != 8 * 2)) + { + result = null; + return false; + } + + byte[] pkt = new byte[attributeValue.Length / 2]; + if (!HexConverter.TryDecodeFromUtf16(attributeValue.AsSpan(), pkt, out int _)) + { + result = null; + return false; + } + + result = pkt; + return true; + } + + private static bool TryParseProcessorArchitecture(string attributeValue, out ProcessorArchitecture result) + { + result = attributeValue switch + { + _ when attributeValue.Equals("msil", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.MSIL, + _ when attributeValue.Equals("x86", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.X86, + _ when attributeValue.Equals("ia64", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.IA64, + _ when attributeValue.Equals("amd64", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.Amd64, + _ when attributeValue.Equals("arm", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.Arm, + _ when attributeValue.Equals("msil", StringComparison.OrdinalIgnoreCase) => ProcessorArchitecture.MSIL, + _ => ProcessorArchitecture.None + }; + return result != ProcessorArchitecture.None; + } + + private static bool IsWhiteSpace(char ch) + => ch is '\n' or '\r' or ' ' or '\t'; + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + private bool TryGetNextChar(out char ch) + { + if (_index < _input.Length) + { + ch = _input[_index++]; + if (ch == '\0') + { + return false; + } + } + else + { + ch = '\0'; + } + + return true; + } + + // + // Return the next token in assembly name. If the result is Token.String, + // sets "tokenString" to the tokenized string. + // + private bool TryGetNextToken(out string tokenString, out Token token) + { + tokenString = string.Empty; + char c; + + while (true) + { + if (!TryGetNextChar(out c)) + { + token = default; + return false; + } + + switch (c) + { + case ',': + { + token = Token.Comma; + return true; + } + case '=': + { + token = Token.Equals; + return true; + } + case '\0': + { + token = Token.End; + return true; + } + } + + if (!IsWhiteSpace(c)) + { + break; + } + } + + using ValueStringBuilder sb = new ValueStringBuilder(stackalloc char[64]); + + char quoteChar = '\0'; + if (c is '\'' or '\"') + { + quoteChar = c; + if (!TryGetNextChar(out c)) + { + token = default; + return false; + } + } + + for (; ; ) + { + if (c == 0) + { + if (quoteChar != 0) + { + // EOS and unclosed quotes is an error + token = default; + return false; + } + // Reached end of input and therefore of string + break; + } + + if (quoteChar != 0 && c == quoteChar) + break; // Terminate: Found closing quote of quoted string. + + if (quoteChar == 0 && (c is ',' or '=')) + { + _index--; + break; // Terminate: Found start of a new ',' or '=' token. + } + + if (quoteChar == 0 && (c is '\'' or '\"')) + { + token = default; + return false; + } + + if (c is '\\') + { + if (!TryGetNextChar(out c)) + { + token = default; + return false; + } + + switch (c) + { + case '\\': + case ',': + case '=': + case '\'': + case '"': + sb.Append(c); + break; + case 't': + sb.Append('\t'); + break; + case 'r': + sb.Append('\r'); + break; + case 'n': + sb.Append('\n'); + break; + default: + token = default; + return false; + } + } + else + { + sb.Append(c); + } + + if (!TryGetNextChar(out c)) + { + token = default; + return false; + } + } + + + int length = sb.Length; + if (quoteChar == 0) + { + while (length > 0 && IsWhiteSpace(sb[length - 1])) + length--; + } + + tokenString = sb.AsSpan(0, length).ToString(); + token = Token.String; + return true; + } + } +} \ No newline at end of file diff --git a/src/IKVM.CoreLib/Symbols/AssemblyNameFormatter.cs b/src/IKVM.CoreLib/Symbols/AssemblyNameFormatter.cs new file mode 100644 index 0000000000..965e1d9400 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/AssemblyNameFormatter.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection; + +using IKVM.CoreLib.Text; + +namespace IKVM.CoreLib.Symbols +{ + + static class AssemblyNameFormatter + { + + public static string ComputeDisplayName(string name, Version? version, string? cultureName, ImmutableArray pkt, AssemblyNameFlags flags, AssemblyContentType contentType, ImmutableArray pk) + { + const int PUBLIC_KEY_TOKEN_LEN = 8; + + Debug.Assert(name.Length != 0); + + var vsb = new ValueStringBuilder(stackalloc char[256]); + vsb.AppendQuoted(name); + + if (version != null) + { + ushort major = (ushort)version.Major; + if (major != ushort.MaxValue) + { + vsb.Append(", Version="); + vsb.AppendSpanFormattable(major); + + ushort minor = (ushort)version.Minor; + if (minor != ushort.MaxValue) + { + vsb.Append('.'); + vsb.AppendSpanFormattable(minor); + + ushort build = (ushort)version.Build; + if (build != ushort.MaxValue) + { + vsb.Append('.'); + vsb.AppendSpanFormattable(build); + + ushort revision = (ushort)version.Revision; + if (revision != ushort.MaxValue) + { + vsb.Append('.'); + vsb.AppendSpanFormattable(revision); + } + } + } + } + } + + if (cultureName != null) + { + if (cultureName.Length == 0) + cultureName = "neutral"; + vsb.Append(", Culture="); + vsb.AppendQuoted(cultureName); + } + + var keyOrToken = pkt.IsDefaultOrEmpty == false ? pkt : pk; + if (keyOrToken != null) + { + if (pkt != null) + { + if (pkt.Length > PUBLIC_KEY_TOKEN_LEN) + throw new ArgumentException(); + + vsb.Append(", PublicKeyToken="); + } + else + { + vsb.Append(", PublicKey="); + } + + if (keyOrToken.Length == 0) + { + vsb.Append("null"); + } + else + { + HexConverter.EncodeToUtf16(keyOrToken.AsSpan(), vsb.AppendSpan(keyOrToken.Length * 2), HexConverter.Casing.Lower); + } + } + + if (0 != (flags & AssemblyNameFlags.Retargetable)) + vsb.Append(", Retargetable=Yes"); + + if (contentType == AssemblyContentType.WindowsRuntime) + vsb.Append(", ContentType=WindowsRuntime"); + + return vsb.ToString(); + } + + static void AppendQuoted(this ref ValueStringBuilder vsb, string s) + { + bool needsQuoting = false; + const char quoteChar = '\"'; + + // App-compat: You can use double or single quotes to quote a name, and Fusion (or rather the IdentityAuthority) picks one + // by some algorithm. Rather than guess at it, we use double quotes consistently. + ReadOnlySpan span = s.AsSpan(); + if (s.Length != span.Trim().Length || span.IndexOfAny('\"', '\'') >= 0) + needsQuoting = true; + + if (needsQuoting) + vsb.Append(quoteChar); + + for (int i = 0; i < s.Length; i++) + { + switch (s[i]) + { + case '\\': + case ',': + case '=': + case '\'': + case '"': + vsb.Append('\\'); + break; + case '\t': + vsb.Append("\\t"); + continue; + case '\r': + vsb.Append("\\r"); + continue; + case '\n': + vsb.Append("\\n"); + continue; + } + + vsb.Append(s[i]); + } + + if (needsQuoting) + vsb.Append(quoteChar); + } + + static void AppendSpanFormattable(this ref ValueStringBuilder vsb, ushort value) + { + vsb.Append(value.ToString()); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/AssemblySymbol.cs b/src/IKVM.CoreLib/Symbols/AssemblySymbol.cs new file mode 100644 index 0000000000..fd50285ac7 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/AssemblySymbol.cs @@ -0,0 +1,242 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.IO; +using System.Linq; +using System.Reflection; + +using IKVM.CoreLib.Collections; +using IKVM.CoreLib.Text; + +namespace IKVM.CoreLib.Symbols +{ + + public abstract class AssemblySymbol : Symbol, ICustomAttributeProviderInternal + { + + CustomAttributeImpl _customAttributes; + + /// + /// Initializes a new instance. + /// + /// + public AssemblySymbol(SymbolContext context) : + base(context) + { + _customAttributes = new CustomAttributeImpl(context, this); + } + + /// + /// Gets an for this assembly. + /// + /// + public abstract AssemblyIdentity Identity { get; } + + /// + /// Gets the display name of the assembly. + /// + public string FullName => Identity.FullName; + + /// + /// Gets a string representing the version of the common language runtime (CLR) saved in the file containing the manifest. + /// + public abstract string ImageRuntimeVersion { get; } + + /// + /// Gets the full path or UNC location of the loaded file that contains the manifest. + /// + public abstract string Location { get; } + + /// + /// Gets the module that contains the manifest for the current assembly. + /// + public abstract ModuleSymbol ManifestModule { get; } + + /// + /// Gets the entry point of this assembly. + /// + public abstract MethodSymbol? EntryPoint { get; } + + /// + /// Gets a collection of the types defined in this assembly. + /// + public IEnumerable DefinedTypes => GetTypes(); + + /// + /// Gets a collection of the public types defined in this assembly that are visible outside the assembly. + /// + public IEnumerable ExportedTypes => GetExportedTypes(); + + /// + /// Gets a collection that contains the modules in this assembly. + /// + public ImmutableArray Modules => GetModules(); + + /// + /// Returns true if the symbol is missing. + /// + public abstract bool IsMissing { get; } + + /// + /// Gets the public types defined in this assembly that are visible outside the assembly. + /// + /// + public IEnumerable GetExportedTypes() + { + foreach (var type in GetTypes()) + if (IsVisibleOutsideAssembly(type)) + yield return type; + } + + /// + /// Returns true if the specified type is visible outside the assembly. + /// + /// + /// + bool IsVisibleOutsideAssembly(TypeSymbol type) + { + var visibility = type.Attributes & TypeAttributes.VisibilityMask; + if (visibility == TypeAttributes.Public) + return true; + + if (visibility == TypeAttributes.NestedPublic) + return IsVisibleOutsideAssembly(type.DeclaringType!); + + return false; + } + + /// + /// Gets the specified module in this assembly. + /// + /// + /// + public ModuleSymbol? GetModule(string name) + { + if (name is null) + throw new ArgumentNullException(nameof(name)); + + return GetModules().Where(i => i.Name == name).SingleOrDefaultOrThrow(() => new AmbiguousMatchException()); + } + + /// + /// Gets all the modules that are part of this assembly. + /// + /// + public abstract ImmutableArray GetModules(); + + /// + /// Gets the objects for all the assemblies referenced by this assembly. + /// + /// + public abstract ImmutableArray GetReferencedAssemblies(); + + /// + /// Gets the Type object with the specified name in the assembly instance. + /// + /// + /// + public TypeSymbol? GetType(string name) => GetType(name, false); + + /// + /// Gets the object with the specified name in the assembly instance and optionally throws an exception if the type is not found. + /// + /// + /// + /// + public TypeSymbol? GetType(string name, bool throwOnError) + { + foreach (var module in GetModules()) + if (module.GetType(name, false) is TypeSymbol type) + return type; + + if (throwOnError) + throw new TypeLoadException(); + + return null; + } + + /// + /// Gets all types defined in this assembly. + /// + /// + public IEnumerable GetTypes() + { + foreach (var module in GetModules()) + foreach (var type in module.GetTypes()) + yield return type; + } + + /// + /// Loads the specified manifest resource from this assembly. + /// + /// + /// + public abstract ManifestResourceInfo? GetManifestResourceInfo(string resourceName); + + /// + /// Loads the specified manifest resource from this assembly. + /// + /// + /// + public abstract Stream? GetManifestResourceStream(string name); + + /// + /// Loads the specified manifest resource, scoped by the namespace of the specified type, from this assembly. + /// + /// + /// + /// + public Stream? GetManifestResourceStream(TypeSymbol type, string name) + { + var sb = new ValueStringBuilder(stackalloc char[256]); + + if (type == null) + { + if (name == null) + throw new ArgumentNullException(nameof(type)); + } + else + { + var ns = type.Namespace; + if (ns != null) + { + sb.Append(ns); + + if (name != null) + sb.Append(Type.Delimiter); + } + } + + if (name != null) + sb.Append(name); + + return GetManifestResourceStream(sb.ToString()); + } + + /// + internal abstract ImmutableArray GetDeclaredCustomAttributes(); + + /// + ImmutableArray ICustomAttributeProviderInternal.GetDeclaredCustomAttributes() => GetDeclaredCustomAttributes(); + + /// + ICustomAttributeProviderInternal? ICustomAttributeProviderInternal.GetInheritedCustomAttributeProvider() => null; + + /// + public IEnumerable GetCustomAttributes(bool inherit = false) => _customAttributes.GetCustomAttributes(inherit); + + /// + public IEnumerable GetCustomAttributes(TypeSymbol attributeType, bool inherit = false) => _customAttributes.GetCustomAttributes(attributeType, inherit); + + /// + public CustomAttribute? GetCustomAttribute(TypeSymbol attributeType, bool inherit = false) => _customAttributes.GetCustomAttribute(attributeType, inherit); + + /// + public bool IsDefined(TypeSymbol attributeType, bool inherit = false) => _customAttributes.IsDefined(attributeType, inherit); + + /// + public override string ToString() => FullName ?? ""; + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/ByRefTypeSymbol.cs b/src/IKVM.CoreLib/Symbols/ByRefTypeSymbol.cs new file mode 100644 index 0000000000..f2c66fa145 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/ByRefTypeSymbol.cs @@ -0,0 +1,75 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols +{ + + class ByRefTypeSymbol : HasElementSymbol + { + + /// + /// Initializes a new instance. + /// + /// + /// + public ByRefTypeSymbol(SymbolContext context, TypeSymbol elementType) : + base(context, elementType) + { + + } + + /// + protected sealed override string NameSuffix => "&"; + + /// + public sealed override TypeAttributes Attributes => TypeAttributes.Public; + + /// + public sealed override TypeSymbol? BaseType => null; + + /// + public sealed override bool IsByRef => true; + + /// + public sealed override int GetArrayRank() + { + throw new NotSupportedException(); + } + + /// + internal sealed override ImmutableArray GetDeclaredInterfaces() + { + return ImmutableArray.Empty; + } + + /// + internal sealed override ImmutableArray GetDeclaredMethods() + { + return ImmutableArray.Empty; + } + + internal override MethodImplementationMapping GetMethodImplementations() + { + return MethodImplementationMapping.CreateEmpty(this); + } + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() + { + return ImmutableArray.Empty; + } + + /// + internal override TypeSymbol Specialize(GenericContext context) + { + if (ContainsGenericParameters == false) + return this; + + var elementType = GetElementType() ?? throw new InvalidOperationException(); + return elementType.Specialize(context).MakeByRefType(); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/ConstructedGenericEventSymbol.cs b/src/IKVM.CoreLib/Symbols/ConstructedGenericEventSymbol.cs new file mode 100644 index 0000000000..3aaf8c6d6b --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/ConstructedGenericEventSymbol.cs @@ -0,0 +1,115 @@ +using System; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Describes an event of a . + /// + class ConstructedGenericEventSymbol : EventSymbol + { + + internal readonly EventSymbol _definition; + readonly GenericContext _genericContext; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + public ConstructedGenericEventSymbol(SymbolContext context, TypeSymbol declaringType, EventSymbol definition, GenericContext genericContext) : + base(context, declaringType) + { + _definition = definition ?? throw new ArgumentNullException(nameof(definition)); + _genericContext = genericContext; + } + + /// + public sealed override EventAttributes Attributes => _definition.Attributes; + + /// + public sealed override string Name => _definition.Name; + + /// + public sealed override TypeSymbol? EventHandlerType => _definition.EventHandlerType?.Specialize(_genericContext); + + /// + public sealed override bool IsMissing => false; + + /// + public sealed override MethodSymbol? GetAddMethod(bool nonPublic) + { + var baseMethod = _definition.GetAddMethod(nonPublic); + if (baseMethod is null) + return null; + + foreach (var i in DeclaringType!.GetDeclaredMethods()) + if (i is ConstructedGenericMethodSymbol m) + if (m._definition == baseMethod) + return m; + + return null; + } + + /// + public sealed override MethodSymbol? GetRemoveMethod(bool nonPublic) + { + var baseMethod = _definition.GetRemoveMethod(nonPublic); + if (baseMethod is null) + return null; + + foreach (var i in DeclaringType!.GetDeclaredMethods()) + if (i is ConstructedGenericMethodSymbol m) + if (m._definition == baseMethod) + return m; + + return null; + } + + /// + public sealed override MethodSymbol? GetRaiseMethod(bool nonPublic) + { + var baseMethod = _definition.GetRaiseMethod(nonPublic); + if (baseMethod is null) + return null; + + foreach (var i in DeclaringType!.GetDeclaredMethods()) + if (i is ConstructedGenericMethodSymbol m) + if (m._definition == baseMethod) + return m; + + return null; + } + + /// + public sealed override ImmutableArray GetOtherMethods(bool nonPublic) + { + var b = ImmutableArray.CreateBuilder(); + + foreach (var baseMethod in _definition.GetOtherMethods(nonPublic)) + { + if (baseMethod is not null) + foreach (var i in DeclaringType!.GetDeclaredMethods()) + if (i is ConstructedGenericMethodSymbol m) + if (m._definition == baseMethod) + b.Add(m); + } + + return b.DrainToImmutable(); + } + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() + { + throw new NotImplementedException(); + } + + } + +} \ No newline at end of file diff --git a/src/IKVM.CoreLib/Symbols/ConstructedGenericFieldSymbol.cs b/src/IKVM.CoreLib/Symbols/ConstructedGenericFieldSymbol.cs new file mode 100644 index 0000000000..d4bdbd366d --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/ConstructedGenericFieldSymbol.cs @@ -0,0 +1,93 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Describes a field of a . + /// + class ConstructedGenericFieldSymbol : FieldSymbol + { + + readonly FieldSymbol _definition; + readonly GenericContext _genericContext; + + TypeSymbol? _fieldType; + ImmutableArray _optionalCustomModifiers; + ImmutableArray _requiredCustomModifiers; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + public ConstructedGenericFieldSymbol(SymbolContext context, TypeSymbol declaringType, FieldSymbol definition, GenericContext genericContext) : + base(context, declaringType.Module, declaringType) + { + _definition = definition ?? throw new ArgumentNullException(nameof(definition)); + _genericContext = genericContext; + } + + /// + public sealed override FieldAttributes Attributes => _definition.Attributes; + + /// + public sealed override TypeSymbol FieldType => _fieldType ??= _definition.FieldType.Specialize(_genericContext); + + /// + public sealed override string Name => _definition.Name; + + /// + public sealed override bool IsMissing => false; + + /// + public sealed override object? GetRawConstantValue() + { + return _definition.GetRawConstantValue(); + } + + /// + public sealed override ImmutableArray GetOptionalCustomModifiers() + { + if (_optionalCustomModifiers.IsDefault) + { + var l = _definition.GetOptionalCustomModifiers(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _optionalCustomModifiers, b.DrainToImmutable()); + } + + return _optionalCustomModifiers; + } + + /// + public sealed override ImmutableArray GetRequiredCustomModifiers() + { + if (_requiredCustomModifiers.IsDefault) + { + var l = _definition.GetRequiredCustomModifiers(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _requiredCustomModifiers, b.DrainToImmutable()); + } + + return _requiredCustomModifiers; + } + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() + { + return _definition.GetDeclaredCustomAttributes(); + } + + } + +} \ No newline at end of file diff --git a/src/IKVM.CoreLib/Symbols/ConstructedGenericMethodSymbol.cs b/src/IKVM.CoreLib/Symbols/ConstructedGenericMethodSymbol.cs new file mode 100644 index 0000000000..91b5cc5323 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/ConstructedGenericMethodSymbol.cs @@ -0,0 +1,139 @@ +using System; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; +using System.Threading; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Describes a method of a . + /// + class ConstructedGenericMethodSymbol : MethodSymbol + { + + internal readonly MethodSymbol _definition; + internal readonly GenericContext _genericContext; + + ImmutableArray _typeParameters; + TypeSymbol? _returnType; + ConstructedGenericParameterSymbol? _returnParameter; + ImmutableArray _parameters; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + /// + public ConstructedGenericMethodSymbol(SymbolContext context, ModuleSymbol module, TypeSymbol? declaringType, MethodSymbol definition, GenericContext genericContext) : + base(context, module, declaringType) + { + _definition = definition ?? throw new ArgumentNullException(nameof(definition)); + _genericContext = genericContext; + } + + /// + public sealed override MethodAttributes Attributes => _definition.Attributes; + + /// + public sealed override bool IsGenericMethodDefinition => IsConstructedGenericMethod == false && GenericArguments.Length > 0; + + /// + public sealed override bool IsConstructedGenericMethod => _genericContext.GenericMethodArguments.IsDefault == false; + + /// + public sealed override ParameterSymbol ReturnParameter => GetReturnParameter(); + + /// + /// Computes the value for . + /// + /// + ConstructedGenericParameterSymbol GetReturnParameter() + { + if (_returnParameter == null) + Interlocked.CompareExchange(ref _returnParameter, new ConstructedGenericParameterSymbol(Context, this, _definition.ReturnParameter, _genericContext), null); + + return _returnParameter; + } + + /// + public sealed override TypeSymbol ReturnType => _returnType ??= _definition.ReturnType.Specialize(_genericContext); + + /// + public sealed override ICustomAttributeProvider ReturnTypeCustomAttributes => _definition.ReturnTypeCustomAttributes; + + /// + public sealed override CallingConventions CallingConvention => _definition.CallingConvention; + + /// + public sealed override MethodImplAttributes MethodImplementationFlags => _definition.MethodImplementationFlags; + + /// + public sealed override string Name => _definition.Name; + + /// + public sealed override bool IsMissing => false; + + /// + + /// + public sealed override MethodSymbol? BaseDefinition => _definition.BaseDefinition; + + /// + public override ImmutableArray GenericArguments => ComputeGenericArguments(); + + ImmutableArray ComputeGenericArguments() + { + if (_typeParameters.IsDefault) + { + var l = _definition.GenericArguments; + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _typeParameters, b.DrainToImmutable()); + } + + return _typeParameters; + } + + /// + public sealed override MethodSymbol GenericMethodDefinition => _definition; + + /// + public override ImmutableArray Parameters => ComputeParameters(); + + ImmutableArray ComputeParameters() + { + if (_parameters.IsDefault) + { + var l = _definition.Parameters; + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(new ConstructedGenericParameterSymbol(Context, this, i, _genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _parameters, b.DrainToImmutable()); + } + + return _parameters; + } + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() + { + return _definition.GetDeclaredCustomAttributes(); + } + + public override string? ToString() + { + return base.ToString(); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/ConstructedGenericParameterSymbol.cs b/src/IKVM.CoreLib/Symbols/ConstructedGenericParameterSymbol.cs new file mode 100644 index 0000000000..10bbea750a --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/ConstructedGenericParameterSymbol.cs @@ -0,0 +1,90 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols +{ + + class ConstructedGenericParameterSymbol : ParameterSymbol + { + + readonly ParameterSymbol _definition; + readonly GenericContext _genericContext; + + ImmutableArray _optionalCustomModifiers; + ImmutableArray _requiredCustomModifiers; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + public ConstructedGenericParameterSymbol(SymbolContext context, MemberSymbol declaringMember, ParameterSymbol definition, GenericContext genericContext) : + base(context, declaringMember, definition.Position) + { + _definition = definition ?? throw new ArgumentNullException(nameof(definition)); + _genericContext = genericContext; + } + + /// + public override ParameterAttributes Attributes => _definition.Attributes; + + /// + public override TypeSymbol ParameterType => _definition.ParameterType.Specialize(_genericContext); + + /// + public override string? Name => _definition.Name; + + /// + public override object? DefaultValue => _definition.DefaultValue; + + /// + public sealed override bool IsMissing => false; + + /// + public sealed override bool ContainsMissing => false; + + /// + public override ImmutableArray GetOptionalCustomModifiers() + { + if (_optionalCustomModifiers == default) + { + var l = _definition.GetOptionalCustomModifiers(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _optionalCustomModifiers, b.DrainToImmutable()); + } + + return _optionalCustomModifiers; + } + + /// + public override ImmutableArray GetRequiredCustomModifiers() + { + if (_requiredCustomModifiers == default) + { + var l = _definition.GetRequiredCustomModifiers(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _requiredCustomModifiers, b.DrainToImmutable()); + } + + return _requiredCustomModifiers; + } + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() + { + return _definition.GetDeclaredCustomAttributes(); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/ConstructedGenericPropertySymbol.cs b/src/IKVM.CoreLib/Symbols/ConstructedGenericPropertySymbol.cs new file mode 100644 index 0000000000..17beb82f26 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/ConstructedGenericPropertySymbol.cs @@ -0,0 +1,169 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Describes a property of a . + /// + class ConstructedGenericPropertySymbol : PropertySymbol + { + + readonly PropertySymbol _definition; + readonly GenericContext _genericContext; + + ImmutableArray _indexParameters; + ImmutableArray _optionalCustomModifiers; + ImmutableArray _requiredCustomModifiers; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + public ConstructedGenericPropertySymbol(SymbolContext context, TypeSymbol declaringType, PropertySymbol definition, GenericContext genericContext) : + base(context, declaringType) + { + _definition = definition ?? throw new ArgumentNullException(nameof(definition)); + _genericContext = genericContext; + } + + /// + public override PropertyAttributes Attributes => _definition.Attributes; + + /// + public override TypeSymbol PropertyType => _definition.PropertyType.Specialize(_genericContext); + + /// + public override bool CanRead => _definition.CanRead; + + /// + public override bool CanWrite => _definition.CanWrite; + + /// + public override string Name => _definition.Name; + + /// + public sealed override bool IsMissing => false; + + /// + public override ImmutableArray GetAccessors(bool nonPublic) + { + var b = ImmutableArray.CreateBuilder(); + + foreach (var baseMethod in _definition.GetAccessors(nonPublic)) + { + if (baseMethod is not null) + foreach (var i in DeclaringType!.GetMethods()) + if (i is ConstructedGenericMethodSymbol m) + if (m._definition == baseMethod) + b.Add(m); + } + + return b.DrainToImmutable(); + } + + /// + public override MethodSymbol? GetGetMethod(bool nonPublic) + { + var baseMethod = _definition.GetGetMethod(nonPublic); + if (baseMethod is null) + return null; + + foreach (var i in DeclaringType!.GetMethods()) + if (i is ConstructedGenericMethodSymbol m) + if (m._definition == baseMethod) + return m; + + return null; + } + + /// + public override MethodSymbol? GetSetMethod(bool nonPublic) + { + var baseMethod = _definition.GetSetMethod(nonPublic); + if (baseMethod is null) + return null; + + foreach (var i in DeclaringType!.GetMethods()) + if (i is ConstructedGenericMethodSymbol m) + if (m._definition == baseMethod) + return m; + + return null; + } + + /// + public override ImmutableArray GetIndexParameters() + { + if (_indexParameters == default) + { + var l = _definition.GetIndexParameters(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(new ConstructedGenericParameterSymbol(Context, this, i, _genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _indexParameters, b.DrainToImmutable()); + } + + return _indexParameters; + } + + /// + public override TypeSymbol GetModifiedPropertyType() + { + return _definition.GetModifiedPropertyType().Specialize(_genericContext); + } + + /// + public override object? GetRawConstantValue() + { + return _definition.GetRawConstantValue(); + } + + /// + public override ImmutableArray GetOptionalCustomModifiers() + { + if (_optionalCustomModifiers.IsDefault) + { + var l = _definition.GetOptionalCustomModifiers(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _optionalCustomModifiers, b.DrainToImmutable()); + } + + return _optionalCustomModifiers; + } + + /// + public override ImmutableArray GetRequiredCustomModifiers() + { + if (_requiredCustomModifiers.IsDefault) + { + var l = _definition.GetRequiredCustomModifiers(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _requiredCustomModifiers, b.DrainToImmutable()); + } + + return _requiredCustomModifiers; + } + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() + { + throw new NotImplementedException(); + } + + } + +} \ No newline at end of file diff --git a/src/IKVM.CoreLib/Symbols/ConstructedGenericTypeSymbol.cs b/src/IKVM.CoreLib/Symbols/ConstructedGenericTypeSymbol.cs new file mode 100644 index 0000000000..f3266e6a01 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/ConstructedGenericTypeSymbol.cs @@ -0,0 +1,366 @@ +using System; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Describes a type that is a constructed generic type. + /// + class ConstructedGenericTypeSymbol : TypeSymbol + { + + readonly TypeSymbol _typeDefinition; + readonly GenericContext _genericContext; + + ImmutableArray _typeArguments; + ImmutableArray _interfaces; + ImmutableArray _fields; + ImmutableArray _methods; + ImmutableArray _properties; + ImmutableArray _events; + ImmutableArray _optionalCustomModifiers; + ImmutableArray _requiredCustomModifiers; + MethodImplementationMapping _methodImpl; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + public ConstructedGenericTypeSymbol(SymbolContext context, TypeSymbol typeDefinition, GenericContext genericContext) : + base(context, typeDefinition.Module) + { + _typeDefinition = typeDefinition ?? throw new ArgumentNullException(nameof(typeDefinition)); + _genericContext = genericContext; + } + + /// + public sealed override TypeSymbol? DeclaringType => _typeDefinition.DeclaringType; + + /// + public sealed override string Name => _typeDefinition.Name; + + /// + public sealed override string? Namespace => _typeDefinition.Namespace; + + /// + public sealed override TypeAttributes Attributes => _typeDefinition.Attributes; + + /// + public sealed override TypeCode TypeCode => _typeDefinition.TypeCode; + + /// + public sealed override TypeSymbol? BaseType => _typeDefinition.BaseType?.Specialize(_genericContext); + + /// + public sealed override bool IsTypeDefinition => false; + + /// + public sealed override bool IsGenericTypeDefinition => false; + + /// + public sealed override bool IsConstructedGenericType => true; + + /// + public sealed override bool IsGenericTypeParameter => false; + + /// + public sealed override bool IsGenericMethodParameter => false; + + /// + public sealed override bool ContainsGenericParameters => GenericArguments.Any(i => i.ContainsGenericParameters); + + /// + public sealed override int GenericParameterPosition => throw new NotSupportedException(); + + /// + public sealed override bool HasElementType => false; + + /// + public sealed override bool IsArray => false; + + /// + public sealed override bool IsSZArray => false; + + /// + public sealed override bool IsByRef => false; + + /// + public sealed override bool IsPointer => false; + + /// + public sealed override bool IsFunctionPointer => false; + + /// + public sealed override bool IsUnmanagedFunctionPointer => false; + + /// + public sealed override MethodSymbol? DeclaringMethod => _typeDefinition.DeclaringMethod; + + /// + public sealed override GenericParameterAttributes GenericParameterAttributes => _typeDefinition.GenericParameterAttributes; + + /// + public sealed override bool IsPrimitive => _typeDefinition.IsPrimitive; + + /// + public sealed override bool IsVisible => base.IsVisible && _typeArguments.All(i => i.IsVisible); + + /// + public sealed override bool IsEnum => _typeDefinition.IsEnum; + + /// + public sealed override bool IsMissing => false; + + /// + public sealed override bool ContainsMissingType => _typeDefinition.ContainsMissingType || GenericArguments.Any(i => i.ContainsMissingType); + + /// + public sealed override TypeSymbol GetEnumUnderlyingType() + { + return _typeDefinition.GetEnumUnderlyingType().Specialize(_genericContext); + } + + /// + public sealed override TypeSymbol? GetElementType() + { + return null; + } + + /// + public sealed override int GetArrayRank() + { + throw new InvalidOperationException(); + } + + /// + public override TypeSymbol GenericTypeDefinition => _typeDefinition; + + /// + public override ImmutableArray GenericArguments => GetGenericArguments(); + + ImmutableArray GetGenericArguments() + { + if (_typeArguments.IsDefault) + { + var l = _typeDefinition.GenericArguments; + var b = ImmutableArray.CreateBuilder(l.Length); + for (int i = 0; i < l.Length; i++) + b.Add(l[i].Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _typeArguments, b.DrainToImmutable()); + } + + return _typeArguments; + } + + /// + public sealed override ImmutableArray GenericParameterConstraints => throw new InvalidOperationException(); + + /// + internal override ImmutableArray GetDeclaredFields() + { + if (_fields.IsDefault) + { + var l = _typeDefinition.GetDeclaredFields(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(new ConstructedGenericFieldSymbol(Context, this, i, _genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _fields, b.DrainToImmutable()); + } + + return _fields; + } + + /// + internal override ImmutableArray GetDeclaredMethods() + { + if (_methods.IsDefault) + { + var l = _typeDefinition.GetDeclaredMethods(); + var b = ImmutableArray.CreateBuilder(l.Length); + for (int i = 0; i < l.Length; i++) + b.Add(new ConstructedGenericMethodSymbol(Context, Module, this, l[i], _genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _methods, b.DrainToImmutable()); + } + + return _methods; + } + + /// + internal override MethodImplementationMapping GetMethodImplementations() + { + if (_methodImpl.Type == null) + { + var m = _typeDefinition.GetMethodImplementations(); + var impl = ImmutableArray.CreateBuilder(m.Implementations.Length); + var decl = ImmutableArray.CreateBuilder>(m.Implementations.Length); + for (int i = 0; i < m.Implementations.Length; i++) + { + impl.Add(Specialize(m.Implementations[i]) ?? throw new InvalidOperationException()); + + var declBuilder = ImmutableArray.CreateBuilder(m.Declarations[i].Length); + for (int j = 0; j < m.Declarations[i].Length; j++) + declBuilder.Add(Specialize(m.Declarations[i][j]) ?? throw new InvalidOperationException()); + + decl.Add(declBuilder.DrainToImmutable()); + } + + lock (this) + if (_methodImpl.Type == null) + _methodImpl = new MethodImplementationMapping(this, impl.DrainToImmutable(), decl.DrainToImmutable()); + } + + return _methodImpl; + } + + /// + /// Searches this type for the constructed method that is constructed from the given definition method. + /// + /// + /// + MethodSymbol Specialize(MethodSymbol method) + { + if (method == null) + throw new ArgumentNullException(nameof(method)); + if (method.DeclaringType is not { } definitionType) + throw new InvalidOperationException(); + + // find method on specialized type + return definitionType.Specialize(_genericContext).FindMethod(method.Name, method.Signature.Specialize(_genericContext)) ?? throw new InvalidOperationException(); + } + + /// + internal override ImmutableArray GetDeclaredProperties() + { + if (_properties.IsDefault) + { + var l = _typeDefinition.GetDeclaredProperties(); + var b = ImmutableArray.CreateBuilder(l.Length); + for (int i = 0; i < l.Length; i++) + b.Add(new ConstructedGenericPropertySymbol(Context, this, l[i], _genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _properties, b.DrainToImmutable()); + } + + return _properties; + } + + /// + internal override ImmutableArray GetDeclaredEvents() + { + if (_events == default) + { + var l = _typeDefinition.GetDeclaredEvents(); + var b = ImmutableArray.CreateBuilder(l.Length); + for (int i = 0; i < l.Length; i++) + b.Add(new ConstructedGenericEventSymbol(Context, this, l[i], _genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _events, b.DrainToImmutable()); + } + + return _events; + } + + /// + internal override ImmutableArray GetDeclaredNestedTypes() + { + return ImmutableArray.Empty; + } + + /// + public sealed override string? GetEnumName(object value) + { + return _typeDefinition.GetEnumName(value); + } + + /// + public sealed override ImmutableArray GetEnumNames() + { + return _typeDefinition.GetEnumNames(); + } + + /// + internal override ImmutableArray GetDeclaredInterfaces() + { + if (_interfaces == default) + { + var l = _typeDefinition.GetDeclaredInterfaces(); + var b = ImmutableArray.CreateBuilder(l.Length); + for (int i = 0; i < l.Length; i++) + b.Add(l[i].Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _interfaces, b.DrainToImmutable()); + } + + return _interfaces; + } + + /// + public sealed override bool IsEnumDefined(object value) + { + return _typeDefinition.IsEnumDefined(value); + } + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() + { + return _typeDefinition.GetDeclaredCustomAttributes(); + } + + /// + public sealed override ImmutableArray GetOptionalCustomModifiers() + { + if (_optionalCustomModifiers == default) + { + var l = _typeDefinition.GetOptionalCustomModifiers(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _optionalCustomModifiers, b.DrainToImmutable()); + } + + return _optionalCustomModifiers; + } + + /// + public sealed override ImmutableArray GetRequiredCustomModifiers() + { + if (_requiredCustomModifiers == default) + { + var l = _typeDefinition.GetRequiredCustomModifiers(); + var b = ImmutableArray.CreateBuilder(l.Length); + foreach (var i in l) + b.Add(i.Specialize(_genericContext)); + + ImmutableInterlocked.InterlockedInitialize(ref _requiredCustomModifiers, b.DrainToImmutable()); + } + + return _requiredCustomModifiers; + } + + /// + internal override TypeSymbol Specialize(GenericContext context) + { + if (ContainsGenericParameters == false) + return this; + + var args = GetGenericArguments(); + for (int i = 0; i < args.Length; i++) + if (args[i].ContainsGenericParameters) + args = args.SetItem(i, args[i].Specialize(context)); + + return _typeDefinition.MakeGenericType(args); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/CustomAttribute.cs b/src/IKVM.CoreLib/Symbols/CustomAttribute.cs new file mode 100644 index 0000000000..4dffe0bcd0 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/CustomAttribute.cs @@ -0,0 +1,192 @@ +using System; +using System.Collections.Immutable; + +using IKVM.CoreLib.Text; + +namespace IKVM.CoreLib.Symbols +{ + + public readonly record struct CustomAttribute(TypeSymbol AttributeType, MethodSymbol Constructor, ImmutableArray ConstructorArguments, ImmutableArray NamedArguments) + { + + /// + /// Initializes an instance of the interface given the constructor for the custom attribute and the arguments to the constructor. + /// + /// + /// + /// + public static CustomAttribute Create(MethodSymbol ctor, ImmutableArray constructorArgs) + { + return new CustomAttribute( + ctor.DeclaringType ?? throw new InvalidOperationException(), + ctor, + PackTypedArgs(ctor.ParameterTypes, constructorArgs), + ImmutableArray.Empty); + } + + /// + /// Initializes an instance of the interface given the constructor for the custom attribute, the arguments to the constructor, and a set of named field/value pairs. + /// + /// + /// + /// + /// + public static CustomAttribute Create(MethodSymbol ctor, ImmutableArray constructorArgs, ImmutableArray namedFields, ImmutableArray fieldValues) + { + return new CustomAttribute( + ctor.DeclaringType ?? throw new InvalidOperationException(), + ctor, + PackTypedArgs(ctor.ParameterTypes, constructorArgs), + PackNamedArgs([], [], namedFields, fieldValues)); + } + + /// + /// Initializes an instance of the interface given the constructor for the custom attribute, the arguments to the constructor, and a set of named property or value pairs. + /// + /// + /// + /// + /// + public static CustomAttribute Create(MethodSymbol ctor, ImmutableArray constructorArgs, ImmutableArray namedProperties, ImmutableArray propertyValues) + { + return new CustomAttribute( + ctor.DeclaringType ?? throw new InvalidOperationException(), + ctor, + PackTypedArgs(ctor.ParameterTypes, constructorArgs), + PackNamedArgs(namedProperties, propertyValues, [], [])); + } + + /// + /// Initializes an instance of the interface given the constructor for the custom attribute, the arguments to the constructor, a set of named property or value pairs, and a set of named field or value pairs. + /// + /// + /// + /// + /// + /// + /// + public static CustomAttribute Create(MethodSymbol ctor, ImmutableArray constructorArgs, ImmutableArray namedProperties, ImmutableArray propertyValues, ImmutableArray namedFields, ImmutableArray fieldValues) + { + return new CustomAttribute( + ctor.DeclaringType ?? throw new InvalidOperationException(), + ctor, + PackTypedArgs(ctor.ParameterTypes, constructorArgs), + PackNamedArgs(namedProperties, propertyValues, namedFields, fieldValues)); + } + + /// + /// Packs the types as typed arguments. + /// + /// + /// + /// + /// + /// + static ImmutableArray PackTypedArgs(ImmutableArray types, ImmutableArray values) + { + if (types.IsDefault) + throw new ArgumentNullException(nameof(types)); + if (values.IsDefault) + throw new ArgumentNullException(nameof(values)); + if (types.Length != values.Length) + throw new ArgumentException(); + + var a = ImmutableArray.CreateBuilder(types.Length); + for (int i = 0; i < types.Length; i++) + a.Add(PackTypedArg(types[i], values[i])); + + return a.DrainToImmutable(); + } + + /// + /// Packs the type as a typed argument. + /// + /// + /// + /// + static CustomAttributeTypedArgument PackTypedArg(TypeSymbol type, object? value) + { + return new CustomAttributeTypedArgument(type, value); + } + + /// + /// Packages the members and args as a named argument. + /// + /// + /// + /// + static ImmutableArray PackNamedArgs(ImmutableArray namedProperties, ImmutableArray propertyValues, ImmutableArray namedFields, ImmutableArray fieldValues) + { + var a = ImmutableArray.CreateBuilder(namedProperties.Length + namedFields.Length); + for (int i = 0; i < namedProperties.Length; i++) + a.Add(PackNamedArg(namedProperties[i], propertyValues[i])); + for (int i = 0; i < namedFields.Length; i++) + a.Add(PackNamedArg(namedFields[i], fieldValues[i])); + + return a.DrainToImmutable(); + } + + /// + /// Packs the property and arg as a named argument. + /// + /// + /// + /// + static CustomAttributeNamedArgument PackNamedArg(PropertySymbol property, object? v) + { + return new CustomAttributeNamedArgument(property, PackTypedArg(property.PropertyType, v)); + } + + /// + /// Packs the field and arg as a named argument. + /// + /// + /// + /// + static CustomAttributeNamedArgument PackNamedArg(FieldSymbol field, object? v) + { + return new CustomAttributeNamedArgument(field, PackTypedArg(field.FieldType, v)); + } + + /// + public override string ToString() + { + var vsb = new ValueStringBuilder(stackalloc char[256]); + + vsb.Append('['); + vsb.Append(Constructor.DeclaringType!.FullName); + vsb.Append('('); + + var first = true; + + var constructorArguments = ConstructorArguments; + var constructorArgumentsCount = constructorArguments.Length; + for (int i = 0; i < constructorArgumentsCount; i++) + { + if (!first) + vsb.Append(", "); + + vsb.Append(constructorArguments[i].ToString()); + first = false; + } + + var namedArguments = NamedArguments; + var namedArgumentsCount = namedArguments.Length; + for (int i = 0; i < namedArgumentsCount; i++) + { + if (!first) + vsb.Append(", "); + + vsb.Append(namedArguments[i].ToString()); + first = false; + } + + vsb.Append(")]"); + + return vsb.ToString(); + } + + } + + +} diff --git a/src/IKVM.CoreLib/Symbols/CustomAttributeImpl.cs b/src/IKVM.CoreLib/Symbols/CustomAttributeImpl.cs new file mode 100644 index 0000000000..9ce04b7cac --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/CustomAttributeImpl.cs @@ -0,0 +1,168 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Reflection; + +using IKVM.CoreLib.Collections; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Provides implementations in support of . + /// + struct CustomAttributeImpl + { + + readonly SymbolContext _context; + readonly ICustomAttributeProviderInternal _provider; + + TypeSymbol? _attributeUsageAttributeType; + ImmutableArray _declaredCustomAttributes; + ImmutableArray _declaredAndInheritedCustomAttributes; + + /// + /// Initializes a new instance. + /// + public CustomAttributeImpl(SymbolContext context, ICustomAttributeProviderInternal provider) + { + _context = context ?? throw new ArgumentNullException(nameof(context)); + _provider = provider ?? throw new System.ArgumentNullException(nameof(provider)); + } + + /// + /// Returns the custom attributes applied to this member. + /// + /// + /// + public ImmutableArray GetCustomAttributes(bool inherit) + { + if (inherit == false) + { + if (_declaredCustomAttributes.IsDefault) + ImmutableInterlocked.InterlockedInitialize(ref _declaredCustomAttributes, _provider.GetDeclaredCustomAttributes()); + + return _declaredCustomAttributes; + } + else + { + if (_declaredAndInheritedCustomAttributes.IsDefault) + ImmutableInterlocked.InterlockedInitialize(ref _declaredAndInheritedCustomAttributes, ComputeDeclaredAndInheritedCustomAttributes()); + + return _declaredAndInheritedCustomAttributes; + } + } + + /// + /// Computes the custom attributes that are applied to this member, including those which are inherited. + /// + /// + ImmutableArray ComputeDeclaredAndInheritedCustomAttributes() + { + var list = _provider.GetDeclaredCustomAttributes(); + + // move through the inherited custom attribute providers + for (var provider = _provider.GetInheritedCustomAttributeProvider(); provider != null; provider = provider.GetInheritedCustomAttributeProvider()) + foreach (var customAttribute in provider.GetDeclaredCustomAttributes()) + if (IsInheritable(customAttribute)) + list = list.Add(customAttribute); + + return list; + } + + /// + /// Returns true if the specified is inherited. + /// + /// + /// + /// + bool IsInheritable(CustomAttribute customAttribute) + { + _attributeUsageAttributeType ??= _context.ResolveCoreType(typeof(AttributeUsageAttribute).FullName!); + if (_attributeUsageAttributeType == null) + throw new InvalidOperationException("Could not find core type System.AttributeUsageAttribute."); + + // AttributeUsageAttribute is inheritable; this prevents recursion + if (customAttribute.AttributeType == _attributeUsageAttributeType) + return true; + + // attribute usage should decorate the attribute type, either here or directly + var attributeUsageAttribute = GetNearestInheritedCustomAttribute(customAttribute.AttributeType, _attributeUsageAttributeType); + if (attributeUsageAttribute == null) + throw new InvalidOperationException(); + + // return whether the Inherited property is set + return GetInheritedValue(attributeUsageAttribute.Value); + } + + /// + /// Gets the nearest custom attribute of the specified type. + /// + /// + /// + /// + CustomAttribute? GetNearestInheritedCustomAttribute(ICustomAttributeProviderInternal provider, TypeSymbol attributeType) + { + foreach (var customAttribute in provider.GetDeclaredCustomAttributes()) + if (customAttribute.AttributeType == attributeType) + return customAttribute; + + for (ICustomAttributeProviderInternal? baseProvider = provider.GetInheritedCustomAttributeProvider(); baseProvider != null; baseProvider = baseProvider.GetInheritedCustomAttributeProvider()) + foreach (var customAttribute in provider.GetDeclaredCustomAttributes()) + if (customAttribute.AttributeType == attributeType) + return customAttribute; + + return null; + } + + /// + /// Gets the boolean value of the property. + /// + /// + /// + bool GetInheritedValue(CustomAttribute attributeUsageAttribute) + { + foreach (var i in attributeUsageAttribute.NamedArguments) + if (i.MemberInfo is PropertySymbol property && property.Name == nameof(AttributeUsageAttribute.Inherited) && (bool?)i.TypedValue.Value == true) + return true; + + return false; + } + + /// + /// Returns the custom attributes applied to this member. + /// + /// + /// + public ImmutableArray GetCustomAttributes(TypeSymbol attributeType, bool inherit) + { + return GetCustomAttributes(inherit).Where(i => i.AttributeType == attributeType).ToImmutableArray(); + + } + + /// + /// Retrieves a custom attribute of a specified type applied to this member. + /// + /// + /// + /// + public CustomAttribute? GetCustomAttribute(TypeSymbol attributeType, bool inherit) + { + return GetCustomAttributes(attributeType, inherit).Select(static i => new CustomAttribute?(i)).SingleOrDefaultOrThrow(static () => new AmbiguousMatchException()); + } + + /// + /// Determines whether any custom attributes of a specified type are applied to an assembly, module, type member, or method parameter. + /// + /// + /// + /// + public bool IsDefined(TypeSymbol attributeType, bool inherit) + { + return GetCustomAttributes(attributeType, inherit).Any(); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/CustomAttributeNamedArgument.cs b/src/IKVM.CoreLib/Symbols/CustomAttributeNamedArgument.cs new file mode 100644 index 0000000000..8985458255 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/CustomAttributeNamedArgument.cs @@ -0,0 +1,20 @@ +namespace IKVM.CoreLib.Symbols +{ + + public readonly record struct CustomAttributeNamedArgument(MemberSymbol MemberInfo, CustomAttributeTypedArgument TypedValue) + { + + /// + /// Gets the type of the argument. + /// + internal TypeSymbol ArgumentType => MemberInfo is FieldSymbol fi ? fi.FieldType : ((PropertySymbol)MemberInfo).PropertyType; + + /// + public override string? ToString() + { + return $"{MemberInfo.Name} = {TypedValue.ToString(ArgumentType != ArgumentType.Context.ResolveCoreType("System.Object"))}"; + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/CustomAttributeSymbol.cs b/src/IKVM.CoreLib/Symbols/CustomAttributeSymbol.cs deleted file mode 100644 index dbdab0f3cb..0000000000 --- a/src/IKVM.CoreLib/Symbols/CustomAttributeSymbol.cs +++ /dev/null @@ -1,12 +0,0 @@ -using System.Collections.Immutable; - -namespace IKVM.CoreLib.Symbols -{ - - readonly record struct CustomAttributeSymbol( - ITypeSymbol AttributeType, - IConstructorSymbol Constructor, - ImmutableArray ConstructorArguments, - ImmutableArray NamedArguments); - -} diff --git a/src/IKVM.CoreLib/Symbols/CustomAttributeSymbolNamedArgument.cs b/src/IKVM.CoreLib/Symbols/CustomAttributeSymbolNamedArgument.cs deleted file mode 100644 index c01598e24c..0000000000 --- a/src/IKVM.CoreLib/Symbols/CustomAttributeSymbolNamedArgument.cs +++ /dev/null @@ -1,10 +0,0 @@ -namespace IKVM.CoreLib.Symbols -{ - - readonly record struct CustomAttributeSymbolNamedArgument( - bool IsField, - IMemberSymbol MemberInfo, - string MemberName, - CustomAttributeSymbolTypedArgument TypedValue); - -} diff --git a/src/IKVM.CoreLib/Symbols/CustomAttributeSymbolTypedArgument.cs b/src/IKVM.CoreLib/Symbols/CustomAttributeSymbolTypedArgument.cs deleted file mode 100644 index 0f56df5a32..0000000000 --- a/src/IKVM.CoreLib/Symbols/CustomAttributeSymbolTypedArgument.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace IKVM.CoreLib.Symbols -{ - - readonly record struct CustomAttributeSymbolTypedArgument( - ITypeSymbol ArgumentType, - object? Value); - -} diff --git a/src/IKVM.CoreLib/Symbols/CustomAttributeTypedArgument.cs b/src/IKVM.CoreLib/Symbols/CustomAttributeTypedArgument.cs new file mode 100644 index 0000000000..3aec9a5c96 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/CustomAttributeTypedArgument.cs @@ -0,0 +1,69 @@ +using System.Collections.Generic; + +using IKVM.CoreLib.Text; + +namespace IKVM.CoreLib.Symbols +{ + + public readonly record struct CustomAttributeTypedArgument(TypeSymbol ArgumentType, object? Value) + { + + public override string ToString() => ToString(false); + + /// + /// Returns a string reprsentation of this typed argument. + /// + /// + /// + internal string ToString(bool typed) + { + if (ArgumentType is null) + return base.ToString()!; + + if (ArgumentType.IsEnum) + return typed ? $"{Value}" : $"({ArgumentType.FullName}){Value}"; + + if (Value is null) + return typed ? "null" : $"({ArgumentType.Name})null"; + + if (ArgumentType == ArgumentType.Context.ResolveCoreType("System.String")) + return $"\"{Value}\""; + + if (ArgumentType == ArgumentType.Context.ResolveCoreType("System.Char")) + return $"'{Value}'"; + + if (ArgumentType == ArgumentType.Context.ResolveCoreType("System.Type")) + return $"typeof({((TypeSymbol)Value!).FullName})"; + + if (ArgumentType.IsArray) + { + var array = (IReadOnlyList)Value!; + var elementType = ArgumentType.GetElementType()!; + + using var result = new ValueStringBuilder(stackalloc char[256]); + result.Append("new "); + result.Append(elementType.IsEnum ? elementType.FullName : elementType.Name); + result.Append('['); + var count = array.Count; + result.Append(count.ToString()); + result.Append("] { "); + + for (int i = 0; i < count; i++) + { + if (i != 0) + result.Append(", "); + + result.Append(array[i].ToString(elementType != ArgumentType.Context.ResolveCoreType("System.Object"))); + } + + result.Append(" }"); + + return result.ToString(); + } + + return typed ? $"{Value}" : $"({ArgumentType.Name}){Value}"; + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefaultBinder.cs b/src/IKVM.CoreLib/Symbols/DefaultBinder.cs new file mode 100644 index 0000000000..4e5177dfa2 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefaultBinder.cs @@ -0,0 +1,635 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Provides methods to select various symbols based on requirements. + /// + internal class DefaultBinder + { + + readonly SymbolContext _context; + + TypeSymbol? _lazyObjectType; + TypeSymbol? _lazyIntPtrType; + TypeSymbol? _lazyUIntPtrType; + + /// + /// Initializes a new instance. + /// + /// + /// + public DefaultBinder(SymbolContext context) + { + _context = context ?? throw new ArgumentNullException(nameof(context)); + } + + /// + /// Gets the symbol for . + /// + TypeSymbol ObjectType => _lazyObjectType ??= _context.ResolveCoreType("System.Object"); + + /// + /// Gets the symbol for . + /// + TypeSymbol IntPtrType => _lazyIntPtrType ??= _context.ResolveCoreType("System.IntPtr"); + + /// + /// Gets the symbol for . + /// + TypeSymbol UIntPtrType => _lazyUIntPtrType ??= _context.ResolveCoreType("System.UIntPtr"); + + /// + /// Given a set of methods that match the base criteria, select a method based upon an array of parameter types. This + /// method should return null if no method matches the criteria. + /// + public MethodSymbol? SelectMethod(IReadOnlyList match, BindingFlags bindingFlags, TypeSymbolSelectorList types, ImmutableArray modifiers) + { + // we don't automatically jump out on exact match + if (match == null || match.Count == 0) + throw new ArgumentException("Unexpected empty array.", nameof(match)); + + var candidates = new List(match); + + // find all the methods that can be described by the types parameter + // remove all of them that cannot + int curIdx = 0; + for (var i = 0; i < candidates.Count; i++) + { + var par = candidates[i].Parameters; + if (par.Length != types.Indexes.Length) + continue; + + int j; + for (j = 0; j < types.Indexes.Length; j++) + if (types.Indexes[j].Match(_context, par[j].ParameterType) == false) + break; + + if (j == types.Indexes.Length) + candidates[curIdx++] = candidates[i]; + } + + if (curIdx == 0) + return null; + if (curIdx == 1) + return candidates[0]; + + // walk all of the methods looking the most specific method to invoke + int currentMin = 0; + var ambig = false; + + var paramOrder = types.Indexes.Length > 0 ? stackalloc int[types.Indexes.Length] : Array.Empty(); + for (var i = 0; i < types.Indexes.Length; i++) + paramOrder[i] = i; + + for (var i = 1; i < curIdx; i++) + { + int newMin = FindMostSpecificMethod(candidates[currentMin], paramOrder, null, candidates[i], paramOrder, null, types); + if (newMin == 0) + ambig = true; + else + { + if (newMin == 2) + { + ambig = false; + currentMin = i; + } + } + } + + var bestMatch = candidates[currentMin]; + if (ambig) + throw new AmbiguousMatchException($"Ambiguous match found for '{bestMatch.DeclaringType} {bestMatch}'."); + + return bestMatch; + } + + /// + /// Selects the property that matches the base criteria. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + public PropertySymbol? SelectProperty(BindingFlags bindingAttr, IReadOnlyList match, TypeSymbol? returnType, TypeSymbolSelectorList indexes, ImmutableArray modifiers) + { + // if indexes is present every element must be non-null + if (indexes.Indexes.IsDefault == false) + foreach (var index in indexes.Indexes) + throw new ArgumentNullException(nameof(index)); + + if (match == null || match.Count == 0) + throw new ArgumentException(nameof(match)); + + var candidates = new List(match); + + int i, j = 0; + + // Find all the properties that can be described by type indexes parameter + int curIdx = 0; + for (i = 0; i < candidates.Count; i++) + { + if (indexes.Indexes.IsDefault == false) + { + var par = candidates[i].GetIndexParameters(); + if (par.Length != indexes.Indexes.Length) + continue; + + for (j = 0; j < indexes.Indexes.Length; j++) + if (indexes.Indexes[j].Match(_context, par[j].ParameterType) == false) + break; + } + + if (indexes.Indexes.IsDefault || j == indexes.Indexes.Length) + { + if (returnType != null) + { + if (candidates[i].PropertyType.IsPrimitive) + { + if (CanChangePrimitive(returnType, candidates[i].PropertyType) == false) + continue; + } + else + { + if (candidates[i].PropertyType.IsAssignableFrom(returnType) == false) + continue; + } + } + + candidates[curIdx++] = candidates[i]; + } + } + + if (curIdx == 0) + return null; + + if (curIdx == 1) + return candidates[0]; + + int currentMin = 0; + var ambig = false; + + var paramOrder = indexes.Indexes.IsDefault == false && indexes.Indexes.Length > 0 ? stackalloc int[indexes.Indexes.Length] : Array.Empty(); + for (i = 0; i < paramOrder.Length; i++) + paramOrder[i] = i; + + for (i = 1; i < curIdx; i++) + { + int newMin = FindMostSpecificType(candidates[currentMin].PropertyType, candidates[i].PropertyType, returnType); + if (newMin == 0 && indexes.Indexes.IsDefault == false) + newMin = FindMostSpecific(candidates[currentMin].GetIndexParameters(), paramOrder, null, candidates[i].GetIndexParameters(), paramOrder, null, indexes); + + if (newMin == 0) + { + newMin = FindMostSpecificProperty(candidates[currentMin], candidates[i]); + if (newMin == 0) + ambig = true; + } + + if (newMin == 2) + { + ambig = false; + currentMin = i; + } + } + + var bestMatch = candidates[currentMin]; + if (ambig) + throw new AmbiguousMatchException(bestMatch.ToString()); + + return bestMatch; + } + + /// + /// Returns any exact bindings that may exist. + /// + /// + /// + /// + /// + public MethodSymbol? ExactBinding(IReadOnlyList match, ImmutableArray types) + { + if (match is null) + throw new ArgumentNullException(nameof(match)); + + var aExactMatches = new MethodSymbol[match.Count]; + int cExactMatches = 0; + + for (int i = 0; i < match.Count; i++) + { + var par = match[i].Parameters; + if (par.Length == 0) + continue; + + int j; + for (j = 0; j < types.Length; j++) + { + var pCls = par[j].ParameterType; + + // If the classes exactly match continue + if (!pCls.Equals(types[j])) + break; + } + + if (j < types.Length) + continue; + + // Add the exact match to the array of exact matches. + aExactMatches[cExactMatches] = match[i]; + cExactMatches++; + } + + if (cExactMatches == 0) + return null; + + if (cExactMatches == 1) + return aExactMatches[0]; + + return FindMostDerivedNewSlotMeth(aExactMatches, cExactMatches); + } + + /// + /// Returns any exact bindings that may exist. + /// + /// + /// + /// + /// + /// + /// + public PropertySymbol? ExactPropertyBinding(IReadOnlyList match, TypeSymbol? returnType, ImmutableArray types) + { + if (match == null) + throw new ArgumentNullException(nameof(match)); + + PropertySymbol? bestMatch = null; + + for (int i = 0; i < match.Count; i++) + { + var parameter = match[i].GetIndexParameters(); + + int j; + for (j = 0; j < types.Length; j++) + { + var parameterType = parameter[j].ParameterType; + + // If the classes exactly match continue + if (parameterType != types![j]) + break; + } + + if (j < types.Length) + continue; + + if (returnType != null && returnType != match[i].PropertyType) + continue; + + if (bestMatch != null) + throw new AmbiguousMatchException(bestMatch.ToString()); + + bestMatch = match[i]; + } + + return bestMatch; + } + + int FindMostSpecific(ImmutableArray p1, ReadOnlySpan paramOrder1, TypeSymbol? paramArrayType1, + ImmutableArray p2, ReadOnlySpan paramOrder2, TypeSymbol? paramArrayType2, + TypeSymbolSelectorList types) + { + // a method using params is always less specific than one not using params + if (paramArrayType1 != null && paramArrayType2 == null) + return 2; + if (paramArrayType2 != null && paramArrayType1 == null) + return 1; + + // now either p1 and p2 both use params or neither does. + var p1Less = false; + var p2Less = false; + + for (int i = 0; i < types.Indexes.Length; i++) + { + TypeSymbol c1, c2; + + // If a param array is present, then either + // the user re-ordered the parameters in which case + // the argument to the param array is either an array + // in which case the params is conceptually ignored and so paramArrayType1 == null + // or the argument to the param array is a single element + // in which case paramOrder[i] == p1.Length - 1 for that element + // or the user did not re-order the parameters in which case + // the paramOrder array could contain indexes larger than p.Length - 1 (see VSW 577286) + // so any index >= p.Length - 1 is being put in the param array + + if (paramArrayType1 != null && paramOrder1[i] >= p1.Length - 1) + c1 = paramArrayType1; + else + c1 = p1[paramOrder1[i]].ParameterType; + + if (paramArrayType2 != null && paramOrder2[i] >= p2.Length - 1) + c2 = paramArrayType2; + else + c2 = p2[paramOrder2[i]].ParameterType; + + if (c1 == c2) + continue; + + switch (FindMostSpecificType(c1, c2, types.Indexes[i])) + { + case 0: return 0; + case 1: p1Less = true; break; + case 2: p2Less = true; break; + } + } + + // Two way p1Less and p2Less can be equal. All the arguments are the + // same they both equal false, otherwise there were things that both + // were the most specific type on.... + if (p1Less == p2Less) + { + return 0; + } + else + { + return p1Less ? 1 : 2; + } + } + + /// + /// Finds which type is the most specific. + /// + /// + /// + /// + /// + int FindMostSpecificType(TypeSymbol c1, TypeSymbol c2, TypeSymbolSelector t) + { + return t.FindMostSpecific(_context, c1, c2); + } + + int FindMostSpecificMethod(MethodSymbol m1, ReadOnlySpan paramOrder1, TypeSymbol? paramArrayType1, + MethodSymbol m2, ReadOnlySpan paramOrder2, TypeSymbol? paramArrayType2, + TypeSymbolSelectorList types) + { + // Find the most specific method based on the parameters. + int res = FindMostSpecific(m1.Parameters, paramOrder1, paramArrayType1, + m2.Parameters, paramOrder2, paramArrayType2, types); + + // If the match was not ambiguous then return the result. + if (res != 0) + return res; + + // Check to see if the methods have the exact same name and signature. + if (CompareMethodSig(m1, m2)) + { + // Determine the depth of the declaring types for both methods. + var hierarchyDepth1 = GetHierarchyDepth(m1.DeclaringType!); + var hierarchyDepth2 = GetHierarchyDepth(m2.DeclaringType!); + + // the most derived method is the most specific one + if (hierarchyDepth1 == hierarchyDepth2) + return 0; + + if (hierarchyDepth1 < hierarchyDepth2) + return 2; + + return 1; + } + + // The match is ambiguous. + return 0; + } + + int FindMostSpecificField(FieldSymbol cur1, FieldSymbol cur2) + { + // Check to see if the fields have the same name. + if (cur1.Name == cur2.Name) + { + int hierarchyDepth1 = GetHierarchyDepth(cur1.DeclaringType!); + int hierarchyDepth2 = GetHierarchyDepth(cur2.DeclaringType!); + + if (hierarchyDepth1 == hierarchyDepth2) + { + Debug.Assert(cur1.IsStatic != cur2.IsStatic, "hierarchyDepth1 == hierarchyDepth2"); + return 0; + } + else if (hierarchyDepth1 < hierarchyDepth2) + return 2; + else + return 1; + } + + // The match is ambiguous. + return 0; + } + + int FindMostSpecificProperty(PropertySymbol cur1, PropertySymbol cur2) + { + // Check to see if the fields have the same name. + if (cur1.Name == cur2.Name) + { + int hierarchyDepth1 = GetHierarchyDepth(cur1.DeclaringType!); + int hierarchyDepth2 = GetHierarchyDepth(cur2.DeclaringType!); + + if (hierarchyDepth1 == hierarchyDepth2) + { + return 0; + } + else if (hierarchyDepth1 < hierarchyDepth2) + return 2; + else + return 1; + } + + // The match is ambiguous. + return 0; + } + + /// + /// Returns true if the two methods have the exact same signature. + /// + /// + /// + /// + public static bool CompareMethodSig(MethodSymbol m1, MethodSymbol m2) + { + var params1 = m1.Parameters; + var params2 = m2.Parameters; + + if (params1.Length != params2.Length) + return false; + + for (int i = 0; i < params1.Length; i++) + if (params1[i].ParameterType != params2[i].ParameterType) + return false; + + return true; + } + + /// + /// Gets the depth of the type within the type hierarchy. + /// + /// + /// + int GetHierarchyDepth(TypeSymbol type) + { + int depth = 0; + + for (var cType = (TypeSymbol?)type; cType != null; cType = cType.BaseType) + depth++; + + return depth; + } + + internal MethodSymbol? FindMostDerivedNewSlotMeth(ReadOnlySpan match, int cMatches) + { + int deepestHierarchy = 0; + MethodSymbol? methWithDeepestHierarchy = null; + + for (int i = 0; i < cMatches; i++) + { + // Calculate the depth of the hierarchy of the declaring type of the current method. + int currentHierarchyDepth = GetHierarchyDepth(match[i].DeclaringType!); + + // The two methods have the same name, signature, and hierarchy depth. + // This can only happen if at least one is vararg or generic. + if (currentHierarchyDepth == deepestHierarchy) + throw new AmbiguousMatchException(methWithDeepestHierarchy!.ToString()); + + // Check to see if this method is on the most derived class. + if (currentHierarchyDepth > deepestHierarchy) + { + deepestHierarchy = currentHierarchyDepth; + methWithDeepestHierarchy = match[i]; + } + } + + return methWithDeepestHierarchy; + } + + // This method will create the mapping between the Parameters and the underlying + // data based upon the names array. The names array is stored in the same order + // as the values and maps to the parameters of the method. We store the mapping + // from the parameters to the names in the paramOrder array. All parameters that + // don't have matching names are then stored in the array in order. + bool CreateParamOrder(int[] paramOrder, ImmutableArray pars, string[] names) + { + var used = new bool[pars.Length]; + + // Mark which parameters have not been found in the names list + for (var i = 0; i < pars.Length; i++) + paramOrder[i] = -1; + + // Find the parameters with names. + for (var i = 0; i < names.Length; i++) + { + int j; + for (j = 0; j < pars.Length; j++) + { + if (names[i].Equals(pars[j].Name)) + { + paramOrder[j] = i; + used[i] = true; + break; + } + } + + // This is an error condition. The name was not found. This method must not match what we sent. + if (j == pars.Length) + return false; + } + + // Now we fill in the holes with the parameters that are unused. + int pos = 0; + for (int i = 0; i < pars.Length; i++) + { + if (paramOrder[i] == -1) + { + for (; pos < pars.Length; pos++) + { + if (!used[pos]) + { + paramOrder[i] = pos; + pos++; + break; + } + } + } + } + + return true; + } + + /// + /// Returns true if the given source primitive type can be converted to the given target primitive type. + /// + /// + /// + /// + internal bool CanChangePrimitive(TypeSymbol source, TypeSymbol target) + { + if ((source == IntPtrType && target == IntPtrType) || (source == UIntPtrType && target == UIntPtrType)) + return true; + + var widerCodes = PrimitiveConversions[(int)source.TypeCode]; + var targetCode = (Primitives)(1 << (int)target.TypeCode); + + return (widerCodes & targetCode) != 0; + } + + static ReadOnlySpan PrimitiveConversions => + [ + /* Empty */ 0, // not primitive + /* Object */ 0, // not primitive + /* DBNull */ 0, // not primitive + /* Boolean */ Primitives.Boolean, + /* Char */ Primitives.Char | Primitives.UInt16 | Primitives.UInt32 | Primitives.Int32 | Primitives.UInt64 | Primitives.Int64 | Primitives.Single | Primitives.Double, + /* SByte */ Primitives.SByte | Primitives.Int16 | Primitives.Int32 | Primitives.Int64 | Primitives.Single | Primitives.Double, + /* Byte */ Primitives.Byte | Primitives.Char | Primitives.UInt16 | Primitives.Int16 | Primitives.UInt32 | Primitives.Int32 | Primitives.UInt64 | Primitives.Int64 | Primitives.Single | Primitives.Double, + /* Int16 */ Primitives.Int16 | Primitives.Int32 | Primitives.Int64 | Primitives.Single | Primitives.Double, + /* UInt16 */ Primitives.UInt16 | Primitives.UInt32 | Primitives.Int32 | Primitives.UInt64 | Primitives.Int64 | Primitives.Single | Primitives.Double, + /* Int32 */ Primitives.Int32 | Primitives.Int64 | Primitives.Single | Primitives.Double, + /* UInt32 */ Primitives.UInt32 | Primitives.UInt64 | Primitives.Int64 | Primitives.Single | Primitives.Double, + /* Int64 */ Primitives.Int64 | Primitives.Single | Primitives.Double, + /* UInt64 */ Primitives.UInt64 | Primitives.Single | Primitives.Double, + /* Single */ Primitives.Single | Primitives.Double, + /* Double */ Primitives.Double, + /* Decimal */ Primitives.Decimal, + /* DateTime */ Primitives.DateTime, + /* [Unused] */ 0, + /* String */ Primitives.String, + ]; + + [Flags] + enum Primitives + { + Boolean = 1 << TypeCode.Boolean, + Char = 1 << TypeCode.Char, + SByte = 1 << TypeCode.SByte, + Byte = 1 << TypeCode.Byte, + Int16 = 1 << TypeCode.Int16, + UInt16 = 1 << TypeCode.UInt16, + Int32 = 1 << TypeCode.Int32, + UInt32 = 1 << TypeCode.UInt32, + Int64 = 1 << TypeCode.Int64, + UInt64 = 1 << TypeCode.UInt64, + Single = 1 << TypeCode.Single, + Double = 1 << TypeCode.Double, + Decimal = 1 << TypeCode.Decimal, + DateTime = 1 << TypeCode.DateTime, + String = 1 << TypeCode.String, + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefinitionAssemblySymbol.cs b/src/IKVM.CoreLib/Symbols/DefinitionAssemblySymbol.cs new file mode 100644 index 0000000000..7577a37aa2 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefinitionAssemblySymbol.cs @@ -0,0 +1,109 @@ +using System; +using System.Collections.Immutable; +using System.IO; +using System.Threading; + +namespace IKVM.CoreLib.Symbols +{ + + class DefinitionAssemblySymbol : AssemblySymbol + { + + readonly AssemblyIdentity _identity; + AssemblyDefinition? _def; + + ImmutableArray _modules; + ImmutableArray _referencedAssemblies; + ImmutableArray _customAttributes; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + public DefinitionAssemblySymbol(SymbolContext symbol, AssemblyIdentity identity, AssemblyDefinition? def) : + base(symbol) + { + _identity = identity ?? throw new ArgumentNullException(nameof(identity)); + _def = def; + } + + /// + /// Gets the underlying source information. If the type source is missing, null is returned. + /// + AssemblyDefinition? Def => GetDef(); + + /// + /// Attempts to resolve the symbol definition source. + /// + /// + AssemblyDefinition? GetDef() + { + if (_def is null) + Interlocked.CompareExchange(ref _def, Context.ResolveAssemblyDef(_identity), null); + + return _def; + } + + /// + /// Attempts to resolve the symbol definition source, or throws. + /// + AssemblyDefinition DefOrThrow => Def ?? throw new MissingAssemblySymbolException(this); + + /// + public sealed override bool IsMissing => Def == null; + + /// + public sealed override AssemblyIdentity Identity => _identity; + + /// + public sealed override string ImageRuntimeVersion => DefOrThrow.GetImageRuntimeVersion(); + + /// + public sealed override string Location => DefOrThrow.GetLocation(); + + /// + public sealed override ModuleSymbol ManifestModule => DefOrThrow.GetManifestModule(); + + /// + public sealed override MethodSymbol? EntryPoint => DefOrThrow.GetEntryPoint(); + + /// + public sealed override ManifestResourceInfo? GetManifestResourceInfo(string resourceName) => DefOrThrow.GetManifestResourceInfo(resourceName); + + /// + public sealed override Stream? GetManifestResourceStream(string name) => DefOrThrow.GetManifestResourceStream(name); + + /// + public sealed override ImmutableArray GetModules() + { + if (_modules.IsDefault) + ImmutableInterlocked.InterlockedInitialize(ref _modules, DefOrThrow.GetModules()); + + return _modules; + } + + /// + public sealed override ImmutableArray GetReferencedAssemblies() + { + if (_referencedAssemblies.IsDefault) + ImmutableInterlocked.InterlockedInitialize(ref _referencedAssemblies, DefOrThrow.GetReferencedAssemblies()); + + return _referencedAssemblies; + } + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() => DefOrThrow.GetCustomAttributes(); + + /// + /// Attempts to resolve the module source of this assembly with the given name. + /// + /// + /// + internal ModuleDefinition ResolveModuleDef(string name) => Def?.ResolveModuleDef(name); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefinitionEventSymbol.cs b/src/IKVM.CoreLib/Symbols/DefinitionEventSymbol.cs new file mode 100644 index 0000000000..91c211879f --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefinitionEventSymbol.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; +using System.Threading; + +namespace IKVM.CoreLib.Symbols +{ + + class DefinitionEventSymbol : EventSymbol + { + + readonly string _name; + DefinitionTypeSymbol _declaringTypeDef; + EventDefinition? _def; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + protected DefinitionEventSymbol(SymbolContext context, DefinitionTypeSymbol declaringType, string name) : + base(context, declaringType) + { + _declaringTypeDef = declaringType ?? throw new ArgumentNullException(nameof(declaringType)); + _name = name ?? throw new ArgumentNullException(nameof(name)); + } + + /// + /// Gets the underlying source information. If the type source is missing, null is returned. + /// + EventDefinition? Def => GetDef(); + + /// + /// Attempts to resolve the symbol definition source. + /// + /// + EventDefinition? GetDef() + { + if (_def is null) + Interlocked.CompareExchange(ref _def, _declaringTypeDef.ResolveEventDef(_name), null); + + return _def; + } + + /// + /// Attempts to resolve the symbol definition source, or throws. + /// + EventDefinition DefOrThrow => Def ?? throw new MissingEventSymbolException(this); + + /// + public sealed override bool IsMissing => Def == null; + + /// + public sealed override string Name => _name; + + /// + public override EventAttributes Attributes => DefOrThrow.GetAttributes(); + + /// + public override TypeSymbol? EventHandlerType => DefOrThrow.GetEventHandlerType(); + + /// + public override MethodSymbol? AddMethod => DefOrThrow.GetAddMethod(); + + /// + public override MethodSymbol? RemoveMethod => DefOrThrow.GetRemoveMethod(); + + /// + public override MethodSymbol? RaiseMethod => DefOrThrow.GetRaiseMethod(); + + /// + public override ImmutableArray OtherMethods => DefOrThrow.GetOtherMethods(); + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() => DefOrThrow.GetCustomAttributes(); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefinitionFieldSymbol.cs b/src/IKVM.CoreLib/Symbols/DefinitionFieldSymbol.cs new file mode 100644 index 0000000000..00d73af3ee --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefinitionFieldSymbol.cs @@ -0,0 +1,85 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; +using System.Threading; + +namespace IKVM.CoreLib.Symbols +{ + + class DefinitionFieldSymbol : FieldSymbol + { + + readonly string _name; + readonly DefinitionModuleSymbol _moduleDef; + readonly DefinitionTypeSymbol? _declaringTypeDef; + FieldDefinition? _def; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + public DefinitionFieldSymbol(SymbolContext context, DefinitionModuleSymbol moduleDef, DefinitionTypeSymbol? declaringTypeDef, string name, FieldDefinition? def) : + base(context, moduleDef, declaringTypeDef) + { + _moduleDef = moduleDef ?? throw new ArgumentNullException(nameof(moduleDef)); + _declaringTypeDef = declaringTypeDef; + _name = name ?? throw new ArgumentNullException(nameof(name)); + _def = def; + } + + /// + /// Gets the underlying source information. If the type source is missing, null is returned. + /// + FieldDefinition? Def => GetDef(); + + /// + /// Attempts to resolve the symbol definition source. + /// + /// + FieldDefinition? GetDef() + { + if (_def is null) + if (_declaringTypeDef is { } dt) + Interlocked.CompareExchange(ref _def, dt.ResolveFieldDef(_name), null); + else + Interlocked.CompareExchange(ref _def, _moduleDef.ResolveFieldDef(_name), null); + + return _def; + } + + /// + /// Attempts to resolve the symbol definition source, or throws. + /// + FieldDefinition DefOrThrow => Def ?? throw new MissingFieldSymbolException(this); + + /// + public sealed override bool IsMissing => Def == null; + + /// + public sealed override string Name => _name; + + /// + public override FieldAttributes Attributes => DefOrThrow.GetAttributes(); + + /// + public override TypeSymbol FieldType => DefOrThrow.GetFieldType(); + + /// + public override object? GetRawConstantValue() => DefOrThrow.GetConstantValue(); + + /// + public override ImmutableArray GetRequiredCustomModifiers() => DefOrThrow.GetRequiredCustomModifiers(); + + /// + public override ImmutableArray GetOptionalCustomModifiers() => DefOrThrow.GetOptionalCustomModifiers(); + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() => DefOrThrow.GetCustomAttributes(); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefinitionMethodSymbol.cs b/src/IKVM.CoreLib/Symbols/DefinitionMethodSymbol.cs new file mode 100644 index 0000000000..db9a9c489f --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefinitionMethodSymbol.cs @@ -0,0 +1,99 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; +using System.Threading; + +namespace IKVM.CoreLib.Symbols +{ + + class DefinitionMethodSymbol : MethodSymbol + { + + readonly string _name; + readonly DefinitionModuleSymbol _moduleDef; + readonly DefinitionTypeSymbol? _declaringTypeDef; + MethodDefinition? _def; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + public DefinitionMethodSymbol(SymbolContext context, DefinitionModuleSymbol moduleDef, DefinitionTypeSymbol? declaringTypeDef, string name, MethodDefinition? def) : + base(context, moduleDef, declaringTypeDef) + { + _moduleDef = moduleDef ?? throw new ArgumentNullException(nameof(moduleDef)); + _declaringTypeDef = declaringTypeDef; + _name = name ?? throw new ArgumentNullException(nameof(name)); + _def = def; + } + + /// + /// Gets the underlying source information. If the type source is missing, null is returned. + /// + MethodDefinition? Def => GetDef(); + + /// + /// Attempts to resolve the symbol definition source. + /// + /// + MethodDefinition? GetDef() + { + if (_def is null) + if (_declaringTypeDef is { } dt) + Interlocked.CompareExchange(ref _def, dt.ResolveMethodDef(_name), null); + else + Interlocked.CompareExchange(ref _def, _moduleDef.ResolveMethodDef(_name), null); + + return _def; + } + + /// + /// Attempts to resolve the symbol definition source, or throws. + /// + MethodDefinition DefOrThrow => Def ?? throw new MissingMethodSymbolException(this); + + /// + public sealed override bool IsMissing => Def == null; + + /// + public sealed override string Name => _name; + + /// + public sealed override MethodAttributes Attributes => DefOrThrow.GetAttributes(); + + /// + public sealed override CallingConventions CallingConvention => DefOrThrow.GetCallingConvention(); + + /// + public sealed override bool IsGenericMethodDefinition => GenericArguments.IsEmpty == false; + + /// + public sealed override bool IsConstructedGenericMethod => false; + + /// + public sealed override MethodImplAttributes MethodImplementationFlags => DefOrThrow.GetMethodImplementationFlags(); + + /// + public sealed override ImmutableArray GenericArguments => DefOrThrow.GetGenericArguments(); + + /// + public sealed override ImmutableArray Parameters => DefOrThrow.GetParameters(); + + /// + public sealed override ParameterSymbol ReturnParameter => DefOrThrow.GetReturnParameter(); + + /// + public sealed override MethodSymbol? BaseDefinition => throw new System.NotImplementedException(); + + /// + public sealed override MethodSymbol? GenericMethodDefinition => IsGenericMethodDefinition ? this : throw new InvalidOperationException(); + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() => DefOrThrow.GetCustomAttributes(); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefinitionModuleSymbol.cs b/src/IKVM.CoreLib/Symbols/DefinitionModuleSymbol.cs new file mode 100644 index 0000000000..ccf49f12f3 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefinitionModuleSymbol.cs @@ -0,0 +1,151 @@ +using System; +using System.Collections.Immutable; +using System.Threading; + +namespace IKVM.CoreLib.Symbols +{ + + class DefinitionModuleSymbol : ModuleSymbol + { + + readonly string _name; + readonly DefinitionAssemblySymbol _assemblyDef; + + ModuleDefinition? _def; + + ImmutableArray _fields; + ImmutableArray _methods; + ImmutableArray _types; + ImmutableArray _customAttributes; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + public DefinitionModuleSymbol(SymbolContext context, DefinitionAssemblySymbol assemblyDef, string name, ModuleDefinition? def) : + base(context, assemblyDef) + { + _assemblyDef = assemblyDef ?? throw new ArgumentNullException(nameof(assemblyDef)); + _name = name ?? throw new ArgumentNullException(nameof(name)); + _def = def; + } + + /// + /// Gets the underlying source information. If the type source is missing, null is returned. + /// + ModuleDefinition? Def => GetDef(); + + /// + /// Attempts to resolve the symbol definition source. + /// + /// + ModuleDefinition? GetDef() + { + if (_def is null) + Interlocked.CompareExchange(ref _def, _assemblyDef.ResolveModuleDef(_name), null); + + return _def; + } + + /// + /// Attempts to resolve the symbol definition source, or throws. + /// + ModuleDefinition DefOrThrow => Def ?? throw new MissingModuleSymbolException(this); + + /// + public override bool IsMissing => Def == null; + + /// + public sealed override string Name => _name; + + /// + public sealed override string FullyQualifiedName => DefOrThrow.GetFullyQualifiedName(); + + /// + public sealed override string ScopeName => DefOrThrow.GetScopeName(); + + /// + public sealed override Guid ModuleVersionId => DefOrThrow.GetModuleVersionId(); + + /// + internal sealed override ImmutableArray GetDeclaredFields() + { + // TODO integrate missing? + if (_fields.IsDefault) + { + var l = DefOrThrow.GetFields(); + var b = ImmutableArray.CreateBuilder(l.Length); + for (int i = 0; i < l.Length; i++) + b.Add(new DefinitionFieldSymbol(Context, this, null, l[i].GetName(), l[i])); + + ImmutableInterlocked.InterlockedInitialize(ref _fields, b.DrainToImmutable()); + } + + return _fields; + } + + /// + internal sealed override ImmutableArray GetDeclaredMethods() + { + // TODO integrate missing? + if (_methods.IsDefault) + { + var l = DefOrThrow.GetMethods(); + var b = ImmutableArray.CreateBuilder(l.Length); + for (int i = 0; i < l.Length; i++) + b.Add(new DefinitionMethodSymbol(Context, this, null, l[i].GetName(), l[i])); + + ImmutableInterlocked.InterlockedInitialize(ref _methods, b.DrainToImmutable()); + } + + return _methods; + } + + /// + internal sealed override ImmutableArray GetDeclaredTypes() + { + // TODO integrate missing? + if (_types.IsDefault) + { + var l = DefOrThrow.GetTypes(); + var b = ImmutableArray.CreateBuilder(l.Length); + for (int i = 0; i < l.Length; i++) + b.Add(new DefinitionTypeSymbol(Context, this, l[i].GetName(), l[i].GetNamespace(), l[i])); + + ImmutableInterlocked.InterlockedInitialize(ref _types, b.DrainToImmutable()); + } + + return _types; + } + + /// + public sealed override bool IsResource() => DefOrThrow.GetIsResource(); + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() => DefOrThrow.GetCustomAttributes(); + + /// + /// Attempts to resolve the definition for the specified field. + /// + /// + internal FieldDefinition? ResolveFieldDef(string name) => Def?.ResolveFieldDef(name); + + /// + /// Attempts to resolve the definition for the specified method. + /// + /// + internal MethodDefinition? ResolveMethodDef(MethodSymbolSignature signature) => Def?.ResolveMethodDef(signature); + + /// + /// Attempts to resolve the definition for the specified type. + /// + /// + /// + internal TypeDefinition? ResolveTypeDef(string ns, string name) => Def?.ResolveTypeDef(ns, name); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefinitionParameterSymbol.cs b/src/IKVM.CoreLib/Symbols/DefinitionParameterSymbol.cs new file mode 100644 index 0000000000..688d604e97 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefinitionParameterSymbol.cs @@ -0,0 +1,21 @@ +namespace IKVM.CoreLib.Symbols +{ + + abstract class DefinitionParameterSymbol : ParameterSymbol + { + + /// + /// Initializes a new instance. + /// + /// + /// + /// + protected DefinitionParameterSymbol(SymbolContext context, MemberSymbol declaringMember, int position) : + base(context, declaringMember, position) + { + + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefinitionPropertySymbol.cs b/src/IKVM.CoreLib/Symbols/DefinitionPropertySymbol.cs new file mode 100644 index 0000000000..1bb8b8b8f2 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefinitionPropertySymbol.cs @@ -0,0 +1,20 @@ +namespace IKVM.CoreLib.Symbols +{ + + class DefinitionPropertySymbol : PropertySymbol + { + + /// + /// Initializes a new instance. + /// + /// + /// + protected DefinitionPropertySymbol(SymbolContext context, DefinitionTypeSymbol declaringType) : + base(context, declaringType) + { + + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/DefinitionTypeSymbol.cs b/src/IKVM.CoreLib/Symbols/DefinitionTypeSymbol.cs new file mode 100644 index 0000000000..46f8d49539 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/DefinitionTypeSymbol.cs @@ -0,0 +1,332 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; +using System.Threading; + +namespace IKVM.CoreLib.Symbols +{ + + /// + /// Describes a type definition. + /// + class DefinitionTypeSymbol : TypeSymbol + { + + readonly string _name; + readonly string _namespace; + + TypeDefinition? _def; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + public DefinitionTypeSymbol(SymbolContext context, ModuleSymbol module, string name, string ns, TypeDefinition? def) : + base(context, module) + { + _name = name ?? throw new ArgumentNullException(nameof(name)); + _namespace = ns ?? throw new ArgumentNullException(nameof(ns)); + _def = def; + } + + /// + /// Gets the underlying source information. If the type source is missing, null is returned. + /// + TypeDefinition? Def => GetDefinition(); + + /// + /// Attempts to resolve the symbol definition source. + /// + /// + TypeDefinition? GetDefinition() + { + if (_def is null) + Interlocked.CompareExchange(ref _def, Context.ResolveTypeSource(this), null); + + return _def; + } + + /// + /// Attempts to resolve the symbol definition source, or throws. + /// + TypeDefinition DefOrThrow => Def ?? throw new MissingTypeSymbolException(this); + + /// + public override bool IsMissing => Def == null; + + /// + public override string Name => _name; + + /// + public override string? Namespace => _namespace; + + /// + public sealed override MethodSymbol? DeclaringMethod => null; + + /// + public sealed override bool IsTypeDefinition => true; + + /// + public sealed override bool IsArray => false; + + /// + public sealed override bool IsByRef => false; + + /// + public sealed override bool IsConstructedGenericType => false; + + /// + public sealed override bool IsFunctionPointer => false; + + /// + public sealed override int GenericParameterPosition => throw new InvalidOperationException(); + + /// + public sealed override bool HasElementType => false; + + /// + public sealed override bool IsGenericTypeParameter => false; + + /// + public sealed override bool IsGenericMethodParameter => false; + + /// + public sealed override bool IsPointer => false; + + /// + public sealed override bool IsSZArray => false; + + /// + public sealed override bool IsUnmanagedFunctionPointer => false; + + /// + public sealed override TypeSymbol? GetElementType() => null; + + /// + public sealed override TypeSymbol GenericTypeDefinition => throw new InvalidOperationException(); + + /// + public sealed override TypeAttributes Attributes => DefOrThrow.GetAttributes(); + + /// + public sealed override TypeCode TypeCode => TypeSymbolExtensions.GetTypeCode(this); + + /// + public sealed override TypeSymbol? BaseType => DefOrThrow.GetBaseType(); + + /// + public sealed override bool ContainsGenericParameters => DefOrThrow.GetGenericArguments().Length > 0; + + /// + public sealed override bool IsGenericTypeDefinition => ContainsGenericParameters; + + /// + public sealed override GenericParameterAttributes GenericParameterAttributes => DefOrThrow.GetGenericParameterAttributes(); + + /// + public sealed override ImmutableArray GenericArguments => DefOrThrow.GetGenericArguments(); + + /// + public sealed override ImmutableArray GenericParameterConstraints => DefOrThrow.GetGenericParameterConstraints(); + + /// + public sealed override bool IsPrimitive => TypeCode is TypeCode.Boolean or TypeCode.Byte or TypeCode.SByte or TypeCode.Int16 or TypeCode.UInt16 or TypeCode.Int32 or TypeCode.UInt32 or TypeCode.Int64 or TypeCode.UInt64 or TypeCode.Char or TypeCode.Double or TypeCode.Single || this == Context.ResolveCoreType("System.IntPtr") || this == Context.ResolveCoreType("System.UIntPtr"); + + /// + public sealed override bool IsEnum => BaseType != null && BaseType == Context.ResolveCoreType("System.Enum"); + + /// + public sealed override TypeSymbol? DeclaringType => DefOrThrow.GetDeclaringType(); + + /// + public sealed override int GetArrayRank() => throw new ArgumentException("Must be an array type."); + + /// + public override string? GetEnumName(object value) + { + if (!IsEnum) + throw new ArgumentException(); + if (value == null) + throw new ArgumentNullException(); + + try + { + value = Convert.ChangeType(value, TypeSymbolExtensions.GetSystemType(GetEnumUnderlyingType())); + } + catch (FormatException) + { + throw new ArgumentException(); + } + catch (OverflowException) + { + return null; + } + catch (InvalidCastException) + { + return null; + } + + foreach (var field in GetDeclaredFields()) + if (field.IsLiteral && field.GetRawConstantValue() is { } v && v.Equals(value)) + return field.Name; + + return null; + } + + /// + public override ImmutableArray GetEnumNames() + { + if (!IsEnum) + throw new ArgumentException(); + + var names = ImmutableArray.CreateBuilder(); + foreach (var field in GetDeclaredFields()) + if (field.IsLiteral) + names.Add(field.Name); + + return names.ToImmutable(); + } + + /// + public override TypeSymbol GetEnumUnderlyingType() + { + if (!IsEnum) + throw new ArgumentException(); + + foreach (var field in GetDeclaredFields()) + if (!field.IsStatic) + return field.FieldType; + + throw new InvalidOperationException(); + } + + /// + public override bool IsEnumDefined(object value) + { + if (value is string s) + return GetEnumNames().IndexOf(s) != -1; + if (IsEnum == false) + throw new ArgumentException(); + if (value == null) + throw new ArgumentNullException(); + if (value.GetType() != TypeSymbolExtensions.GetSystemType(GetEnumUnderlyingType())) + throw new ArgumentException(); + + foreach (var field in GetDeclaredFields()) + if (field.IsLiteral && field.GetRawConstantValue() is { } v && v.Equals(value)) + return true; + + return false; + } + + /// + internal override ImmutableArray GetDeclaredEvents() + { + return DefOrThrow.GetEvents(); + } + + /// + internal override ImmutableArray GetDeclaredFields() + { + return DefOrThrow.GetFields(); + } + + /// + internal override ImmutableArray GetDeclaredInterfaces() + { + return DefOrThrow.GetInterfaces(); + } + + /// + internal override ImmutableArray GetDeclaredMethods() + { + return DefOrThrow.GetMethods(); + } + + /// + internal override MethodImplementationMapping GetMethodImplementations() + { + return DefOrThrow.GetMethodImplementations(); + } + + /// + internal override ImmutableArray GetDeclaredNestedTypes() + { + return DefOrThrow.GetNestedTypes(); + } + + /// + internal override ImmutableArray GetDeclaredProperties() + { + return DefOrThrow.GetProperties(); + } + + /// + public override ImmutableArray GetRequiredCustomModifiers() + { + return DefOrThrow.GetRequiredCustomModifiers(); + } + + /// + public override ImmutableArray GetOptionalCustomModifiers() + { + return DefOrThrow.GetOptionalCustomModifiers(); + } + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() + { + return DefOrThrow.GetCustomAttributes(); + } + + /// + internal override TypeSymbol Specialize(GenericContext context) + { + if (ContainsGenericParameters == false) + return this; + + var args = GenericArguments; + for (int i = 0; i < args.Length; i++) + if (args[i].ContainsGenericParameters) + args = args.SetItem(i, args[i].Specialize(context)); + + return MakeGenericType(args); + } + + /// + /// Attempts to resolve the definition for the specified nested type. + /// + /// + internal TypeDefinition? ResolveNestedTypeDef(string name) => Def?.ResolveNestedTypeDef(name); + + /// + /// Attempts to resolve the definition for the specified field. + /// + /// + internal FieldDefinition? ResolveFieldDef(string name) => Def?.ResolveFieldDef(name); + + /// + /// Attempts to resolve the definition for the specified method. + /// + /// + internal MethodDefinition? ResolveMethodDef(MethodSymbolSignature signature) => Def?.ResolveMethodDef(signature); + + /// + /// Attempts to resolve the definition for the specified property. + /// + /// + internal PropertyDefinition? ResolvePropertyDef(string name) => Def?.ResolvePropertyDef(name); + + /// + /// Attempts to resolve the definition for the specified event. + /// + /// + internal EventDefinition? ResolveEventDef(string name) => Def?.ResolveEventDef(name); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/Emit/AssemblySymbolBuilder.cs b/src/IKVM.CoreLib/Symbols/Emit/AssemblySymbolBuilder.cs new file mode 100644 index 0000000000..b841b9b7a7 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/Emit/AssemblySymbolBuilder.cs @@ -0,0 +1,278 @@ +using System; +using System.Collections.Immutable; +using System.IO; +using System.Linq; +using System.Threading; + +namespace IKVM.CoreLib.Symbols.Emit +{ + + public class AssemblySymbolBuilder : AssemblySymbol, ICustomAttributeBuilder + { + + AssemblyIdentity _identity; + + ModuleSymbolBuilder? _manifestModule; + ImmutableArray.Builder _modules = ImmutableArray.CreateBuilder(); + ImmutableArray _modulesCache; + ImmutableArray.Builder _win32Icons = ImmutableArray.CreateBuilder(); + ImmutableArray.Builder _manifestResources = ImmutableArray.CreateBuilder(); + ImmutableArray.Builder _resources = ImmutableArray.CreateBuilder(); + + ImmutableArray.Builder _typeForwarders = ImmutableArray.CreateBuilder(); + MethodSymbolBuilder? _entryPoint; + PEFileKinds _fileKind; + ImmutableArray<(string Name, string FileName)>.Builder _resourceFiles = ImmutableArray.CreateBuilder<(string, string)>(); + (string? product, string? productVersion, string? company, string? copyright, string? trademark)? _versionResource; + ImmutableArray.Builder _referencedAssemblies = ImmutableArray.CreateBuilder(); + ImmutableArray.Builder _customAttributes = ImmutableArray.CreateBuilder(); + + bool _frozen; + object? _writer; + + /// + /// Initializes a new instance. + /// + /// + internal AssemblySymbolBuilder(SymbolContext context, AssemblyIdentity identity) : + base(context) + { + _identity = identity ?? throw new ArgumentNullException(nameof(identity)); + } + + /// + public override AssemblyIdentity Identity => _identity; + + /// + public override string ImageRuntimeVersion => throw new NotSupportedException(); + + /// + public override string Location => throw new NotSupportedException(); + + /// + public override ModuleSymbol ManifestModule => _manifestModule ?? throw new InvalidOperationException(); + + /// + public override MethodSymbol? EntryPoint => _entryPoint; + + /// + public override bool IsMissing => false; + + /// + public override ManifestResourceInfo? GetManifestResourceInfo(string resourceName) + { + var manifestModule = (ModuleSymbolBuilder)ManifestModule; + foreach (var i in manifestModule.GetManifestResources()) + if (i.Name == resourceName) + return new ManifestResourceInfo(System.Reflection.ResourceLocation.Embedded, null, null); + + return null; + } + + /// + public override Stream GetManifestResourceStream(string name) + { + var manifestModule = (ModuleSymbolBuilder)ManifestModule; + foreach (var i in manifestModule.GetManifestResources()) + if (i.Name == name) + return new MemoryStream(i.Data.ToArray()); + + throw new FileNotFoundException(); + } + + /// + public override ImmutableArray GetModules() + { + if (_modulesCache == default) + ImmutableInterlocked.InterlockedInitialize(ref _modulesCache, _modules.ToImmutable().CastArray()); + + return _modulesCache; + } + + /// + public override ImmutableArray GetReferencedAssemblies() + { + return _referencedAssemblies.ToImmutable(); + } + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() + { + return _customAttributes.ToImmutable(); + } + + /// + /// Freezes the type builder. + /// + internal void Freeze() + { + _frozen = true; + } + + /// + /// Throws an exception if the builder is frozen. + /// + void ThrowIfFrozen() + { + if (_frozen) + throw new InvalidOperationException("AssemblySymbolBuilder is frozen."); + } + + /// + /// Defines a named module in this assembly. + /// + /// + /// + /// + public ModuleSymbolBuilder DefineModule(string name, string fileName) + { + ThrowIfFrozen(); + var b = new ModuleSymbolBuilder(Context, this, name, fileName); + _modules.Add(b); + _modulesCache = default; + _manifestModule ??= b; + return b; + } + + /// + /// Sets a Win32 icon on the generated assembly. + /// + /// + public void DefineIconResource(byte[] bytes) + { + ThrowIfFrozen(); + _win32Icons.Add(bytes); + } + + /// + /// Sets a manifest resource on the generated assembly. + /// + /// + public void DefineManifestResource(byte[] bytes) + { + ThrowIfFrozen(); + _manifestResources.Add(bytes); + } + + /// + /// Sets a Win32 version info resource on the generated assembly. + /// + public void DefineVersionInfoResource() + { + ThrowIfFrozen(); + _versionResource = (null, null, null, null, null); + } + + /// + /// Sets a Win32 version info resource on the generated assembly. + /// + public void DefineVersionInfoResource(string product, string productVersion, string company, string copyright, string trademark) + { + ThrowIfFrozen(); + _versionResource = (product, productVersion, company, copyright, trademark); + } + + /// + /// Sets the entry point for this assembly, assuming that a console application is being built. + /// + /// + public void SetEntryPoint(MethodSymbolBuilder entryMethod) + { + SetEntryPoint(entryMethod, PEFileKinds.Dll); + } + + /// + /// Sets the entry point for this assembly and defines the type of the portable executable (PE file) being built. + /// + /// + /// + public void SetEntryPoint(MethodSymbolBuilder entryMethod, PEFileKinds fileKind) + { + ThrowIfFrozen(); + _entryPoint = entryMethod; + _fileKind = fileKind; + } + + /// + /// Adds a forwarded type to this assembly. + /// + /// + public void AddTypeForwarder(TypeSymbol type) + { + ThrowIfFrozen(); + _typeForwarders.Add(type); + } + + /// + /// Adds an external resource file to the assembly. + /// + /// + /// + public void AddResourceFile(string name, string fileName) + { + ThrowIfFrozen(); + _resourceFiles.Add((name, fileName)); + } + + /// + public void SetCustomAttribute(CustomAttribute attribute) + { + ThrowIfFrozen(); + _customAttributes.Add(attribute); + } + + /// + /// Sets the assembly version. + /// + /// + /// + public void SetAssemblyVersion(Version version) + { + ThrowIfFrozen(); + + _identity = new AssemblyIdentity( + _identity.Name, + version, + _identity.CultureName, + _identity.HasPublicKey ? _identity.PublicKey : _identity.PublicKeyToken, + _identity.HasPublicKey, + _identity.ContentType, + _identity.ProcessorArchitecture); + } + + /// + /// Sets the assembly culture. + /// + /// + /// + public void SetAssemblyCulture(string cultureName) + { + ThrowIfFrozen(); + + _identity = new AssemblyIdentity( + _identity.Name, + _identity.Version, + cultureName, + _identity.HasPublicKey ? _identity.PublicKey : _identity.PublicKeyToken, + _identity.HasPublicKey, + _identity.ContentType, + _identity.ProcessorArchitecture); + } + + /// + /// Gets the writer object associated with this builder. + /// + /// + /// + /// + internal TWriter Writer(Func create) + { + if (_writer is null) + Interlocked.CompareExchange(ref _writer, create(this), null); + + return (TWriter)(_writer ?? throw new InvalidOperationException()); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/Emit/EventSymbolBuilder.cs b/src/IKVM.CoreLib/Symbols/Emit/EventSymbolBuilder.cs new file mode 100644 index 0000000000..777c8223b7 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/Emit/EventSymbolBuilder.cs @@ -0,0 +1,188 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; +using System.Threading; + +namespace IKVM.CoreLib.Symbols.Emit +{ + + public sealed class EventSymbolBuilder : EventSymbol, ICustomAttributeBuilder + { + + readonly string _name; + readonly EventAttributes _attributes; + readonly TypeSymbol _eventType; + + MethodSymbolBuilder? _addMethod; + MethodSymbolBuilder? _removeMethod; + MethodSymbolBuilder? _raiseMethod; + readonly ImmutableArray.Builder _otherMethods = ImmutableArray.CreateBuilder(); + readonly ImmutableArray.Builder _customAttributes = ImmutableArray.CreateBuilder(); + + bool _frozen; + object? _writer; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + internal EventSymbolBuilder(SymbolContext context, TypeSymbolBuilder declaringType, string name, EventAttributes attributes, TypeSymbol eventType) : + base(context, declaringType) + { + _name = name ?? throw new ArgumentNullException(nameof(name)); + _attributes = attributes; + _eventType = eventType ?? throw new ArgumentNullException(nameof(eventType)); + } + + /// + public override EventAttributes Attributes => _attributes; + + /// + public override TypeSymbol? EventHandlerType => _eventType; + + /// + public override string Name => _name; + + /// + public override bool IsMissing => false; + + /// + public override MethodSymbol? GetAddMethod(bool nonPublic) + { + if (nonPublic && _addMethod != null && _addMethod.IsPublic == false) + return _addMethod; + else if (nonPublic == false && _addMethod != null && _addMethod.IsPublic) + return _addMethod; + else + return null; + } + + /// + public override MethodSymbol? GetRaiseMethod(bool nonPublic) + { + if (nonPublic && _raiseMethod != null && _raiseMethod.IsPublic == false) + return _raiseMethod; + else if (nonPublic == false && _raiseMethod != null && _raiseMethod.IsPublic) + return _raiseMethod; + else + return null; + } + + /// + public override MethodSymbol? GetRemoveMethod(bool nonPublic) + { + if (nonPublic && _removeMethod != null && _removeMethod.IsPublic == false) + return _removeMethod; + else if (nonPublic == false && _removeMethod != null && _removeMethod.IsPublic) + return _removeMethod; + else + return null; + } + + /// + public override ImmutableArray GetOtherMethods(bool nonPublic) + { + var b = ImmutableArray.CreateBuilder(_otherMethods.Count); + + foreach (var i in _otherMethods) + { + if (nonPublic && i != null && i.IsPublic == false) + b.Add(i); + else if (nonPublic == false && i != null && i.IsPublic) + b.Add(i); + } + + return b.DrainToImmutable(); + } + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() + { + return _customAttributes.ToImmutable(); + } + + /// + /// Freezes the type builder. + /// + internal void Freeze() + { + _frozen = true; + } + + /// + /// Throws an exception if the builder is frozen. + /// + void ThrowIfFrozen() + { + if (_frozen) + throw new InvalidOperationException("EventSymbolBuilder is frozen."); + } + + /// + /// Sets the method used to subscribe to this event. + /// + /// + public void SetAddOnMethod(MethodSymbolBuilder method) + { + ThrowIfFrozen(); + _addMethod = method; + } + + /// + /// Sets the method used to unsubscribe to this event. + /// + /// + public void SetRemoveOnMethod(MethodSymbolBuilder method) + { + ThrowIfFrozen(); + _removeMethod = method; + } + + /// + /// Sets the method used to raise this event. + /// + /// + public void SetRaiseMethod(MethodSymbolBuilder method) + { + ThrowIfFrozen(); + _raiseMethod = method; + } + + /// + /// Adds one of the "other" methods associated with this event. "Other" methods are methods other than the "on" and "raise" methods associated with an event. This function can be called many times to add as many "other" methods. + /// + /// + public void AddOtherMethod(MethodSymbolBuilder method) + { + ThrowIfFrozen(); + _otherMethods.Add(method); + } + + /// + public void SetCustomAttribute(CustomAttribute attribute) + { + ThrowIfFrozen(); + _customAttributes.Add(attribute); + } + + /// + /// Gets the writer object associated with this builder. + /// + /// + /// + /// + internal TWriter Writer(Func create) + { + if (_writer is null) + Interlocked.CompareExchange(ref _writer, create(this), null); + + return (TWriter)(_writer ?? throw new InvalidOperationException()); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/Emit/FieldSymbolBuilder.cs b/src/IKVM.CoreLib/Symbols/Emit/FieldSymbolBuilder.cs new file mode 100644 index 0000000000..25adccc4cd --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/Emit/FieldSymbolBuilder.cs @@ -0,0 +1,146 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; +using System.Threading; + +namespace IKVM.CoreLib.Symbols.Emit +{ + + public sealed class FieldSymbolBuilder : FieldSymbol, ICustomAttributeBuilder + { + + readonly string _name; + readonly FieldAttributes _attributes; + readonly TypeSymbol _fieldType; + readonly ImmutableArray _requiredCustomModifiers; + readonly ImmutableArray _optionalCustomModifiers; + object? _constantValue; + int? _offset; + readonly ImmutableArray.Builder _customAttributes = ImmutableArray.CreateBuilder(); + + bool _frozen; + object? _writer; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal FieldSymbolBuilder(SymbolContext context, ModuleSymbol declaringModule, TypeSymbolBuilder? declaringType, string name, FieldAttributes attributes, TypeSymbol fieldType, ImmutableArray requiredCustomModifiers, ImmutableArray optionalCustomModifiers) : + base(context, declaringModule, declaringType) + { + _name = name ?? throw new ArgumentNullException(nameof(name)); + _attributes = attributes; + _fieldType = fieldType ?? throw new ArgumentNullException(nameof(fieldType)); + _requiredCustomModifiers = requiredCustomModifiers; + _optionalCustomModifiers = optionalCustomModifiers; + } + + /// + public override FieldAttributes Attributes => _attributes; + + /// + public override TypeSymbol FieldType => _fieldType; + + /// + public override string Name => _name; + + /// + public override bool IsMissing => false; + + /// + public override object? GetRawConstantValue() + { + return _constantValue; + } + + /// + /// Gets the defined field offset. + /// + public int? Offset => _offset; + + /// + public override ImmutableArray GetOptionalCustomModifiers() + { + return _optionalCustomModifiers; + } + + /// + public override ImmutableArray GetRequiredCustomModifiers() + { + return _requiredCustomModifiers; + } + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() + { + return _customAttributes.ToImmutable(); + } + + /// + /// Freezes the type builder. + /// + internal void Freeze() + { + _frozen = true; + } + + /// + /// Throws an exception if the builder is frozen. + /// + void ThrowIfFrozen() + { + if (_frozen) + throw new InvalidOperationException("FieldSymbolBuilder is frozen."); + } + + /// + /// Sets the default value of this field. + /// + /// + public void SetConstant(object? defaultValue) + { + ThrowIfFrozen(); + _constantValue = default; + } + + /// + /// Specifies the field layout. + /// + /// + public void SetOffset(int iOffset) + { + ThrowIfFrozen(); + _offset = iOffset; + } + + /// + public void SetCustomAttribute(CustomAttribute attribute) + { + ThrowIfFrozen(); + _customAttributes.Add(attribute); + } + + /// + /// Gets the writer object associated with this builder. + /// + /// + /// + /// + internal TWriter Writer(Func create) + { + if (_writer is null) + Interlocked.CompareExchange(ref _writer, create(this), null); + + return (TWriter)(_writer ?? throw new InvalidOperationException()); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/Emit/GenericMethodParameterTypeSymbolBuilder.cs b/src/IKVM.CoreLib/Symbols/Emit/GenericMethodParameterTypeSymbolBuilder.cs new file mode 100644 index 0000000000..775ff1cf5b --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/Emit/GenericMethodParameterTypeSymbolBuilder.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols.Emit +{ + + public sealed class GenericMethodParameterTypeSymbolBuilder : GenericMethodParameterTypeSymbol, ICustomAttributeBuilder + { + + readonly string _name; + GenericParameterAttributes _attributes; + readonly int _position; + readonly ImmutableArray.Builder _customAttributes = ImmutableArray.CreateBuilder(); + TypeSymbol? _baseTypeConstraint; + ImmutableArray _interfaceConstraints = ImmutableArray.Empty; + + bool _frozen; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + public GenericMethodParameterTypeSymbolBuilder(SymbolContext context, MethodSymbolBuilder declaringMethod, string name, GenericParameterAttributes attributes, int position) : + base(context, declaringMethod) + { + _name = name ?? throw new ArgumentNullException(nameof(name)); + _attributes = attributes; + _position = position; + } + + /// + public sealed override string Name => _name; + + /// + public sealed override string? Namespace => ""; + + /// + public sealed override GenericParameterAttributes GenericParameterAttributes => _attributes; + + /// + public sealed override int GenericParameterPosition => _position; + + /// + public override TypeSymbol? BaseType => _baseTypeConstraint; + + /// + internal sealed override ImmutableArray GetDeclaredInterfaces() + { + return _interfaceConstraints; + } + + /// + internal sealed override ImmutableArray GetDeclaredCustomAttributes() + { + return _customAttributes.ToImmutable(); + } + + /// + public sealed override ImmutableArray GetOptionalCustomModifiers() + { + return []; + } + + /// + public sealed override ImmutableArray GetRequiredCustomModifiers() + { + return []; + } + + /// + /// Freezes the type builder. + /// + internal void Freeze() + { + _frozen = true; + } + + /// + /// Throws an exception if the builder is frozen. + /// + void ThrowIfFrozen() + { + if (_frozen) + throw new InvalidOperationException("GenericMethodParameterTypeSymbolBuilder is frozen."); + } + + /// + /// Sets the variance characteristics and special constraints of the generic parameter, such as the parameterless constructor constraint. + /// + /// + public void SetGenericParameterAttributes(GenericParameterAttributes genericParameterAttributes) + { + ThrowIfFrozen(); + _attributes = genericParameterAttributes; + } + + /// + /// Sets the base type that a type must inherit in order to be substituted for the type parameter. + /// + /// + public void SetBaseTypeConstraint(TypeSymbol? baseTypeConstraint) + { + ThrowIfFrozen(); + _baseTypeConstraint = baseTypeConstraint; + ClearGenericParameterConstraints(); + } + + /// + /// Sets the interfaces a type must implement in order to be substituted for the type parameter. + /// + /// + public void SetInterfaceConstraints(ImmutableArray interfaceConstraints) + { + ThrowIfFrozen(); + _interfaceConstraints = interfaceConstraints; + ClearGenericParameterConstraints(); + } + + /// + public void SetCustomAttribute(CustomAttribute attribute) + { + ThrowIfFrozen(); + _customAttributes.Add(attribute); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/Emit/GenericTypeParameterTypeSymbolBuilder.cs b/src/IKVM.CoreLib/Symbols/Emit/GenericTypeParameterTypeSymbolBuilder.cs new file mode 100644 index 0000000000..6067f1d451 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/Emit/GenericTypeParameterTypeSymbolBuilder.cs @@ -0,0 +1,131 @@ +using System; +using System.Collections.Immutable; +using System.Reflection; + +namespace IKVM.CoreLib.Symbols.Emit +{ + + public sealed class GenericTypeParameterTypeSymbolBuilder : GenericTypeParameterTypeSymbol, ICustomAttributeBuilder + { + + readonly string _name; + GenericParameterAttributes _attributes; + readonly int _position; + readonly ImmutableArray.Builder _customAttributes = ImmutableArray.CreateBuilder(); + TypeSymbol? _baseTypeConstraint; + ImmutableArray _interfaceConstraints = ImmutableArray.Empty; + + bool _frozen; + + /// + /// Initializes a new instance. + /// + /// + /// + /// + internal GenericTypeParameterTypeSymbolBuilder(SymbolContext context, TypeSymbolBuilder declaringType, string name, GenericParameterAttributes attributes, int position) : + base(context, declaringType) + { + _name = name ?? throw new ArgumentNullException(nameof(name)); + _attributes = attributes; + _position = position; + } + + /// + public sealed override string Name => _name; + + /// + public sealed override string? Namespace => ""; + + /// + public sealed override GenericParameterAttributes GenericParameterAttributes => _attributes; + + /// + public sealed override int GenericParameterPosition => _position; + + /// + public override TypeSymbol? BaseType => _baseTypeConstraint; + + /// + internal override ImmutableArray GetDeclaredInterfaces() + { + return _interfaceConstraints; + } + + /// + internal override ImmutableArray GetDeclaredCustomAttributes() + { + return _customAttributes.ToImmutable(); + } + + /// + public sealed override ImmutableArray GetOptionalCustomModifiers() + { + return []; + } + + /// + public sealed override ImmutableArray GetRequiredCustomModifiers() + { + return []; + } + + /// + /// Freezes the type builder. + /// + internal void Freeze() + { + _frozen = true; + } + + /// + /// Throws an exception if the builder is frozen. + /// + void ThrowIfFrozen() + { + if (_frozen) + throw new InvalidOperationException("GenericTypeParameterTypeSymbolBuilder is frozen."); + } + + /// + /// Sets the variance characteristics and special constraints of the generic parameter, such as the parameterless constructor constraint. + /// + /// + public void SetGenericParameterAttributes(GenericParameterAttributes genericParameterAttributes) + { + ThrowIfFrozen(); + _attributes = genericParameterAttributes; + } + + /// + /// Sets the base type that a type must inherit in order to be substituted for the type parameter. + /// + /// + public void SetBaseTypeConstraint(TypeSymbol? baseTypeConstraint) + { + ThrowIfFrozen(); + _baseTypeConstraint = baseTypeConstraint; + ClearGenericParameterConstraints(); + } + + /// + /// Sets the interfaces a type must implement in order to be substituted for the type parameter. + /// + /// + public void SetInterfaceConstraints(ImmutableArray interfaceConstraints) + { + ThrowIfFrozen(); + _interfaceConstraints = interfaceConstraints; + ClearGenericParameterConstraints(); + } + + /// + public void SetCustomAttribute(CustomAttribute attribute) + { + ThrowIfFrozen(); + _customAttributes.Add(attribute); + } + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/Emit/ICustomAttributeBuilder.cs b/src/IKVM.CoreLib/Symbols/Emit/ICustomAttributeBuilder.cs new file mode 100644 index 0000000000..210591f31e --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/Emit/ICustomAttributeBuilder.cs @@ -0,0 +1,15 @@ +namespace IKVM.CoreLib.Symbols.Emit +{ + + interface ICustomAttributeBuilder + { + + /// + /// Sets a custom attribute. + /// + /// + void SetCustomAttribute(CustomAttribute attribute); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/Emit/IILGeneratorWriter.cs b/src/IKVM.CoreLib/Symbols/Emit/IILGeneratorWriter.cs new file mode 100644 index 0000000000..643af38962 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/Emit/IILGeneratorWriter.cs @@ -0,0 +1,237 @@ +using System.Collections.Immutable; + +namespace IKVM.CoreLib.Symbols.Emit +{ + + interface IILGeneratorWriter + { + + readonly record struct LocalBuilderRef(int Index); + + readonly record struct LabelRef(int Index); + + /// + /// Begins a lexical scope. + /// + void BeginScope(); + + /// + /// Specifies the namespace to be used in evaluating locals and watches for the current active lexical scope. + /// + /// + void UsingNamespace(string usingNamespace); + + /// + /// Ends a lexical scope. + /// + void EndScope(); + + /// + /// Marks a sequence point in the Microsoft intermediate language (MSIL) stream. + /// + /// + /// + /// + /// + /// + void MarkSequencePoint(SourceDocument document, int startLine, int startColumn, int endLine, int endColumn); + + /// + /// Declares a local variable of the specified type, optionally pinning the object referred to by the variable. + /// + /// + /// + /// + LocalBuilderRef DeclareLocal(TypeSymbol localType, bool pinned); + + /// + /// Declares a local variable of the specified type. + /// + /// + /// + LocalBuilderRef DeclareLocal(TypeSymbol localType); + + /// + /// Declares a new label. + /// + /// + LabelRef DefineLabel(); + + /// + /// Begins an exception block for a non-filtered exception. + /// + /// + LabelRef BeginExceptionBlock(); + + /// + /// Marks the Microsoft intermediate language (MSIL) stream's current position with the given label. + /// + /// + void MarkLabel(LabelRef label); + + /// + /// Begins an exception block for a filtered exception. + /// + void BeginExceptFilterBlock(); + + /// + /// Begins a catch block. + /// + /// + void BeginCatchBlock(TypeSymbol? exceptionType); + + /// + /// Begins an exception fault block in the Microsoft intermediate language (MSIL) stream. + /// + void BeginFaultBlock(); + + /// + /// Begins a finally block in the Microsoft intermediate language (MSIL) instruction stream. + /// + void BeginFinallyBlock(); + + /// + /// Ends an exception block. + /// + void EndExceptionBlock(); + + /// + /// Emits an instruction to throw an exception. + /// + /// + void ThrowException(TypeSymbol exceptionType); + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the index of the given local variable. + /// + /// + /// + void Emit(OpCodeValue opcode, LocalBuilderRef arg); + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given type. + /// + /// + /// + void Emit(OpCodeValue opcode, TypeSymbol arg); + + /// + /// Puts the specified instruction and metadata token for the specified field onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + void Emit(OpCodeValue opcode, FieldSymbol arg); + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given method. + /// + /// + /// + void Emit(OpCodeValue opcode, MethodSymbol arg); + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given string. + /// + /// + /// + void Emit(OpCodeValue opcode, string str); + + /// + /// Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + void Emit(OpCodeValue opcode, float arg); + + /// + /// Puts the specified instruction and character argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + void Emit(OpCodeValue opcode, sbyte arg); + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream and leaves space to include a label when fixes are done. + /// + /// + /// + void Emit(OpCodeValue opcode, ImmutableArray labels); + + /// + /// Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + void Emit(OpCodeValue opcode, long arg); + + /// + /// Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + void Emit(OpCodeValue opcode, int arg); + + /// + /// Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + void Emit(OpCodeValue opcode, short arg); + + /// + /// Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + void Emit(OpCodeValue opcode, double arg); + + /// + /// Puts the specified instruction and character argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + void Emit(OpCodeValue opcode, byte arg); + + /// + /// Puts the specified instruction onto the stream of instructions. + /// + /// + void Emit(OpCodeValue opcode); + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream and leaves space to include a label when fixes are done. + /// + /// + /// + void Emit(OpCodeValue opcode, LabelRef label); + + /// + /// Puts a call or callvirt instruction onto the Microsoft intermediate language (MSIL) stream to call a varargs method. + /// + /// + /// + /// + void EmitCall(OpCodeValue opcode, MethodSymbol methodInfo, ImmutableArray optionalParameterTypes); + + /// + /// Puts a Calli instruction onto the Microsoft intermediate language (MSIL) stream, specifying an unmanaged calling convention for the indirect call. + /// + /// + /// + /// + /// + void EmitCalli(OpCodeValue opcode, System.Runtime.InteropServices.CallingConvention unmanagedCallConv, TypeSymbol? returnType, ImmutableArray parameterTypes); + + /// + /// Puts a Calli instruction onto the Microsoft intermediate language (MSIL) stream, specifying a managed calling convention for the indirect call. + /// + /// + /// + /// + /// + /// + void EmitCalli(OpCodeValue opcode, System.Reflection.CallingConventions callingConvention, TypeSymbol? returnType, ImmutableArray parameterTypes, ImmutableArray optionalParameterTypes); + + } + +} diff --git a/src/IKVM.CoreLib/Symbols/Emit/ILGenerator.cs b/src/IKVM.CoreLib/Symbols/Emit/ILGenerator.cs new file mode 100644 index 0000000000..20f259ffc5 --- /dev/null +++ b/src/IKVM.CoreLib/Symbols/Emit/ILGenerator.cs @@ -0,0 +1,759 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Reflection; +using System.Reflection.Emit; +using System.Runtime.InteropServices; + +using IKVM.CoreLib.Collections; + +namespace IKVM.CoreLib.Symbols.Emit +{ + + public class ILGenerator + { + + const int BlockSize = 64; + + /// + /// Decscribes the IL node. + /// + enum NodeKind : byte + { + + OpCode, + OpCode_Local, + OpCode_Type, + OpCode_Method, + OpCode_Field, + OpCode_Float, + OpCode_String, + OpCode_SByte, + OpCode_Byte, + OpCode_Short, + OpCode_Double, + OpCode_Integer, + OpCode_Long, + OpCode_Label, + OpCode_ManyLabel, + Call, + Calli, + CalliManaged, + BeginScope, + EndScope, + UsingNamespace, + DeclareLocal, + SequencePoint, + Label, + BeginExceptionBlock, + BeginCatchBlock, + BeginFaultBlock, + BeginFinallyBlock, + BeginFilterBlock, + EndExceptionBlock, + + } + + struct Node + { + + public NodeKind Kind; + public OpCodeValue OpCode; + public object? ObjectArg; + public long NumberArg0; + public long NumberArg1; + + /// + /// Initializes a new instance. + /// + public Node(NodeKind kind, OpCodeValue opcode, object? objectArg, long numberArg0, long numberArg1) + { + Kind = kind; + OpCode = opcode; + ObjectArg = objectArg; + NumberArg0 = numberArg0; + NumberArg1 = numberArg1; + } + + } + +#if NET8_0_OR_GREATER + + [System.Runtime.CompilerServices.InlineArray(BlockSize)] + struct ILInlineNodeArray + { + + public Node Item; + + } + +#endif + + /// + /// IL stream is a series of double-linked blocks. Head always points to the first in the sequence. + /// + class ILBlock + { + + public ILBlock Head; + public ILBlock Prev; + public ILBlock Next; +#if NET8_0_OR_GREATER + public ILInlineNodeArray Data; +#else + public Node[] Data; +#endif + public int Size = 0; + + /// + /// Initializes a head block. + /// + public ILBlock() + { + Head = this; + Prev = this; + Next = this; +#if NET8_0_OR_GREATER + Data = new ILInlineNodeArray(); +#else + Data = new Node[BlockSize]; +#endif + } + + /// + /// Initializes a new tail block. + /// + /// + public ILBlock(ILBlock prev) : this() + { + Head = prev.Head; + Prev = prev; + Prev.Next = this; + } + + } + + /// + /// Describes an IL stream, which is a pointer to the latest tail block, and to which s can be appended. + /// + struct NodeStream : IEnumerable + { + + ILBlock Tail; + int Size; + + /// + /// Initializes a new instance. + /// + public NodeStream() + { + Tail = new ILBlock(); + Size = 0; + } + + /// + /// Appends a new node to the stream. + /// + /// + public void Append(Node node) + { + // append a new tail block if required + if (Tail.Size >= BlockSize) + Tail = new ILBlock(Tail); + + // append onto existing tail + Tail.Data[Tail.Size++] = node; + Size++; + } + + /// + public IEnumerator GetEnumerator() + { + for (var node = Tail.Head; node != node.Next; node = node.Next) + for (int i = 0; i < node.Size; i++) + yield return node.Data[i]; + } + + /// + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + } + + record class CallNode(MethodSymbol Method, ImmutableArray OptionalParameterTypes); + + record class CalliNode(CallingConvention UnmanagedCallConv, TypeSymbol? ReturnType, ImmutableArray ParameterTypes); + + record class ManagedCalliNode(CallingConventions CallConv, TypeSymbol? ReturnType, ImmutableArray ParameterTypes, ImmutableArray OptionalParameterTypes); + + readonly SymbolContext _context; + NodeStream _stream; + int _iloffset; + int _labelIndex; + int _localIndex; + + /// + /// Initializes a new instance. + /// + /// + public ILGenerator(SymbolContext context) + { + _context = context ?? throw new ArgumentNullException(nameof(context)); + _stream = new NodeStream(); + } + + /// + /// Gets the current offset, in bytes, in the Microsoft intermediate language (MSIL) stream that is being emitted by the . + /// + public int ILOffset => _iloffset; + + /// + /// Begins a lexical scope. + /// + public void BeginScope() + { + _stream.Append(new Node(NodeKind.BeginScope, 0, null, 0, 0)); + } + + /// + /// Specifies the namespace to be used in evaluating locals and watches for the current active lexical scope. + /// + /// + public void UsingNamespace(string usingNamespace) + { + _stream.Append(new Node(NodeKind.UsingNamespace, 0, usingNamespace, 0, 0)); + } + + /// + /// Ends a lexical scope. + /// + public void EndScope() + { + _stream.Append(new Node(NodeKind.EndScope, 0, null, 0, 0)); + } + + /// + /// Marks a sequence point in the Microsoft intermediate language (MSIL) stream. + /// + /// + /// + /// + /// + /// + public void MarkSequencePoint(SourceDocument document, int startLine, int startColumn, int endLine, int endColumn) + { + if (startLine < 1) + throw new ArgumentOutOfRangeException(nameof(startLine)); + if (endLine < 1) + throw new ArgumentOutOfRangeException(nameof(endLine)); + + _stream.Append(new Node(NodeKind.SequencePoint, 0, document, startLine << 32 | startColumn, endLine << 32 | endColumn)); + } + + /// + /// Declares a local variable of the specified type, optionally pinning the object referred to by the variable. + /// + /// + /// + /// + public LocalBuilder DeclareLocal(TypeSymbol localType, bool pinned) + { + var b = new LocalBuilder(localType, pinned, _localIndex++); + _stream.Append(new Node(NodeKind.DeclareLocal, 0, b, pinned ? 1 : 0, 0)); + return b; + } + + /// + /// Declares a local variable of the specified type. + /// + /// + /// + public LocalBuilder DeclareLocal(TypeSymbol localType) + { + var b = new LocalBuilder(localType, false, _localIndex++); + _stream.Append(new Node(NodeKind.DeclareLocal, 0, b, 0, 0)); + return b; + } + + /// + /// Declares a new label. + /// + /// + public Label DefineLabel() + { + return new Label(_labelIndex++); + } + + /// + /// Begins an exception block for a non-filtered exception. + /// + /// + public Label BeginExceptionBlock() + { + var l = new Label(_labelIndex++); + _stream.Append(new Node(NodeKind.BeginExceptionBlock, 0, null, l.Index, 0)); + return l; + } + + /// + /// Marks the Microsoft intermediate language (MSIL) stream's current position with the given label. + /// + /// + public void MarkLabel(Label loc) + { + _stream.Append(new Node(NodeKind.Label, 0, null, loc.Index, 0)); + } + + /// + /// Begins an exception block for a filtered exception. + /// + public void BeginExceptFilterBlock() + { + _stream.Append(new Node(NodeKind.BeginFilterBlock, 0, null, 0, 0)); + } + + /// + /// Begins a catch block. + /// + /// + public void BeginCatchBlock(TypeSymbol? exceptionType) + { + _stream.Append(new Node(NodeKind.BeginCatchBlock, 0, exceptionType, 0, 0)); + } + + /// + /// Begins an exception fault block in the Microsoft intermediate language (MSIL) stream. + /// + public void BeginFaultBlock() + { + _stream.Append(new Node(NodeKind.BeginFaultBlock, 0, null, 0, 0)); + } + + /// + /// Begins a finally block in the Microsoft intermediate language (MSIL) instruction stream. + /// + public void BeginFinallyBlock() + { + _stream.Append(new Node(NodeKind.BeginFinallyBlock, 0, null, 0, 0)); + } + + /// + /// Ends an exception block. + /// + public void EndExceptionBlock() + { + _stream.Append(new Node(NodeKind.EndExceptionBlock, 0, null, 0, 0)); + } + + /// + /// Emits an instruction to throw an exception. + /// + /// + public void ThrowException(TypeSymbol exceptionType) + { + if (exceptionType is null) + throw new ArgumentNullException(nameof(exceptionType)); + + var exceptionTypeSymbol = _context.ResolveCoreType("System.Exception"); + if (exceptionType.IsSubclassOf(exceptionTypeSymbol) == false && exceptionType != exceptionTypeSymbol) + throw new ArgumentException("Not exception type."); + + var con = exceptionType.GetConstructor([]); + if (con == null) + throw new ArgumentException("No default constructor."); + + Emit(OpCodes.Newobj, con); + Emit(OpCodes.Throw); + } + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the index of the given local variable. + /// + /// + /// + public void Emit(OpCode opcode, LocalBuilder local) + { + _iloffset += opcode.Size; + _stream.Append(new Node(NodeKind.OpCode_Local, (OpCodeValue)opcode.Value, local, 0, 0)); + } + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given type. + /// + /// + /// + public void Emit(OpCode opcode, TypeSymbol cls) + { + _iloffset += opcode.Size; + _stream.Append(new Node(NodeKind.OpCode_Type, (OpCodeValue)opcode.Value, cls, 0, 0)); + } + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given string. + /// + /// + /// + public void Emit(OpCode opcode, string str) + { + _iloffset += opcode.Size; + _stream.Append(new Node(NodeKind.OpCode_String, (OpCodeValue)opcode.Value, str, 0, 0)); + } + + /// + /// Puts the specified instruction and numerical argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + public unsafe void Emit(OpCode opcode, float arg) + { + _iloffset += opcode.Size; + _stream.Append(new Node(NodeKind.OpCode_Float, (OpCodeValue)opcode.Value, null, *(int*)&arg, 0)); + } + + /// + /// Puts the specified instruction and character argument onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + public void Emit(OpCode opcode, sbyte arg) + { + _iloffset += opcode.Size; + _stream.Append(new Node(NodeKind.OpCode_SByte, (OpCodeValue)opcode.Value, null, arg, 0)); + } + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream followed by the metadata token for the given method. + /// + /// + /// + public void Emit(OpCode opcode, MethodSymbol method) + { + _iloffset += opcode.Size; + _stream.Append(new Node(NodeKind.OpCode_Method, (OpCodeValue)opcode.Value, method, 0, 0)); + } + + /// + /// Puts the specified instruction and a signature token onto the Microsoft intermediate language (MSIL) stream of instructions. + /// + /// + /// + public void Emit(OpCode opcode, SignatureHelper signature) + { + _iloffset += opcode.Size; + throw new NotImplementedException(); + } + + /// + /// Puts the specified instruction onto the Microsoft intermediate language (MSIL) stream and leaves space to include a label when fixes are done. + /// + /// + /// + public void Emit(OpCode opcode, ImmutableArray