diff --git a/Directory.Packages.props b/Directory.Packages.props index 6d1e81e99..41b329b4a 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -45,7 +45,7 @@ - + \ No newline at end of file diff --git a/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs b/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs index c929888cf..96d591dab 100644 --- a/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs +++ b/ICSharpCode.Decompiler/CSharp/OutputVisitor/CSharpOutputVisitor.cs @@ -2694,7 +2694,11 @@ namespace ICSharpCode.Decompiler.CSharp.OutputVisitor propertyDeclaration.Initializer.AcceptVisitor(this); Semicolon(); } - NewLine(); + else + { + // The call to Semicolon() above prints a newline too + NewLine(); + } } else { diff --git a/ICSharpCode.Decompiler/Metadata/MetadataFile.cs b/ICSharpCode.Decompiler/Metadata/MetadataFile.cs index c92c0e061..b8c284027 100644 --- a/ICSharpCode.Decompiler/Metadata/MetadataFile.cs +++ b/ICSharpCode.Decompiler/Metadata/MetadataFile.cs @@ -61,6 +61,7 @@ namespace ICSharpCode.Decompiler.Metadata public virtual int MetadataOffset { get; } public virtual bool IsEmbedded { get; } + public virtual bool IsMetadataOnly { get; } = true; public bool IsAssembly => Metadata.IsAssembly; diff --git a/ICSharpCode.Decompiler/Metadata/PEFile.cs b/ICSharpCode.Decompiler/Metadata/PEFile.cs index 9277ed71f..40e88534d 100644 --- a/ICSharpCode.Decompiler/Metadata/PEFile.cs +++ b/ICSharpCode.Decompiler/Metadata/PEFile.cs @@ -53,6 +53,7 @@ namespace ICSharpCode.Decompiler.Metadata public override bool IsEmbedded => false; public override int MetadataOffset => Reader.PEHeaders.MetadataStartOffset; + public override bool IsMetadataOnly => false; public void Dispose() { diff --git a/ICSharpCode.Decompiler/Metadata/WebCilFile.cs b/ICSharpCode.Decompiler/Metadata/WebCilFile.cs index d862c261b..b93033c32 100644 --- a/ICSharpCode.Decompiler/Metadata/WebCilFile.cs +++ b/ICSharpCode.Decompiler/Metadata/WebCilFile.cs @@ -183,6 +183,7 @@ namespace ICSharpCode.Decompiler.Metadata } public override int MetadataOffset { get; } + public override bool IsMetadataOnly => false; private static int GetContainingSectionIndex(IEnumerable sections, int rva) { diff --git a/ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs b/ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs index 8f01faf0f..290e225bf 100644 --- a/ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs +++ b/ICSharpCode.ILSpyX/Analyzers/AnalyzerScope.cs @@ -72,7 +72,7 @@ namespace ICSharpCode.ILSpyX.Analyzers { return assemblyListSnapshot.GetAllAssembliesAsync().GetAwaiter().GetResult() .Select(asm => asm.GetMetadataFileOrNull()) - .Where(x => x != null)!; + .Where(x => x != null && !x.IsMetadataOnly)!; } public DecompilerTypeSystem ConstructTypeSystem(MetadataFile module) @@ -207,7 +207,7 @@ namespace ICSharpCode.ILSpyX.Analyzers if (friendAssemblies.Contains(assembly.ShortName)) { var module = assembly.GetMetadataFileOrNull(); - if (module == null) + if (module == null || module.IsMetadataOnly) continue; if (ModuleReferencesScopeType(module.Metadata, typeScope.Name, typeScope.Namespace)) yield return module; diff --git a/ICSharpCode.ILSpyX/LoadedAssembly.cs b/ICSharpCode.ILSpyX/LoadedAssembly.cs index 169012d44..8f7298c84 100644 --- a/ICSharpCode.ILSpyX/LoadedAssembly.cs +++ b/ICSharpCode.ILSpyX/LoadedAssembly.cs @@ -211,7 +211,7 @@ namespace ICSharpCode.ILSpyX { return LazyInitializer.EnsureInitialized(ref this.typeSystem, () => { var module = GetMetadataFileOrNull(); - if (module == null) + if (module == null || module.IsMetadataOnly) return null!; return new SimpleCompilation( module.WithOptions(TypeSystemOptions.Default | TypeSystemOptions.Uncached | TypeSystemOptions.KeepModifiers), @@ -230,7 +230,7 @@ namespace ICSharpCode.ILSpyX if (typeSystemWithOptions != null && options == currentTypeSystemOptions) return typeSystemWithOptions; var module = GetMetadataFileOrNull(); - if (module == null) + if (module == null || module.IsMetadataOnly) return null; currentTypeSystemOptions = options; return typeSystemWithOptions = new SimpleCompilation( diff --git a/ILSpy/App.xaml b/ILSpy/App.xaml index 151558268..0cfda48ce 100644 --- a/ILSpy/App.xaml +++ b/ILSpy/App.xaml @@ -3,7 +3,6 @@ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:styles="urn:TomsToolbox.Wpf.Styles" xmlns:toms="urn:TomsToolbox" - xmlns:ilSpy="clr-namespace:ICSharpCode.ILSpy" xmlns:themes="clr-namespace:ICSharpCode.ILSpy.Themes" StartupUri="MainWindow.xaml"> @@ -25,5 +24,9 @@ + + \ No newline at end of file diff --git a/ILSpy/Controls/ZoomScrollViewer.xaml b/ILSpy/Controls/ZoomScrollViewer.xaml index 4c72e7eab..509b8d636 100644 --- a/ILSpy/Controls/ZoomScrollViewer.xaml +++ b/ILSpy/Controls/ZoomScrollViewer.xaml @@ -1,8 +1,10 @@  + xmlns:Controls="clr-namespace:ICSharpCode.ILSpy.Controls" + xmlns:toms="urn:TomsToolbox">