Repository: dotnet/runtime
File: src/coreclr/tools/aot/ILCompiler/Program.cs (C#)

Code before:
                    bool hidden = unmanagedEntryPointsAssemblyValue.EndsWith(hiddenSuffix, StringComparison.Ordinal);
                    string unmanagedEntryPointsAssembly = hidden ? unmanagedEntryPointsAssemblyValue[..^hiddenSuffix.Length] : unmanagedEntryPointsAssemblyValue;

                    if (typeSystemContext.InputFilePaths.ContainsKey(unmanagedEntryPointsAssembly))
                    {
                        // Skip adding UnmanagedEntryPointsRootProvider for modules that have been already registered as an input module
                        continue;
                    }
                    EcmaModule module = typeSystemContext.GetModuleForSimpleName(unmanagedEntryPointsAssembly);
                    compilationRoots.Add(new UnmanagedEntryPointsRootProvider(module, hidden));
                }

                foreach (var rdXmlFilePath in Get(_command.RdXmlFilePaths))
                {
                    compilationRoots.Add(new RdXmlRootProvider(typeSystemContext, rdXmlFilePath));
                }

                foreach (var linkTrimFilePath in Get(_command.LinkTrimFilePaths))
                {
                    if (!File.Exists(linkTrimFilePath))
                        throw new CommandLineException($"'{linkTrimFilePath}' doesn't exist");
                    compilationRoots.Add(new ILCompiler.DependencyAnalysis.TrimmingDescriptorNode(linkTrimFilePath));
                }

                // Get TypeMappingEntryAssembly from runtime knobs if specified
                string typeMappingEntryAssembly = null;
                foreach (var runtimeKnob in runtimeKnobs)
                {
                    var knobAndValue = runtimeKnob.Split('=', 2);
                    if (knobAndValue.Length == 2 && knobAndValue[0] == "System.Runtime.InteropServices.TypeMappingEntryAssembly")
                    {
                        typeMappingEntryAssembly = knobAndValue[1];
                        break;
                    }
                }
                if (typeMappingEntryAssembly is not null)
                {
                    var typeMapEntryAssembly = (EcmaAssembly)typeSystemContext.ResolveAssembly(AssemblyNameInfo.Parse(typeMappingEntryAssembly), throwIfNotFound: true);
                    typeMapManager = new UsageBasedTypeMapManager(TypeMapMetadata.CreateFromAssembly(typeMapEntryAssembly, typeSystemContext));
                }
                else if (entrypointModule is { Assembly: EcmaAssembly entryAssembly })
                {
                    // Fall back to entryassembly if not specified
                    typeMapManager = new UsageBasedTypeMapManager(TypeMapMetadata.CreateFromAssembly(entryAssembly, typeSystemContext));
                }
            }

            // Root whatever assemblies were specified on the command line
            string[] rootedAssemblies = Get(_command.RootedAssemblies);
            foreach (var rootedAssembly in rootedAssemblies)
            {

Review comment (suggestion):
Use nullable annotation `string?` instead of relying on implicit nullability. This is more consistent with modern C# conventions and the coding guidelines.
```suggestion
                string? typeMappingEntryAssembly = null;
```

Code after:
                    bool hidden = unmanagedEntryPointsAssemblyValue.EndsWith(hiddenSuffix, StringComparison.Ordinal);
                    string unmanagedEntryPointsAssembly = hidden ? unmanagedEntryPointsAssemblyValue[..^hiddenSuffix.Length] : unmanagedEntryPointsAssemblyValue;

                    if (typeSystemContext.InputFilePaths.ContainsKey(unmanagedEntryPointsAssembly))
                    {
                        // Skip adding UnmanagedEntryPointsRootProvider for modules that have been already registered as an input module
                        continue;
                    }
                    EcmaModule module = typeSystemContext.GetModuleForSimpleName(unmanagedEntryPointsAssembly);
                    compilationRoots.Add(new UnmanagedEntryPointsRootProvider(module, hidden));
                }

                foreach (var rdXmlFilePath in Get(_command.RdXmlFilePaths))
                {
                    compilationRoots.Add(new RdXmlRootProvider(typeSystemContext, rdXmlFilePath));
                }

                foreach (var linkTrimFilePath in Get(_command.LinkTrimFilePaths))
                {
                    if (!File.Exists(linkTrimFilePath))
                        throw new CommandLineException($"'{linkTrimFilePath}' doesn't exist");
                    compilationRoots.Add(new ILCompiler.DependencyAnalysis.TrimmingDescriptorNode(linkTrimFilePath));
                }

                // Get TypeMappingEntryAssembly from command-line option if specified
                string typeMappingEntryAssembly = Get(_command.TypeMapEntryAssembly);
                if (typeMappingEntryAssembly is not null)
                {
                    var typeMapEntryAssembly = (EcmaAssembly)typeSystemContext.ResolveAssembly(AssemblyNameInfo.Parse(typeMappingEntryAssembly), throwIfNotFound: true);
                    typeMapManager = new UsageBasedTypeMapManager(TypeMapMetadata.CreateFromAssembly(typeMapEntryAssembly, typeSystemContext));
                }
                else if (entrypointModule is { Assembly: EcmaAssembly entryAssembly })
                {
                    // Fall back to entryassembly if not specified
                    typeMapManager = new UsageBasedTypeMapManager(TypeMapMetadata.CreateFromAssembly(entryAssembly, typeSystemContext));
                }
            }

            // Root whatever assemblies were specified on the command line
            string[] rootedAssemblies = Get(_command.RootedAssemblies);
            foreach (var rootedAssembly in rootedAssemblies)
            {
                EcmaModule module = typeSystemContext.GetModuleForSimpleName(rootedAssembly);

                // We only root the module type. The rest will fall out because we treat rootedAssemblies
                // same as conditionally rooted ones and here we're fulfilling the condition ("something is used").
                compilationRoots.Add(
                    new GenericRootProvider<ModuleDesc>(module,
                    (ModuleDesc module, IRootingServiceProvider rooter) => rooter.AddReflectionRoot(module.GetGlobalModuleType(), "Command line root")));
            }