Skip to content
This repository was archived by the owner on Jun 28, 2026. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
url = https://github.com/Space-Wizards-Federation/SpaceWizards.Lidgren.Network
[submodule "XamlX"]
path = XamlX
url = https://github.com/Space-Wizards-Federation/XamlX
url = https://github.com/Space-Wizards-Federation/XamlX.git
[submodule "Robust.LoaderApi"]
path = Robust.LoaderApi
url = https://github.com/Space-Wizards-Federation/Robust.LoaderApi.git
Expand Down
3 changes: 3 additions & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<PackageVersion Include="JetBrains.Annotations" Version="2025.2.4" />
<PackageVersion Include="JetBrains.Profiler.Api" Version="1.4.10" />
<PackageVersion Include="Linguini.Bundle" Version="0.8.1" />
<PackageVersion Include="Microsoft.Build.Framework" Version="18.0.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzers" Version="3.11.0" />
<PackageVersion Include="Microsoft.CodeAnalysis.Analyzer.Testing" Version="1.1.2" />
<PackageVersion Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
Expand All @@ -39,6 +40,7 @@
<PackageVersion Include="Microsoft.NET.ILLink.Tasks" Version="10.0.0" />
<PackageVersion Include="Microsoft.NET.Test.Sdk" Version="18.0.1" />
<PackageVersion Include="Microsoft.Win32.Registry" Version="5.0.0" />
<PackageVersion Include="Mono.Cecil" Version="0.11.6" />
<PackageVersion Include="Moq" Version="4.20.72" />
<PackageVersion Include="NUnit" Version="4.4.0" />
<PackageVersion Include="NUnit.Analyzers" Version="4.11.2" />
Expand Down Expand Up @@ -79,6 +81,7 @@
<PackageVersion Include="System.Numerics.Tensors" Version="10.0.4" />
<!-- Transitive deps that we need to pin versions for to avoid NuGet warnings. -->
<PackageVersion Include="System.Formats.Asn1" Version="10.0.0" />
<PackageVersion Include="System.Reflection.Emit" Version="4.3.0" />
<PackageVersion Include="System.Reflection.Metadata" Version="10.0.0" />
<PackageVersion Include="System.Text.Json" Version="10.0.0" />
<PackageVersion Include="Newtonsoft.Json" Version="13.0.4" />
Expand Down
2 changes: 1 addition & 1 deletion MSBuild/XamlIL.targets
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<RobustInjectorsConfiguration Condition="'$(Configuration)' == 'Tools'">Release</RobustInjectorsConfiguration>
<RobustInjectorsConfiguration Condition="'$(UseArtifactsOutput)' == 'true' And '$(RuntimeIdentifier)' != ''">$(RobustInjectorsConfiguration)_$(RuntimeIdentifier)</RobustInjectorsConfiguration>
<RobustInjectorsConfiguration Condition="'$(UseArtifactsOutput)' == 'true'">$(RobustInjectorsConfiguration.ToLower())</RobustInjectorsConfiguration>
<CompileRobustXamlTaskAssemblyFile Condition="'$(UseArtifactsOutput)' != 'true'">$(MSBuildThisFileDirectory)\..\Robust.Client.Injectors\bin\$(RobustInjectorsConfiguration)\netstandard2.0\Robust.Client.Injectors.dll</CompileRobustXamlTaskAssemblyFile>
<CompileRobustXamlTaskAssemblyFile Condition="'$(UseArtifactsOutput)' != 'true'">$(MSBuildThisFileDirectory)\..\Robust.Client.Injectors\bin\$(RobustInjectorsConfiguration)\net10.0\Robust.Client.Injectors.dll</CompileRobustXamlTaskAssemblyFile>
<CompileRobustXamlTaskAssemblyFile Condition="'$(UseArtifactsOutput)' == 'true'">$(MSBuildThisFileDirectory)\..\..\artifacts\bin\Robust.Client.Injectors\$(RobustInjectorsConfiguration)\Robust.Client.Injectors.dll</CompileRobustXamlTaskAssemblyFile>
</PropertyGroup>

Expand Down
13 changes: 12 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,18 @@ END TEMPLATE-->

### Breaking changes

*None yet*
- XamlX has been upgraded, and has a new style class syntax.
The syntax for multiple style classes has changed from:
```xaml
<Control.StyleClasses>
<system:String>Hello</system:String>
<system:String>World</system:String>
</Control.StyleClasses>
```
to
```xaml
<Control StyleClasses="Hello World" />
```

### New features

Expand Down
12 changes: 1 addition & 11 deletions Robust.Client.Injectors/Robust.Client.Injectors.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\MSBuild\Robust.Engine.props" />

<!--
PJB3005 (2024-08-24)
So the reason that Robust.Client.Injectors is NS2.0 is that Visual Studio
still ships a .NET FX based MSBuild for some godforsaken reason. This means
that when having Robust.Client.Injectors loaded directly by the main MSBuild
process... that would break.

Except we don't do that anyways right now due to file locking issues, so maybe
it's fine to give up on that. Whatever.
-->
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<TargetFramework>net10.0</TargetFramework>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<LangVersion>8.0</LangVersion>
<Nullable>enable</Nullable>
Expand Down
4 changes: 2 additions & 2 deletions Robust.Client.NameGenerator/InvalidXamlRootTypeException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ namespace Robust.Client.NameGenerator
public class InvalidXamlRootTypeException : Exception
{
public readonly INamedTypeSymbol ExpectedType;
public readonly INamedTypeSymbol ExpectedBaseType;
public readonly INamedTypeSymbol? ExpectedBaseType;
public readonly INamedTypeSymbol Actual;

public InvalidXamlRootTypeException(INamedTypeSymbol actual, INamedTypeSymbol expectedType, INamedTypeSymbol expectedBaseType)
public InvalidXamlRootTypeException(INamedTypeSymbol actual, INamedTypeSymbol expectedType, INamedTypeSymbol? expectedBaseType)
{
Actual = actual;
ExpectedType = expectedType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,15 @@
<Compile Remove="../XamlX/src/XamlX/**/SreTypeSystem.cs" />
<Compile Remove="../XamlX/src/XamlX/obj/**" />
<Compile Include="..\Robust.Client\UserInterface\ControlPropertyAccess.cs" />
<!-- we need to share diagnostics codes but aren't ready to migrate robust roslyn stuff to net10.0 from netstandard2.0 yet -->
<Compile Include="..\Robust.Xaml\DiagnosticsCodes.cs" />
</ItemGroup>

<Import Project="../Robust.Roslyn.Shared/Robust.Roslyn.Shared.props" />

<PropertyGroup>
<!-- XamlX doesn't do NRTs. -->
<Nullable>disable</Nullable>
<Nullable>enable</Nullable>
<WarningsAsErrors>nullable</WarningsAsErrors>
</PropertyGroup>

</Project>
91 changes: 71 additions & 20 deletions Robust.Client.NameGenerator/RoslynTypeSystem.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using System.Collections.Generic;
using System.Linq;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis;
using Microsoft.CodeAnalysis.CSharp;
using XamlX.TypeSystem;

namespace Robust.Client.NameGenerator
{
/// <summary>
/// Taken from https://github.com/AvaloniaUI/Avalonia.NameGenerator/blob/ecc9677a23de5cbc90af07ccac14e31c0da41d6a/src/Avalonia.NameGenerator/Infrastructure/RoslynTypeSystem.cs
/// Taken from https://github.com/AvaloniaUI/Avalonia/blob/9d28762f1439e58e9764d104223b73eef93b26b5/src/tools/Avalonia.Generators/Compiler/RoslynTypeSystem.cs
/// </summary>
public class RoslynTypeSystem : IXamlTypeSystem
{
Expand All @@ -27,11 +25,11 @@ public RoslynTypeSystem(CSharpCompilation compilation)
_assemblies.AddRange(assemblySymbols);
}

public IReadOnlyList<IXamlAssembly> Assemblies => _assemblies;
public IEnumerable<IXamlAssembly> Assemblies => _assemblies;

public IXamlAssembly FindAssembly(string substring) => _assemblies[0];

public IXamlType FindType(string name)
public IXamlType? FindType(string name)
{
foreach (var assembly in _assemblies)
{
Expand All @@ -43,7 +41,7 @@ public IXamlType FindType(string name)
return null;
}

public IXamlType FindType(string name, string assembly)
public IXamlType? FindType(string name, string assembly)
{
foreach (var assemblyInstance in _assemblies)
{
Expand Down Expand Up @@ -73,7 +71,7 @@ other is RoslynAssembly roslynAssembly &&
.Select(data => new RoslynAttribute(data, this))
.ToList();

public IXamlType FindType(string fullName)
public IXamlType? FindType(string fullName)
{
var type = _symbol.GetTypeByMetadataName(fullName);
return type is null ? null : new RoslynType(type, this);
Expand All @@ -95,14 +93,14 @@ public bool Equals(IXamlCustomAttribute other) =>
other is RoslynAttribute attribute &&
_data == attribute._data;

public IXamlType Type => new RoslynType(_data.AttributeClass, _assembly);
public IXamlType Type => new RoslynType(_data.AttributeClass!, _assembly);

public List<object> Parameters =>
public List<object?> Parameters =>
_data.ConstructorArguments
.Select(argument => argument.Value)
.ToList();

public Dictionary<string, object> Properties =>
public Dictionary<string, object?> Properties =>
_data.NamedArguments.ToDictionary(
pair => pair.Key,
pair => pair.Value.Value);
Expand Down Expand Up @@ -169,24 +167,33 @@ other is RoslynType roslynType &&

public bool IsArray => false;

public IXamlType ArrayElementType { get; } = null;
public IXamlType? ArrayElementType { get; } = null;

public IXamlType MakeArrayType(int dimensions) => null;
public IXamlType MakeArrayType(int dimensions) => throw new NotImplementedException();

public IXamlType BaseType => _symbol.BaseType == null ? null : new RoslynType(_symbol.BaseType, _assembly);
public IXamlType? BaseType => _symbol.BaseType == null ? null : new RoslynType(_symbol.BaseType, _assembly);

public bool IsValueType { get; } = false;

public bool IsEnum { get; } = false;

public bool IsPublic => _symbol.DeclaredAccessibility == Accessibility.Public;

public bool IsNestedPrivate => _symbol.DeclaredAccessibility == Accessibility.Private;

public bool IsFunctionPointer => false;

public IXamlType? DeclaringType =>
_symbol.ContainingType is { } containingType ? new RoslynType(containingType, _assembly) : null;

public IReadOnlyList<IXamlType> Interfaces =>
_symbol.AllInterfaces
.Select(abstraction => new RoslynType(abstraction, _assembly))
.ToList();

public bool IsInterface => _symbol.IsAbstract;

public IXamlType GetEnumUnderlyingType() => null;
public IXamlType GetEnumUnderlyingType() => throw new NotImplementedException();

public IReadOnlyList<IXamlType> GenericParameters { get; } = new List<IXamlType>();
}
Expand Down Expand Up @@ -216,6 +223,12 @@ other is RoslynConstructor roslynConstructor &&
.OfType<INamedTypeSymbol>()
.Select(type => new RoslynType(type, _assembly))
.ToList();

public string Name => _symbol.Name;

public IXamlType DeclaringType => new RoslynType(_symbol.ContainingType, _assembly);

public IXamlParameterInfo GetParameterInfo(int index) => new RoslynParameter(_assembly, _symbol.Parameters[index]);
}

public class RoslynProperty : IXamlProperty
Expand All @@ -238,17 +251,37 @@ other is RoslynProperty roslynProperty &&
public IXamlType PropertyType =>
_symbol.Type is INamedTypeSymbol namedTypeSymbol
? new RoslynType(namedTypeSymbol, _assembly)
: null;
: throw new InvalidOperationException($"Roslyn property type {_symbol.Type} is not supported.");

public IXamlMethod Getter => _symbol.GetMethod == null ? null : new RoslynMethod(_symbol.GetMethod, _assembly);
public IXamlType DeclaringType => new RoslynType(_symbol.ContainingType, _assembly);

public IXamlMethod Setter => _symbol.SetMethod == null ? null : new RoslynMethod(_symbol.SetMethod, _assembly);
public IXamlMethod? Getter => _symbol.GetMethod == null ? null : new RoslynMethod(_symbol.GetMethod, _assembly);

public IXamlMethod? Setter => _symbol.SetMethod == null ? null : new RoslynMethod(_symbol.SetMethod, _assembly);

public IReadOnlyList<IXamlCustomAttribute> CustomAttributes { get; } = new List<IXamlCustomAttribute>();

public IReadOnlyList<IXamlType> IndexerParameters { get; } = new List<IXamlType>();
}

public class RoslynParameter : IXamlParameterInfo
{
private readonly RoslynAssembly _assembly;
private readonly IParameterSymbol _symbol;

public RoslynParameter(RoslynAssembly assembly, IParameterSymbol symbol)
{
_assembly = assembly;
_symbol = symbol;
}

public string Name => _symbol.Name;

public IXamlType ParameterType => new RoslynType((INamedTypeSymbol)_symbol.Type, _assembly);

public IReadOnlyList<IXamlCustomAttribute> CustomAttributes => Array.Empty<IXamlCustomAttribute>();
}

public class RoslynMethod : IXamlMethod
{
private readonly IMethodSymbol _symbol;
Expand All @@ -268,6 +301,16 @@ other is RoslynMethod roslynMethod &&

public bool IsPublic => true;

public bool IsPrivate => _symbol.DeclaredAccessibility == Accessibility.Private;

public bool IsFamily => _symbol.DeclaredAccessibility == Accessibility.Protected;

public bool ContainsGenericParameters => _symbol.TypeParameters.Any();

public bool IsGenericMethod => _symbol.IsGenericMethod;

public bool IsGenericMethodDefinition => _symbol.IsDefinition && _symbol.IsGenericMethod;

public bool IsStatic => false;

public IXamlType ReturnType => new RoslynType((INamedTypeSymbol) _symbol.ReturnType, _assembly);
Expand All @@ -278,10 +321,18 @@ other is RoslynMethod roslynMethod &&
.Select(type => new RoslynType(type, _assembly))
.ToList();

public IXamlType DeclaringType => new RoslynType((INamedTypeSymbol)_symbol.ReceiverType, _assembly);
public IXamlType DeclaringType => new RoslynType((INamedTypeSymbol)_symbol.ReceiverType! as INamedTypeSymbol, _assembly);

public IXamlMethod MakeGenericMethod(IReadOnlyList<IXamlType> typeArguments) => null;
public IReadOnlyList<IXamlType> GenericParameters => throw new NotImplementedException();

public IReadOnlyList<IXamlType> GenericArguments => _symbol.TypeArguments
.Select(ga => new RoslynType((INamedTypeSymbol)ga, _assembly))
.ToArray();

public IXamlMethod MakeGenericMethod(IReadOnlyList<IXamlType> typeArguments) => throw new NotImplementedException();

public IReadOnlyList<IXamlCustomAttribute> CustomAttributes { get; } = new List<IXamlCustomAttribute>();

public IXamlParameterInfo GetParameterInfo(int index) => new RoslynParameter(_assembly, _symbol.Parameters[index]);
}
}
Loading
Loading