[
  {
    "path": ".editorconfig",
    "content": "; EditorConfig to support per-solution formatting.\r\n; Use the EditorConfig VS add-in to make this work.\r\n; http://editorconfig.org/\r\n\r\n; This is the default for the codeline.\r\nroot = true\r\n\r\n[*]\r\nindent_style = space\r\ntrim_trailing_whitespace = true\r\ninsert_final_newline = true\r\n\r\n; .NET Code - almost, but not exactly, the same suggestions as corefx\r\n; https://github.com/dotnet/corefx/blob/master/.editorconfig\r\n[*.cs]\r\nindent_size = 4\r\ncharset = utf-8-bom\r\n\r\n; New line preferences\r\ncsharp_new_line_before_open_brace = all\r\ncsharp_new_line_before_else = true\r\ncsharp_new_line_before_catch = true\r\ncsharp_new_line_before_finally = true\r\ncsharp_new_line_before_members_in_object_initializers = true\r\ncsharp_new_line_before_members_in_anonymous_types = true\r\ncsharp_new_line_between_query_expression_clauses = true\r\n\r\n; Indentation preferences\r\ncsharp_indent_block_contents = true\r\ncsharp_indent_braces = false\r\ncsharp_indent_case_contents = true\r\ncsharp_indent_case_contents_when_block = true\r\ncsharp_indent_switch_labels = true\r\ncsharp_indent_labels = one_less_than_current\r\n\r\n; Modifier preferences\r\ncsharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:warning\r\n\r\n; Avoid this. unless absolutely necessary\r\ndotnet_style_qualification_for_field = false:suggestion\r\ndotnet_style_qualification_for_property = false:suggestion\r\ndotnet_style_qualification_for_method = false:suggestion\r\ndotnet_style_qualification_for_event = false:suggestion\r\n\r\n; Types: use keywords instead of BCL types, using var is fine.\r\ncsharp_style_var_when_type_is_apparent = false:none\r\ndotnet_style_predefined_type_for_locals_parameters_members = true:suggestion\r\ndotnet_style_predefined_type_for_member_access = true:suggestion\r\n\r\n; Name all constant fields using PascalCase\r\ndotnet_naming_rule.constant_fields_should_be_pascal_case.severity = warning\r\ndotnet_naming_rule.constant_fields_should_be_pascal_case.symbols  = constant_fields\r\ndotnet_naming_rule.constant_fields_should_be_pascal_case.style    = pascal_case_style\r\ndotnet_naming_symbols.constant_fields.applicable_kinds   = field\r\ndotnet_naming_symbols.constant_fields.required_modifiers = const\r\ndotnet_naming_style.pascal_case_style.capitalization = pascal_case\r\n\r\n; Static fields should be _camelCase\r\ndotnet_naming_rule.static_fields_should_be_camel_case.severity = warning\r\ndotnet_naming_rule.static_fields_should_be_camel_case.symbols  = static_fields\r\ndotnet_naming_rule.static_fields_should_be_camel_case.style    = camel_case_underscore_style\r\ndotnet_naming_symbols.static_fields.applicable_kinds   = field\r\ndotnet_naming_symbols.static_fields.required_modifiers = static\r\ndotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected\r\n\r\n; Static readonly fields should be PascalCase\r\ndotnet_naming_rule.static_readonly_fields_should_be_pascal_case.severity = warning\r\ndotnet_naming_rule.static_readonly_fields_should_be_pascal_case.symbols  = static_readonly_fields\r\ndotnet_naming_rule.static_readonly_fields_should_be_pascal_case.style    = pascal_case_style\r\ndotnet_naming_symbols.static_readonly_fields.applicable_kinds   = field\r\ndotnet_naming_symbols.static_readonly_fields.required_modifiers = static, readonly\r\ndotnet_naming_symbols.static_readonly_fields.applicable_accessibilities = private, internal, private_protected\r\n\r\n; Internal and private fields should be _camelCase\r\ndotnet_naming_rule.camel_case_for_private_internal_fields.severity = warning\r\ndotnet_naming_rule.camel_case_for_private_internal_fields.symbols  = private_internal_fields\r\ndotnet_naming_rule.camel_case_for_private_internal_fields.style    = camel_case_underscore_style\r\ndotnet_naming_symbols.private_internal_fields.applicable_kinds = field\r\ndotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal\r\ndotnet_naming_style.camel_case_underscore_style.required_prefix = _\r\ndotnet_naming_style.camel_case_underscore_style.capitalization = camel_case\r\n\r\n; Code style defaults\r\ncsharp_using_directive_placement = outside_namespace:suggestion\r\ndotnet_sort_system_directives_first = true\r\ncsharp_prefer_braces = true:refactoring\r\ncsharp_preserve_single_line_blocks = true:none\r\ncsharp_preserve_single_line_statements = false:none\r\ncsharp_prefer_static_local_function = true:suggestion\r\ncsharp_prefer_simple_using_statement = false:none\r\ncsharp_style_prefer_switch_expression = true:suggestion\r\n\r\n; Code quality\r\ndotnet_style_readonly_field = true:suggestion\r\ndotnet_code_quality_unused_parameters = non_public:suggestion\r\n\r\n; Expression-level preferences\r\ndotnet_style_object_initializer = true:suggestion\r\ndotnet_style_collection_initializer = true:suggestion\r\ndotnet_style_explicit_tuple_names = true:suggestion\r\ndotnet_style_coalesce_expression = true:suggestion\r\ndotnet_style_null_propagation = true:suggestion\r\ndotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion\r\ndotnet_style_prefer_inferred_tuple_names = true:suggestion\r\ndotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion\r\ndotnet_style_prefer_auto_properties = true:suggestion\r\ndotnet_style_prefer_conditional_expression_over_assignment = true:refactoring\r\ndotnet_style_prefer_conditional_expression_over_return = true:refactoring\r\ncsharp_prefer_simple_default_expression = true:suggestion\r\n\r\n# Expression-bodied members\r\ncsharp_style_expression_bodied_methods = true:refactoring\r\ncsharp_style_expression_bodied_constructors = true:refactoring\r\ncsharp_style_expression_bodied_operators = true:refactoring\r\ncsharp_style_expression_bodied_properties = true:refactoring\r\ncsharp_style_expression_bodied_indexers = true:refactoring\r\ncsharp_style_expression_bodied_accessors = true:refactoring\r\ncsharp_style_expression_bodied_lambdas = true:refactoring\r\ncsharp_style_expression_bodied_local_functions = true:refactoring\r\n\r\n# Pattern matching\r\ncsharp_style_pattern_matching_over_is_with_cast_check = true:suggestion\r\ncsharp_style_pattern_matching_over_as_with_null_check = true:suggestion\r\ncsharp_style_inlined_variable_declaration = true:suggestion\r\n\r\n# Null checking preferences\r\ncsharp_style_throw_expression = true:suggestion\r\ncsharp_style_conditional_delegate_call = true:suggestion\r\n\r\n# Other features\r\ncsharp_style_namespace_declarations = file_scoped:suggestion\r\ncsharp_style_prefer_index_operator = false:none\r\ncsharp_style_prefer_range_operator = false:none\r\ncsharp_style_pattern_local_over_anonymous_function = false:none\r\n\r\n# Space preferences\r\ncsharp_space_after_cast = false\r\ncsharp_space_after_colon_in_inheritance_clause = true\r\ncsharp_space_after_comma = true\r\ncsharp_space_after_dot = false\r\ncsharp_space_after_keywords_in_control_flow_statements = true\r\ncsharp_space_after_semicolon_in_for_statement = true\r\ncsharp_space_around_binary_operators = before_and_after\r\ncsharp_space_around_declaration_statements = do_not_ignore\r\ncsharp_space_before_colon_in_inheritance_clause = true\r\ncsharp_space_before_comma = false\r\ncsharp_space_before_dot = false\r\ncsharp_space_before_open_square_brackets = false\r\ncsharp_space_before_semicolon_in_for_statement = false\r\ncsharp_space_between_empty_square_brackets = false\r\ncsharp_space_between_method_call_empty_parameter_list_parentheses = false\r\ncsharp_space_between_method_call_name_and_opening_parenthesis = false\r\ncsharp_space_between_method_call_parameter_list_parentheses = false\r\ncsharp_space_between_method_declaration_empty_parameter_list_parentheses = false\r\ncsharp_space_between_method_declaration_name_and_open_parenthesis = false\r\ncsharp_space_between_method_declaration_parameter_list_parentheses = false\r\ncsharp_space_between_parentheses = false\r\ncsharp_space_between_square_brackets = false\r\n\r\n; .NET project files and MSBuild - match defaults for VS\r\n[*.{csproj,nuspec,proj,projitems,props,shproj,targets,vbproj,vcxproj,vcxproj.filters,vsixmanifest,vsct}]\r\nindent_size = 2\r\n\r\n; .NET solution files - match defaults for VS\r\n[*.sln]\r\nend_of_line = crlf\r\nindent_style = tab\r\n\r\n; Config - match XML and default nuget.config template\r\n[*.config]\r\nindent_size = 2\r\n\r\n; Resources - match defaults for VS\r\n[*.resx]\r\nindent_size = 2\r\n\r\n; Static analysis rulesets - match defaults for VS\r\n[*.ruleset]\r\nindent_size = 2\r\n\r\n; HTML, XML - match defaults for VS\r\n[*.{cshtml,html,xml}]\r\nindent_size = 4\r\n\r\n; JavaScript and JS mixes - match eslint settings; JSON also matches .NET Core templates\r\n[*.{js,json,ts,vue}]\r\nindent_size = 2\r\n\r\n; Markdown - match markdownlint settings\r\n[*.{md,markdown}]\r\nindent_size = 2\r\n\r\n; PowerShell - match defaults for New-ModuleManifest and PSScriptAnalyzer Invoke-Formatter\r\n[*.{ps1,psd1,psm1}]\r\nindent_size = 4\r\ncharset = utf-8-bom\r\n\r\n; ReStructuredText - standard indentation format from examples\r\n[*.rst]\r\nindent_size = 2\r\n\r\n# YAML - match standard YAML like Kubernetes and GitHub Actions\r\n[*.{yaml,yml}]\r\nindent_size = 2\r\n"
  },
  {
    "path": ".gitattributes",
    "content": "*.doc  diff=astextplain\n*.DOC\tdiff=astextplain\n*.docx\tdiff=astextplain\n*.DOCX\tdiff=astextplain\n*.dot\tdiff=astextplain\n*.DOT\tdiff=astextplain\n*.pdf\tdiff=astextplain\n*.PDF\tdiff=astextplain\n*.rtf\tdiff=astextplain\n*.RTF\tdiff=astextplain\n\n*.jpg  \tbinary\n*.png \tbinary\n*.gif \tbinary\n\n*.cs text=auto diff=csharp\n*.vb text=auto\n*.resx text=auto\n*.c text=auto\n*.cpp text=auto\n*.cxx text=auto\n*.h text=auto\n*.hxx text=auto\n*.py text=auto\n*.rb text=auto\n*.java text=auto\n*.html text=auto\n*.htm text=auto\n*.css text=auto\n*.scss text=auto\n*.sass text=auto\n*.less text=auto\n*.js text=auto\n*.lisp text=auto\n*.clj text=auto\n*.sql text=auto\n*.php text=auto\n*.lua text=auto\n*.m text=auto\n*.asm text=auto\n*.erl text=auto\n*.fs text=auto\n*.fsx text=auto\n*.hs text=auto\n\n*.csproj text=auto\n*.vbproj text=auto\n*.fsproj text=auto\n*.dbproj text=auto\n*.sln text=auto eol=crlf\n"
  },
  {
    "path": ".github/workflows/build.yml",
    "content": "name: Build and Test\non:\n  workflow_call:\n    secrets:\n      CODECOV_TOKEN:\n        description: Token for uploading code coverage metrics to CodeCov.io.\n        required: true\njobs:\n  build:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout\n        uses: actions/checkout@v6\n      - name: Setup .NET\n        uses: actions/setup-dotnet@v5\n        with:\n          dotnet-version: |\n            8.0.x\n            10.0.x\n      - name: Build and test\n        run: dotnet msbuild ./default.proj\n      - name: Upload coverage\n        uses: codecov/codecov-action@v5\n        with:\n          fail_ci_if_error: true\n          files: artifacts/logs/*/coverage.cobertura.xml\n          token: ${{ secrets.CODECOV_TOKEN }}\n      - name: Upload package artifacts\n        uses: actions/upload-artifact@v7\n        with:\n          name: packages\n          path: |\n            artifacts/packages/*.nupkg\n            artifacts/packages/*.snupkg\n"
  },
  {
    "path": ".github/workflows/ci.yml",
    "content": "name: Continuous Integration\non:\n  pull_request:\n    branches:\n      - develop\n      - master\n  push:\n    branches:\n      - develop\n      - master\n      - feature/*\n    tags:\n      - v[0-9]+.[0-9]+.[0-9]+\n# If multiple pushes happen quickly in succession, cancel the running build and\n# start a new one.\nconcurrency:\n  group: ${{ github.workflow }}-${{ github.ref }}\n  cancel-in-progress: true\njobs:\n  # Linting\n  dotnet-format:\n    uses: ./.github/workflows/dotnet-format.yml\n  pre-commit:\n    uses: ./.github/workflows/pre-commit.yml\n  # Build and test\n  build:\n    uses: ./.github/workflows/build.yml\n    secrets:\n      CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}\n  # Publish beta and release packages.\n  publish:\n    uses: ./.github/workflows/publish.yml\n    needs:\n      - build\n      - dotnet-format\n      - pre-commit\n    if: ${{ github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/tags/v') }}\n    secrets:\n      NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}\n"
  },
  {
    "path": ".github/workflows/dotnet-format.yml",
    "content": "name: dotnet format\non:\n  workflow_call:\njobs:\n  dotnet-format:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n      - name: Setup .NET 10\n        uses: actions/setup-dotnet@v5\n        with:\n          dotnet-version: 10.0.x\n      - name: dotnet format\n        run: dotnet format Autofac.Extensions.DependencyInjection.sln --verify-no-changes\n"
  },
  {
    "path": ".github/workflows/pre-commit.yml",
    "content": "name: pre-commit\non:\n  workflow_call:\njobs:\n  pre-commit:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v6\n      - uses: actions/setup-python@v6\n        with:\n          python-version: 3.x\n      - uses: pre-commit/action@v3.0.1\n"
  },
  {
    "path": ".github/workflows/publish.yml",
    "content": "name: Publish\non:\n  workflow_call:\n    secrets:\n      NUGET_API_KEY:\n        description: Token for publishing packages to NuGet.\n        required: true\njobs:\n  publish:\n    runs-on: ubuntu-latest\n    steps:\n      - name: Setup .NET\n        uses: actions/setup-dotnet@v5\n        with:\n          dotnet-version: 10.0.x\n      - name: Download package artifacts\n        uses: actions/download-artifact@v8\n        with:\n          name: packages\n          path: artifacts/packages\n      - name: Publish to GitHub Packages\n        run: |\n          dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github \"https://nuget.pkg.github.com/autofac/index.json\"\n          dotnet nuget push ./artifacts/packages/*.nupkg --skip-duplicate --source github --api-key ${{ secrets.GITHUB_TOKEN }}\n          dotnet nuget push ./artifacts/packages/*.snupkg --skip-duplicate --source github --api-key ${{ secrets.GITHUB_TOKEN }}\n      - name: Publish to NuGet\n        if: ${{ startsWith(github.ref, 'refs/tags/v') }}\n        run: |\n          dotnet nuget push ./artifacts/packages/*.nupkg --skip-duplicate --source https://api.nuget.org/v3/index.json --api-key ${{ secrets.NUGET_API_KEY }}\n"
  },
  {
    "path": ".gitignore",
    "content": "## Ignore Visual Studio temporary files, build results, and\r\n## files generated by popular Visual Studio add-ons.\r\n\r\n# Project specific files\r\nartifacts/\r\nBenchmarkDotNet.Artifacts/\r\n\r\n# User-specific files\r\n*.suo\r\n*.user\r\n*.sln.docstates\r\n*.ide\r\nIndex.dat\r\nStorage.dat\r\n\r\n# Build results\r\n[Dd]ebug/\r\n[Rr]elease/\r\nx64/\r\n[Bb]in/\r\n[Oo]bj/\r\n\r\n# Visual Studio 2015 cache/options directory\r\n.dotnet/\r\n.vs/\r\n.cr/\r\n\r\n# Enable \"build/\" folder in the NuGet Packages folder since NuGet packages use it for MSBuild targets\r\n!packages/*/build/\r\n\r\n# MSTest test Results\r\n[Tt]est[Rr]esult*/\r\n[Bb]uild[Ll]og.*\r\n*.TestResults.xml\r\nresults/\r\n\r\n*_i.c\r\n*_p.c\r\n*.ilk\r\n*.meta\r\n*.obj\r\n*.pch\r\n*.pdb\r\n*.pgc\r\n*.pgd\r\n*.rsp\r\n*.sbr\r\n*.tlb\r\n*.tli\r\n*.tlh\r\n*.tmp\r\n*.tmp_proj\r\n*.log\r\n*.vspscc\r\n*.vssscc\r\n.builds\r\n*.pidb\r\n*.log\r\n*.scc\r\n\r\n# Visual C++ cache files\r\nipch/\r\n*.aps\r\n*.ncb\r\n*.opensdf\r\n*.sdf\r\n*.cachefile\r\n\r\n# Visual Studio profiler\r\n*.psess\r\n*.vsp\r\n*.vspx\r\n\r\n# Guidance Automation Toolkit\r\n*.gpState\r\n\r\n# ReSharper is a .NET coding add-in\r\n_ReSharper*/\r\n*.[Rr]e[Ss]harper\r\n\r\n# TeamCity is a build add-in\r\n_TeamCity*\r\n\r\n# DotCover is a Code Coverage Tool\r\n*.dotCover\r\n\r\n# NCrunch\r\n*.ncrunch*\r\n.*crunch*.local.xml\r\n\r\n# Installshield output folder\r\n[Ee]xpress/\r\n\r\n# DocProject is a documentation generator add-in\r\nDocProject/buildhelp/\r\nDocProject/Help/*.HxT\r\nDocProject/Help/*.HxC\r\nDocProject/Help/*.hhc\r\nDocProject/Help/*.hhk\r\nDocProject/Help/*.hhp\r\nDocProject/Help/Html2\r\nDocProject/Help/html\r\n\r\n# Click-Once directory\r\npublish/\r\n\r\n# Publish Web Output\r\n*.[Pp]ublish.xml\r\n*.pubxml\r\n\r\n# NuGet Packages Directory\r\npackages/\r\n\r\n# Windows Azure Build Output\r\ncsx\r\n*.build.csdef\r\n\r\n# Windows Store app package directory\r\nAppPackages/\r\n\r\n# Others\r\nsql/\r\n*.Cache\r\nClientBin/\r\n[Ss]tyle[Cc]op.*\r\n!stylecop.json\r\n~$*\r\n*~\r\n*.dbmdl\r\n*.pfx\r\n*.publishsettings\r\nnode_modules/\r\nbower_components/\r\nwwwroot/\r\nproject.lock.json\r\n*.Designer.cs\r\n\r\n# RIA/Silverlight projects\r\nGenerated_Code/\r\n\r\n# Backup & report files from converting an old project file to a newer\r\n# Visual Studio version. Backup files are not needed, because we have git ;-)\r\n_UpgradeReport_Files/\r\nBackup*/\r\nUpgradeLog*.XML\r\nUpgradeLog*.htm\r\n\r\n# SQL Server files\r\nApp_Data/*.mdf\r\nApp_Data/*.ldf\r\n\r\n# =========================\r\n# Windows detritus\r\n# =========================\r\n\r\n# Windows image file caches\r\nThumbs.db\r\nehthumbs.db\r\n\r\n# Folder config file\r\nDesktop.ini\r\n\r\n# Recycle Bin used on file shares\r\n$RECYCLE.BIN/\r\n\r\n# Mac crap\r\n.DS_Store\r\n\r\n# JetBrains Rider\r\n.idea\r\n"
  },
  {
    "path": ".markdownlint.json",
    "content": "{\n  \"MD013\": false\n}\n"
  },
  {
    "path": ".pre-commit-config.yaml",
    "content": "repos:\n  - repo: https://github.com/pre-commit/pre-commit-hooks\n    rev: \"3e8a8703264a2f4a69428a0aa4dcb512790b2c8c\"  # frozen: v6.0.0\n    hooks:\n      - id: check-json\n      - id: check-yaml\n      - id: check-merge-conflict\n      - id: end-of-file-fixer\n      - id: trailing-whitespace\n  - repo: https://github.com/igorshubovych/markdownlint-cli\n    rev: \"76b3d32d3f4b965e1d6425253c59407420ae2c43\"  # frozen: v0.47.0\n    hooks:\n      - id: markdownlint\n        args:\n          - --fix\n  - repo: https://github.com/tillig/json-sort-cli\n    rev: \"009ab2ab49e1f2fa9d6b9dfc31009ceeca055204\"  # frozen: v3.0.0\n    hooks:\n      - id: json-sort\n        args:\n          - --autofix\n"
  },
  {
    "path": ".vscode/extensions.json",
    "content": "{\n  \"recommendations\": [\n    \"davidanson.vscode-markdownlint\",\n    \"editorconfig.editorconfig\",\n    \"ms-dotnettools.csdevkit\",\n    \"travisillig.vscode-json-stable-stringify\"\n  ]\n}\n"
  },
  {
    "path": ".vscode/launch.json",
    "content": "{\n  \"configurations\": [\n    {\n      \"args\": [\n      ],\n      \"cwd\": \"${workspaceFolder}/test/Integration.Net8\",\n      \"env\": {\n        \"ASPNETCORE_ENVIRONMENT\": \"Development\"\n      },\n      \"name\": \"Launch .NET 8 Integration Site\",\n      \"preLaunchTask\": \"build\",\n      \"program\": \"${workspaceFolder}/test/Integration.Net8/bin/Debug/net8.0/Integration.Net8.dll\",\n      \"request\": \"launch\",\n      \"serverReadyAction\": {\n        \"action\": \"openExternally\",\n        \"pattern\": \"\\\\bNow listening on:\\\\s+(https?://\\\\S+)\",\n        \"uriFormat\": \"%s/date\"\n      },\n      \"stopAtEntry\": false,\n      \"type\": \"coreclr\"\n    },\n    {\n      \"args\": [\n      ],\n      \"cwd\": \"${workspaceFolder}/test/Integration.Net10\",\n      \"env\": {\n        \"ASPNETCORE_ENVIRONMENT\": \"Development\"\n      },\n      \"name\": \"Launch .NET 10 Integration Site\",\n      \"preLaunchTask\": \"build\",\n      \"program\": \"${workspaceFolder}/test/Integration.Net10/bin/Debug/net10.0/Integration.Net10.dll\",\n      \"request\": \"launch\",\n      \"serverReadyAction\": {\n        \"action\": \"openExternally\",\n        \"pattern\": \"\\\\bNow listening on:\\\\s+(https?://\\\\S+)\",\n        \"uriFormat\": \"%s/date\"\n      },\n      \"stopAtEntry\": false,\n      \"type\": \"coreclr\"\n    }\n  ],\n  \"version\": \"0.2.0\"\n}\n"
  },
  {
    "path": ".vscode/settings.json",
    "content": "{\n  \"cSpell.words\": [\n    \"autofac\",\n    \"cref\",\n    \"diagnoser\",\n    \"diagnosers\",\n    \"inheritdoc\",\n    \"langword\",\n    \"paramref\",\n    \"seealso\",\n    \"typeparam\",\n    \"unmanaged\",\n    \"xunit\"\n  ],\n  \"coverage-gutters.coverageBaseDir\": \"artifacts/logs\",\n  \"coverage-gutters.coverageFileNames\": [\n    \"**/coverage.cobertura.xml\"\n  ],\n  \"dotnet.defaultSolution\": \"Autofac.Extensions.DependencyInjection.sln\",\n  \"dotnet.unitTestDebuggingOptions\": {\n    \"enableStepFiltering\": false,\n    \"justMyCode\": false,\n    \"requireExactSource\": false,\n    \"sourceLinkOptions\": {\n      \"*\": {\n        \"enabled\": true\n      }\n    },\n    \"suppressJITOptimizations\": true,\n    \"symbolOptions\": {\n      \"searchNuGetOrgSymbolServer\": true\n    }\n  },\n  \"explorer.fileNesting.enabled\": true,\n  \"explorer.fileNesting.patterns\": {\n    \"*.resx\": \"$(capture).*.resx, $(capture).designer.cs, $(capture).designer.vb\"\n  },\n  \"files.watcherExclude\": {\n    \"**/target\": true\n  }\n}\n"
  },
  {
    "path": ".vscode/tasks.json",
    "content": "{\n  \"linux\": {\n    \"options\": {\n      \"shell\": {\n        \"args\": [\n          \"-NoProfile\",\n          \"-Command\"\n        ],\n        \"executable\": \"pwsh\"\n      }\n    }\n  },\n  \"osx\": {\n    \"options\": {\n      \"shell\": {\n        \"args\": [\n          \"-NoProfile\",\n          \"-Command\"\n        ],\n        \"executable\": \"/usr/local/bin/pwsh\"\n      }\n    }\n  },\n  \"tasks\": [\n    {\n      \"command\": \"If (Test-Path ${workspaceFolder}/artifacts/logs) { Remove-Item ${workspaceFolder}/artifacts/logs -Recurse -Force }; New-Item -Path ${workspaceFolder}/artifacts/logs -ItemType Directory -Force | Out-Null\",\n      \"label\": \"create log directory\",\n      \"type\": \"shell\"\n    },\n    {\n      \"args\": [\n        \"build\",\n        \"${workspaceFolder}/Autofac.Extensions.DependencyInjection.sln\",\n        \"--tl:off\",\n        \"/property:GenerateFullPaths=true\",\n        \"/consoleloggerparameters:NoSummary\"\n      ],\n      \"command\": \"dotnet\",\n      \"group\": {\n        \"isDefault\": true,\n        \"kind\": \"build\"\n      },\n      \"label\": \"build\",\n      \"problemMatcher\": \"$msCompile\",\n      \"type\": \"shell\"\n    },\n    {\n      \"args\": [\n        \"test\",\n        \"${workspaceFolder}/Autofac.Extensions.DependencyInjection.sln\",\n        \"/property:GenerateFullPaths=true\",\n        \"/consoleloggerparameters:NoSummary\",\n        \"--results-directory\",\n        \"artifacts/logs\",\n        \"--logger:trx\",\n        \"--collect:XPlat Code Coverage\",\n        \"--settings:build/Coverage.runsettings\",\n        \"--filter\",\n        \"FullyQualifiedName!~Bench\"\n      ],\n      \"command\": \"dotnet\",\n      \"dependsOn\": [\n        \"create log directory\"\n      ],\n      \"group\": {\n        \"isDefault\": true,\n        \"kind\": \"test\"\n      },\n      \"label\": \"test\",\n      \"problemMatcher\": \"$msCompile\",\n      \"type\": \"process\"\n    }\n  ],\n  \"version\": \"2.0.0\",\n  \"windows\": {\n    \"options\": {\n      \"shell\": {\n        \"args\": [\n          \"-NoProfile\",\n          \"-ExecutionPolicy\",\n          \"Bypass\",\n          \"-Command\"\n        ],\n        \"executable\": \"pwsh.exe\"\n      }\n    }\n  }\n}\n"
  },
  {
    "path": "Autofac.Extensions.DependencyInjection.sln",
    "content": "﻿\r\nMicrosoft Visual Studio Solution File, Format Version 12.00\r\n# Visual Studio Version 16\r\nVisualStudioVersion = 16.0.29201.188\r\nMinimumVisualStudioVersion = 10.0.40219.1\r\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"src\", \"src\", \"{5A54DF18-E3F3-4929-876D-00650A15763E}\"\r\nEndProject\r\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"test\", \"test\", \"{DEA4A8C6-DE56-4359-A87C-472FB34132E7}\"\r\nEndProject\r\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"Solution Items\", \"Solution Items\", \"{6B324E70-6C86-4E09-B150-CAE9DD2BADCC}\"\r\n\tProjectSection(SolutionItems) = preProject\r\n\t\t.gitignore = .gitignore\r\n\t\tglobal.json = global.json\r\n\t\tcodecov.yml = codecov.yml\r\n\t\tdefault.proj = default.proj\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Autofac.Extensions.DependencyInjection\", \"src\\Autofac.Extensions.DependencyInjection\\Autofac.Extensions.DependencyInjection.csproj\", \"{513C7F7A-A758-4D48-94F4-891A00F63DA1}\"\r\nEndProject\r\nProject(\"{9A19103F-16F7-4668-BE54-9A1E7A4F7556}\") = \"Autofac.Extensions.DependencyInjection.Test\", \"test\\Autofac.Extensions.DependencyInjection.Test\\Autofac.Extensions.DependencyInjection.Test.csproj\", \"{911AA52A-4E68-41C5-AB24-D1618AFDF753}\"\r\nEndProject\r\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"bench\", \"bench\", \"{C39BE99E-D778-485B-920A-42D4EB3CBA75}\"\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Autofac.Extensions.DependencyInjection.Bench\", \"bench\\Autofac.Extensions.DependencyInjection.Bench\\Autofac.Extensions.DependencyInjection.Bench.csproj\", \"{639CD744-1E61-4EF8-9E5A-9920A6BC3891}\"\r\nEndProject\r\nProject(\"{2150E333-8FDC-42A3-9474-1A3956D46DE8}\") = \"build\", \"build\", \"{4072A677-5ACA-4CA4-B5EB-9B9DE7D1DD08}\"\r\n\tProjectSection(SolutionItems) = preProject\r\n\t\tbuild\\Analyzers.ruleset = build\\Analyzers.ruleset\r\n\t\tbuild\\Autofac.Build.psd1 = build\\Autofac.Build.psd1\r\n\t\tbuild\\Autofac.Build.psm1 = build\\Autofac.Build.psm1\r\n\t\tbuild\\CodeAnalysisDictionary.xml = build\\CodeAnalysisDictionary.xml\r\n\tEndProjectSection\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Autofac.Extensions.DependencyInjection.Integration.Test\", \"test\\Autofac.Extensions.DependencyInjection.Integration.Test\\Autofac.Extensions.DependencyInjection.Integration.Test.csproj\", \"{D6217688-8E4A-4092-8D78-C4D299F27D7B}\"\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Integration.Net8\", \"test\\Integration.Net8\\Integration.Net8.csproj\", \"{549E4C50-7B8F-4E18-92E1-60F036B3515F}\"\r\nEndProject\r\nProject(\"{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}\") = \"Integration.Net10\", \"test\\Integration.Net10\\Integration.Net10.csproj\", \"{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}\"\r\nEndProject\r\nGlobal\r\n\tGlobalSection(SolutionConfigurationPlatforms) = preSolution\r\n\t\tDebug|Any CPU = Debug|Any CPU\r\n\t\tDebug|ARM = Debug|ARM\r\n\t\tDebug|x64 = Debug|x64\r\n\t\tDebug|x86 = Debug|x86\r\n\t\tRelease|Any CPU = Release|Any CPU\r\n\t\tRelease|ARM = Release|ARM\r\n\t\tRelease|x64 = Release|x64\r\n\t\tRelease|x86 = Release|x86\r\n\tEndGlobalSection\r\n\tGlobalSection(ProjectConfigurationPlatforms) = postSolution\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Debug|ARM.ActiveCfg = Debug|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Debug|ARM.Build.0 = Debug|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Debug|x64.ActiveCfg = Debug|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Debug|x64.Build.0 = Debug|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Debug|x86.ActiveCfg = Debug|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Debug|x86.Build.0 = Debug|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Release|ARM.ActiveCfg = Release|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Release|ARM.Build.0 = Release|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Release|x64.ActiveCfg = Release|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Release|x64.Build.0 = Release|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Release|x86.ActiveCfg = Release|Any CPU\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1}.Release|x86.Build.0 = Release|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Debug|ARM.ActiveCfg = Debug|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Debug|ARM.Build.0 = Debug|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Debug|x64.ActiveCfg = Debug|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Debug|x64.Build.0 = Debug|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Debug|x86.ActiveCfg = Debug|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Debug|x86.Build.0 = Debug|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Release|ARM.ActiveCfg = Release|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Release|ARM.Build.0 = Release|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Release|x64.ActiveCfg = Release|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Release|x64.Build.0 = Release|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Release|x86.ActiveCfg = Release|Any CPU\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753}.Release|x86.Build.0 = Release|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Debug|ARM.ActiveCfg = Debug|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Debug|ARM.Build.0 = Debug|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Debug|x64.ActiveCfg = Debug|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Debug|x64.Build.0 = Debug|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Debug|x86.ActiveCfg = Debug|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Debug|x86.Build.0 = Debug|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Release|ARM.ActiveCfg = Release|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Release|ARM.Build.0 = Release|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Release|x64.ActiveCfg = Release|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Release|x64.Build.0 = Release|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Release|x86.ActiveCfg = Release|Any CPU\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891}.Release|x86.Build.0 = Release|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Debug|ARM.ActiveCfg = Debug|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Debug|ARM.Build.0 = Debug|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Debug|x64.ActiveCfg = Debug|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Debug|x64.Build.0 = Debug|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Debug|x86.ActiveCfg = Debug|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Debug|x86.Build.0 = Debug|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Release|ARM.ActiveCfg = Release|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Release|ARM.Build.0 = Release|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Release|x64.ActiveCfg = Release|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Release|x64.Build.0 = Release|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Release|x86.ActiveCfg = Release|Any CPU\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B}.Release|x86.Build.0 = Release|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Debug|ARM.ActiveCfg = Debug|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Debug|ARM.Build.0 = Debug|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Debug|x64.ActiveCfg = Debug|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Debug|x64.Build.0 = Debug|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Debug|x86.ActiveCfg = Debug|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Debug|x86.Build.0 = Debug|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Release|ARM.ActiveCfg = Release|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Release|ARM.Build.0 = Release|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Release|x64.ActiveCfg = Release|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Release|x64.Build.0 = Release|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Release|x86.ActiveCfg = Release|Any CPU\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F}.Release|x86.Build.0 = Release|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Debug|Any CPU.Build.0 = Debug|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Debug|ARM.ActiveCfg = Debug|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Debug|ARM.Build.0 = Debug|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Debug|x64.ActiveCfg = Debug|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Debug|x64.Build.0 = Debug|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Debug|x86.ActiveCfg = Debug|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Debug|x86.Build.0 = Debug|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Release|Any CPU.ActiveCfg = Release|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Release|Any CPU.Build.0 = Release|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Release|ARM.ActiveCfg = Release|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Release|ARM.Build.0 = Release|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Release|x64.ActiveCfg = Release|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Release|x64.Build.0 = Release|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Release|x86.ActiveCfg = Release|Any CPU\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC}.Release|x86.Build.0 = Release|Any CPU\r\n\tEndGlobalSection\r\n\tGlobalSection(SolutionProperties) = preSolution\r\n\t\tHideSolutionNode = FALSE\r\n\tEndGlobalSection\r\n\tGlobalSection(NestedProjects) = preSolution\r\n\t\t{513C7F7A-A758-4D48-94F4-891A00F63DA1} = {5A54DF18-E3F3-4929-876D-00650A15763E}\r\n\t\t{911AA52A-4E68-41C5-AB24-D1618AFDF753} = {DEA4A8C6-DE56-4359-A87C-472FB34132E7}\r\n\t\t{639CD744-1E61-4EF8-9E5A-9920A6BC3891} = {C39BE99E-D778-485B-920A-42D4EB3CBA75}\r\n\t\t{D6217688-8E4A-4092-8D78-C4D299F27D7B} = {DEA4A8C6-DE56-4359-A87C-472FB34132E7}\r\n\t\t{549E4C50-7B8F-4E18-92E1-60F036B3515F} = {DEA4A8C6-DE56-4359-A87C-472FB34132E7}\r\n\t\t{3514BA96-C0C2-44A5-95EF-EF3F54219CDC} = {DEA4A8C6-DE56-4359-A87C-472FB34132E7}\r\n\tEndGlobalSection\r\n\tGlobalSection(ExtensibilityGlobals) = postSolution\r\n\t\tSolutionGuid = {76E0A652-E5E2-4CA4-BAFD-AF6FDE0BD56A}\r\n\t\tEnterpriseLibraryConfigurationToolBinariesPath = packages\\Unity.2.1.505.0\\lib\\NET35;packages\\Unity.Interception.2.1.505.0\\lib\\NET35;packages\\EnterpriseLibrary.Common.5.0.505.0\\lib\\NET35;packages\\EnterpriseLibrary.ExceptionHandling.5.0.505.0\\lib\\NET35;packages\\Unity.2.1.505.2\\lib\\NET35;packages\\Unity.Interception.2.1.505.2\\lib\\NET35\r\n\tEndGlobalSection\r\nEndGlobal\r\n"
  },
  {
    "path": "Autofac.Extensions.DependencyInjection.sln.DotSettings",
    "content": "﻿<wpf:ResourceDictionary xml:space=\"preserve\" xmlns:x=\"http://schemas.microsoft.com/winfx/2006/xaml\" xmlns:s=\"clr-namespace:System;assembly=mscorlib\" xmlns:ss=\"urn:shemas-jetbrains-com:settings-storage-xaml\" xmlns:wpf=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\">\n\t<s:Boolean x:Key=\"/Default/UserDictionary/Words/=Autofac/@EntryIndexedValue\">True</s:Boolean></wpf:ResourceDictionary>\n"
  },
  {
    "path": "Directory.Build.props",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project>\n  <PropertyGroup Condition=\" '$(Configuration)' == 'Release' \">\n    <TreatWarningsAsErrors>true</TreatWarningsAsErrors>\n  </PropertyGroup>\n</Project>\n"
  },
  {
    "path": "LICENSE",
    "content": "The MIT License (MIT)\n\nCopyright © 2014 Autofac Project\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "# Autofac.Extensions.DependencyInjection\r\n\r\nAutofac is an [IoC container](http://martinfowler.com/articles/injection.html) for Microsoft .NET. It manages the dependencies between classes so that **applications stay easy to change as they grow** in size and complexity. This is achieved by treating regular .NET classes as *[components](https://autofac.readthedocs.io/en/latest/glossary.html)*.\r\n\r\n[![Build status](https://ci.appveyor.com/api/projects/status/1mhkjcqr1ug80lra/branch/develop?svg=true)](https://ci.appveyor.com/project/Autofac/autofac-extensions-dependencyinjection/branch/develop) [![codecov](https://codecov.io/gh/Autofac/Autofac.Extensions.DependencyInjection/branch/develop/graph/badge.svg)](https://codecov.io/gh/Autofac/Autofac.Extensions.DependencyInjection)\r\n\r\nPlease file issues and pull requests for this package in this repository rather than in the Autofac core repo.\r\n\r\n- [Documentation - .NET Core Integration](https://autofac.readthedocs.io/en/latest/integration/netcore.html)\r\n- [Documentation - ASP.NET Core Integration](https://autofac.readthedocs.io/en/latest/integration/aspnetcore.html)\r\n- [NuGet](https://www.nuget.org/packages/Autofac.Extensions.DependencyInjection)\r\n- [Contributing](https://autofac.readthedocs.io/en/latest/contributors.html)\r\n- [Open in Visual Studio Code](https://open.vscode.dev/autofac/Autofac.Extensions.DependencyInjection)\r\n\r\n## Get Started in ASP.NET Core\r\n\r\nThis quick start shows how to use the `IServiceProviderFactory{T}` integration that ASP.NET Core supports to help automatically build the root service provider for you. If you want more manual control, [check out the documentation for examples](https://autofac.readthedocs.io/en/latest/integration/aspnetcore.html).\r\n\r\n- Reference the `Autofac.Extensions.DependencyInjection` package from NuGet.\r\n- In your `Program.Main` method, where you configure the `HostBuilder`, call `UseAutofac` to hook Autofac into the startup pipeline.\r\n- In the `ConfigureServices` method of your `Startup` class register things into the `IServiceCollection` using extension methods provided by other libraries.\r\n- In the `ConfigureContainer` method of your `Startup` class register things directly into an Autofac `ContainerBuilder`.\r\n\r\nThe `IServiceProvider` will automatically be created for you, so there's nothing you have to do but *register things*.\r\n\r\n```C#\r\npublic class Program\r\n{\r\n  public static async Task Main(string[] args)\r\n  {\r\n    // The service provider factory used here allows for\r\n    // ConfigureContainer to be supported in Startup with\r\n    // a strongly-typed ContainerBuilder.\r\n    var host = Host.CreateDefaultBuilder(args)\r\n      .UseServiceProviderFactory(new AutofacServiceProviderFactory())\r\n      .ConfigureWebHostDefaults(webHostBuilder => {\r\n        webHostBuilder\r\n          .UseContentRoot(Directory.GetCurrentDirectory())\r\n          .UseIISIntegration()\r\n          .UseStartup<Startup>()\r\n      })\r\n      .Build();\r\n\r\n    await host.RunAsync();\r\n  }\r\n}\r\n\r\npublic class Startup\r\n{\r\n  public Startup(IWebHostEnvironment env)\r\n  {\r\n    var builder = new ConfigurationBuilder()\r\n        .SetBasePath(env.ContentRootPath)\r\n        .AddJsonFile(\"appsettings.json\", optional: true, reloadOnChange: true)\r\n        .AddJsonFile($\"appsettings.{env.EnvironmentName}.json\", optional: true)\r\n        .AddEnvironmentVariables();\r\n    this.Configuration = builder.Build();\r\n  }\r\n\r\n  public IConfiguration Configuration { get; private set; }\r\n\r\n  // ConfigureServices is where you register dependencies. This gets\r\n  // called by the runtime before the ConfigureContainer method, below.\r\n  public void ConfigureServices(IServiceCollection services)\r\n  {\r\n    // Add services to the collection. Don't build or return\r\n    // any IServiceProvider or the ConfigureContainer method\r\n    // won't get called.\r\n    services.AddOptions();\r\n  }\r\n\r\n  // ConfigureContainer is where you can register things directly\r\n  // with Autofac. This runs after ConfigureServices so the things\r\n  // here will override registrations made in ConfigureServices.\r\n  // Don't build the container; that gets done for you. If you\r\n  // need a reference to the container, you need to use the\r\n  // \"Without ConfigureContainer\" mechanism shown later.\r\n  public void ConfigureContainer(ContainerBuilder builder)\r\n  {\r\n      builder.RegisterModule(new AutofacModule());\r\n  }\r\n\r\n  // Configure is where you add middleware. This is called after\r\n  // ConfigureContainer. You can use IApplicationBuilder.ApplicationServices\r\n  // here if you need to resolve things from the container.\r\n  public void Configure(\r\n    IApplicationBuilder app,\r\n    ILoggerFactory loggerFactory)\r\n  {\r\n      loggerFactory.AddConsole(this.Configuration.GetSection(\"Logging\"));\r\n      loggerFactory.AddDebug();\r\n      app.UseMvc();\r\n  }\r\n}\r\n```\r\n\r\nOur [ASP.NET Core](https://autofac.readthedocs.io/en/latest/integration/aspnetcore.html) integration documentation contains more information about using Autofac with ASP.NET Core.\r\n\r\n## Get Help\r\n\r\n**Need help with Autofac?** We have [a documentation site](https://autofac.readthedocs.io/) as well as [API documentation](https://autofac.org/apidoc/). We're ready to answer your questions on [Stack Overflow](https://stackoverflow.com/questions/tagged/autofac) or check out the [discussion forum](https://groups.google.com/forum/#forum/autofac).\r\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/Autofac.Extensions.DependencyInjection.Bench.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n  <PropertyGroup>\n    <TargetFramework>net10.0</TargetFramework>\n    <NoWarn>$(NoWarn);CS1591</NoWarn>\n    <OutputType>Exe</OutputType>\n    <GenerateProgramFile>false</GenerateProgramFile>\n    <PlatformTarget>$([System.Runtime.InteropServices.RuntimeInformation]::OSArchitecture)</PlatformTarget>\n    <LangVersion>latest</LangVersion>\n    <Nullable>enable</Nullable>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <CodeAnalysisRuleSet>../../build/Test.ruleset</CodeAnalysisRuleSet>\n    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>\n    <AnalysisMode>AllEnabledByDefault</AnalysisMode>\n    <ImplicitUsings>enable</ImplicitUsings>\n    <IsPackable>false</IsPackable>\n    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>\n    <PreserveCompilationContext>true</PreserveCompilationContext>\n    <UseProjectReference Condition=\"'$(UseProjectReference)' == ''\">true</UseProjectReference>\n  </PropertyGroup>\n  <ItemGroup>\n    <Using Include=\"BenchmarkDotNet.Attributes\" />\n    <Using Include=\"Xunit\" />\n  </ItemGroup>\n  <ItemGroup>\n    <Compile Remove=\"BenchmarkDotNet.Artifacts\\**\" />\n    <EmbeddedResource Remove=\"BenchmarkDotNet.Artifacts\\**\" />\n    <None Remove=\"BenchmarkDotNet.Artifacts\\**\" />\n  </ItemGroup>\n  <ItemGroup>\n    <PackageReference Include=\"BenchmarkDotNet\" Version=\"0.15.8\" />\n    <PackageReference Include=\"coverlet.collector\" Version=\"8.0.0\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n    <PackageReference Include=\"Microsoft.AspNetCore.Mvc.Testing\" Version=\"10.0.4\" />\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"18.3.0\" />\n    <PackageReference Include=\"StyleCop.Analyzers\" Version=\"1.2.0-beta.556\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n    <PackageReference Include=\"xunit\" Version=\"2.9.3\" />\n    <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"3.1.5\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>\n    </PackageReference>\n  </ItemGroup>\n  <ItemGroup Condition=\"'$(UseProjectReference)' == 'true'\">\n    <ProjectReference Include=\"..\\..\\src\\Autofac.Extensions.DependencyInjection\\Autofac.Extensions.DependencyInjection.csproj\" />\n  </ItemGroup>\n  <ItemGroup Condition=\"'$(UseProjectReference)' != 'true' and '$(BaselinePackageVersion)' != ''\">\n    <PackageReference Include=\"Autofac.Extensions.DependencyInjection\" Version=\"$(BaselinePackageVersion)\" />\n  </ItemGroup>\n  <ItemGroup>\n    <AdditionalFiles Include=\"..\\..\\build\\stylecop.json\" Link=\"stylecop.json\" />\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/AutofacWebApplicationFactory.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.Hosting;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\npublic sealed class AutofacWebApplicationFactory<TStartup> : BenchWebApplicationFactory<TStartup>\n    where TStartup : class\n{\n    protected override IHost CreateHost(IHostBuilder builder)\n    {\n        ArgumentNullException.ThrowIfNull(builder);\n        builder.UseServiceProviderFactory(new AutofacServiceProviderFactory());\n        return base.CreateHost(builder);\n    }\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/BenchWebApplicationFactory.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.IO;\nusing System.Threading;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.AspNetCore.Mvc.Testing;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\npublic abstract class BenchWebApplicationFactory<TStartup> : WebApplicationFactory<TStartup>\n    where TStartup : class\n{\n    private static readonly Lazy<string> ContentRoot = new(ResolveContentRoot, LazyThreadSafetyMode.ExecutionAndPublication);\n\n    protected override void ConfigureWebHost(IWebHostBuilder builder)\n    {\n        ArgumentNullException.ThrowIfNull(builder);\n        base.ConfigureWebHost(builder);\n        builder.UseContentRoot(ContentRoot.Value);\n    }\n\n    private static string ResolveContentRoot() =>\n        Path.GetFullPath(Path.Combine(AppContext.BaseDirectory, \"..\", \"..\", \"..\"));\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/BenchmarkConfig.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing BenchmarkDotNet.Configs;\nusing BenchmarkDotNet.Diagnosers;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\ninternal sealed class BenchmarkConfig : ManualConfig\n{\n    private const string BenchmarkArtifactsFolder = \"BenchmarkDotNet.Artifacts\";\n\n    internal BenchmarkConfig()\n    {\n        Add(DefaultConfig.Instance);\n\n        var rootFolder = AppContext.BaseDirectory.Substring(0, AppContext.BaseDirectory.LastIndexOf(\"bin\", StringComparison.OrdinalIgnoreCase));\n        var runFolder = DateTime.Now.ToString(\"u\").Replace(' ', '_').Replace(':', '-');\n        ArtifactsPath = Path.Combine(rootFolder, BenchmarkArtifactsFolder, runFolder);\n\n        AddDiagnoser(MemoryDiagnoser.Default);\n    }\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/Benchmarks.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\npublic static class Benchmarks\n{\n    public static readonly Type[] All =\n    {\n        typeof(RequestBenchmark),\n        typeof(KeyedResolutionBenchmark),\n    };\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/DefaultWebApplicationFactory.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\npublic sealed class DefaultWebApplicationFactory<TStartup> : BenchWebApplicationFactory<TStartup>\n    where TStartup : class\n{\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/Harness.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing BenchmarkDotNet.Running;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\npublic class Harness\n{\n    [Fact]\n    public void Request() => RunBenchmark<RequestBenchmark>();\n\n    [Fact]\n    public void KeyedResolution() => RunBenchmark<KeyedResolutionBenchmark>();\n\n    /// <remarks>\n    /// This method is used to enforce that benchmark types are added to <see cref=\"Benchmarks.All\"/>\n    /// so that they can be used directly from the command line in <see cref=\"Program.Main\"/> as well.\n    /// </remarks>\n    private static void RunBenchmark<TBenchmark>()\n    {\n        var targetType = typeof(TBenchmark);\n        var benchmarkType = Benchmarks.All.Single(type => type == targetType);\n        BenchmarkRunner.Run(benchmarkType, new BenchmarkConfig());\n    }\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/KeyedResolutionBenchmark.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Diagnostics.CodeAnalysis;\nusing Microsoft.Extensions.DependencyInjection;\nusing MicrosoftServiceKey = Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\n[MemoryDiagnoser]\n[SuppressMessage(\"CA1001\", \"CA1001\", Justification = \"Benchmark disposal happens in GlobalCleanup.\")]\npublic class KeyedResolutionBenchmark\n{\n    private const string AlphaKey = \"alpha\";\n    private const string BetaKey = \"beta\";\n    private const string ServiceKeyAwareKey = \"gamma\";\n    private const string CombinedKey = \"combined\";\n\n    private AutofacServiceProvider _serviceProvider = null!;\n    private ILifetimeScope _rootScope = null!;\n\n    [GlobalSetup]\n    public void Setup()\n    {\n        var services = new ServiceCollection();\n\n        services.AddTransient<IService, DefaultService>();\n\n        services.AddKeyedTransient<IService, AlphaService>(AlphaKey);\n        services.AddKeyedTransient<IService, BetaService>(BetaKey);\n        services.AddKeyedTransient<IService, ServiceKeyAwareService>(ServiceKeyAwareKey);\n\n        services.AddTransient<FromKeyedServicesConsumer>();\n        services.AddKeyedTransient<CombinedConsumer>(CombinedKey);\n\n        var builder = new ContainerBuilder();\n        builder.Populate(services);\n\n        _rootScope = builder.Build();\n        _serviceProvider = new AutofacServiceProvider(_rootScope);\n    }\n\n    [GlobalCleanup]\n    public void Cleanup()\n    {\n        _serviceProvider.Dispose();\n    }\n\n    [Benchmark(Baseline = true)]\n    public int StandardTypedResolution()\n    {\n        return _serviceProvider.GetRequiredService<IService>().Value;\n    }\n\n    [Benchmark]\n    public int KeyedResolutionWithoutAttributes()\n    {\n        return _serviceProvider.GetRequiredKeyedService<IService>(AlphaKey).Value;\n    }\n\n    [Benchmark]\n    public int KeyedResolutionWithServiceKeyAttribute()\n    {\n        return _serviceProvider.GetRequiredKeyedService<IService>(ServiceKeyAwareKey).Value;\n    }\n\n    [Benchmark]\n    public int KeyedResolutionWithFromKeyedServicesAttribute()\n    {\n        return _serviceProvider.GetRequiredService<FromKeyedServicesConsumer>().Value;\n    }\n\n    [Benchmark]\n    public int KeyedResolutionWithBothAttributes()\n    {\n        return _serviceProvider.GetRequiredKeyedService<CombinedConsumer>(CombinedKey).Value;\n    }\n\n    [Benchmark]\n    public int KeyedResolutionWithAnyKey()\n    {\n        var result = _serviceProvider.GetKeyedServices<IService>(KeyedService.AnyKey);\n        var total = 0;\n        foreach (var service in result)\n        {\n            total += service.Value;\n        }\n\n        return total;\n    }\n\n    private interface IService\n    {\n        int Value { get; }\n    }\n\n    private sealed class DefaultService : IService\n    {\n        public int Value => 1;\n    }\n\n    private sealed class AlphaService : IService\n    {\n        public int Value => 2;\n    }\n\n    private sealed class BetaService : IService\n    {\n        public int Value => 3;\n    }\n\n    private sealed class FromKeyedServicesConsumer\n    {\n        private readonly IService _service;\n\n        public FromKeyedServicesConsumer([FromKeyedServices(BetaKey)] IService service)\n        {\n            _service = service;\n        }\n\n        public int Value => _service.Value;\n    }\n\n    private sealed class CombinedConsumer\n    {\n        private readonly IService _fromKeyedService;\n        private readonly object? _requestedKey;\n\n        public CombinedConsumer(\n            [FromKeyedServices(BetaKey)] IService fromKeyedService,\n            [MicrosoftServiceKey] object? requestedKey)\n        {\n            _fromKeyedService = fromKeyedService;\n            _requestedKey = requestedKey;\n        }\n\n        public int Value\n        {\n            get\n            {\n                var keyValue = _requestedKey is string s ? s.Length : 0;\n                return _fromKeyedService.Value + keyValue;\n            }\n        }\n    }\n\n    private sealed class ServiceKeyAwareService : IService\n    {\n        private readonly string _resolvedKey;\n\n        public ServiceKeyAwareService([MicrosoftServiceKey] string resolvedKey)\n        {\n            _resolvedKey = resolvedKey;\n        }\n\n        public int Value => _resolvedKey.Length;\n    }\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/Program.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing BenchmarkDotNet.Jobs;\nusing BenchmarkDotNet.Running;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\npublic sealed class Program\n{\n    private Program()\n    {\n    }\n\n    public static void Main(string[] args)\n    {\n        ArgumentNullException.ThrowIfNull(args);\n        var (filteredArgs, baselineVersion) = ExtractBaselineVersion(args);\n\n        // Usage:\n        //\n        // Just run the benchmark with the source code version of the project:\n        // dotnet run -c Release -p bench/Autofac.Extensions.DependencyInjection.Bench\n        //\n        // Run the benchmark comparing the source code version to a specific package version:\n        // dotnet run -c Release -p bench/Autofac.Extensions.DependencyInjection.Bench -- --baseline-version 9.0.0\n        var config = new BenchmarkConfig();\n\n        config.AddJob(\n            Job.InProcess\n                .WithId(\"Source\"));\n\n        if (!string.IsNullOrWhiteSpace(baselineVersion))\n        {\n            config.AddJob(\n                Job.Default\n                    .WithId($\"Package-{baselineVersion}\")\n                    .AsBaseline()\n                    .WithMsBuildArguments(\n                        \"/p:UseProjectReference=false\",\n                        $\"/p:BaselinePackageVersion={baselineVersion}\"));\n        }\n\n        new BenchmarkSwitcher(Benchmarks.All).Run(filteredArgs, config);\n    }\n\n    public static IHostBuilder CreateHostBuilder(string[] args) =>\n        SampleApp.Program.CreateHostBuilder(args);\n\n    private static (string[] RemainingArgs, string? BaselineVersion) ExtractBaselineVersion(string[] args)\n    {\n        var forwarded = new List<string>(args.Length);\n        string? baseline = null;\n\n        for (var i = 0; i < args.Length; i++)\n        {\n            var arg = args[i];\n            if (TryMatchBaselineArg(arg, out var inlineVersion))\n            {\n                if (!string.IsNullOrWhiteSpace(inlineVersion))\n                {\n                    baseline = inlineVersion;\n                    continue;\n                }\n\n                if (i + 1 >= args.Length)\n                {\n                    throw new ArgumentException(\"Missing version value for baseline argument.\", nameof(args));\n                }\n\n                baseline = args[++i];\n                continue;\n            }\n\n            forwarded.Add(arg);\n        }\n\n        return (forwarded.ToArray(), baseline);\n    }\n\n    private static bool TryMatchBaselineArg(string arg, out string? valueFromAssignment)\n    {\n        valueFromAssignment = null;\n\n        static bool Matches(string candidate) =>\n            candidate.Equals(\"--baseline-version\", StringComparison.OrdinalIgnoreCase) ||\n            candidate.Equals(\"--baselineVersion\", StringComparison.OrdinalIgnoreCase);\n\n        var equalsIndex = arg.AsSpan().IndexOf('=');\n        if (equalsIndex >= 0)\n        {\n            var prefix = arg[..equalsIndex];\n            if (Matches(prefix))\n            {\n                valueFromAssignment = arg[(equalsIndex + 1)..];\n                return true;\n            }\n\n            return false;\n        }\n\n        return Matches(arg);\n    }\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\n[assembly: CLSCompliant(false)]\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/RequestBenchmark.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Diagnostics.CodeAnalysis;\nusing System.Net;\nusing Microsoft.AspNetCore.Mvc.Testing;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench;\n\n[SuppressMessage(\"CA1001\", \"CA1001\", Justification = \"Benchmark disposal happens in a global cleanup method.\")]\npublic class RequestBenchmark\n{\n    private static readonly Uri ValuesUri = new(\"/api/values\", UriKind.Relative);\n    private WebApplicationFactory<Program> _defaultFactory = null!;\n    private WebApplicationFactory<Program> _autofacFactory = null!;\n    private HttpClient _defaultClient = null!;\n    private HttpClient _autofacClient = null!;\n\n    [GlobalSetup]\n    public void Setup()\n    {\n        _defaultFactory = new DefaultWebApplicationFactory<Program>();\n        _autofacFactory = new AutofacWebApplicationFactory<Program>();\n\n        _defaultClient = _defaultFactory.CreateClient();\n        _autofacClient = _autofacFactory.CreateClient();\n    }\n\n    [GlobalCleanup]\n    public void Cleanup()\n    {\n        _defaultFactory.Dispose();\n        _autofacFactory.Dispose();\n    }\n\n    [Benchmark(Baseline = true)]\n    public async Task RequestDefaultDI()\n    {\n        var response = await _defaultClient.GetAsync(ValuesUri).ConfigureAwait(false);\n\n        if (response.StatusCode != HttpStatusCode.OK)\n        {\n            throw new HttpRequestException();\n        }\n    }\n\n    [Benchmark]\n    public async Task RequestAutofacDI()\n    {\n        var response = await _autofacClient.GetAsync(ValuesUri).ConfigureAwait(false);\n\n        if (response.StatusCode != HttpStatusCode.OK)\n        {\n            throw new HttpRequestException();\n        }\n    }\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/SampleApp/Controllers/ValuesController.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench.SampleApp.Controllers;\n\n[Route(\"api/[controller]\")]\n[ApiController]\npublic class ValuesController : ControllerBase\n{\n    private readonly A _service;\n\n    public ValuesController(A service)\n    {\n        _service = service;\n    }\n\n    [HttpGet]\n    public IActionResult Get()\n    {\n        return Ok(200);\n    }\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/SampleApp/DefaultStartup.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.AspNetCore.Builder;\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Configuration;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Hosting;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench.SampleApp;\n\npublic class DefaultStartup\n{\n    public DefaultStartup(IConfiguration configuration)\n    {\n        Configuration = configuration;\n    }\n\n    public IConfiguration Configuration { get; }\n\n    public void ConfigureServices(IServiceCollection services)\n    {\n        services.AddControllers();\n\n        services.AddTransient<A>();\n        services.AddTransient<B1>();\n        services.AddTransient<B2>();\n        services.AddTransient<C1>();\n        services.AddTransient<C2>();\n        services.AddTransient<D1>();\n        services.AddTransient<D2>();\n    }\n\n    public void Configure(IApplicationBuilder app, IWebHostEnvironment env)\n    {\n        if (env.IsDevelopment())\n        {\n            app.UseDeveloperExceptionPage();\n        }\n\n        app.UseRouting();\n        app.UseAuthorization();\n\n        app.UseEndpoints(endpoints =>\n        {\n            endpoints.MapControllers();\n        });\n    }\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/SampleApp/Program.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.AspNetCore.Hosting;\nusing Microsoft.Extensions.Hosting;\nusing Microsoft.Extensions.Logging;\n\nnamespace Autofac.Extensions.DependencyInjection.Bench.SampleApp;\n\npublic sealed class Program\n{\n    private Program()\n    {\n    }\n\n    public static IHostBuilder CreateHostBuilder(string[] args) =>\n        Host.CreateDefaultBuilder(args)\n            .ConfigureLogging(logging =>\n            {\n                logging.SetMinimumLevel(LogLevel.Warning);\n            })\n            .ConfigureWebHostDefaults(webBuilder =>\n            {\n                webBuilder.UseStartup<DefaultStartup>();\n            });\n}\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/SampleApp/Services.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\n#pragma warning disable SA1402, SA1649\n\nnamespace Autofac.Extensions.DependencyInjection.Bench.SampleApp;\n\npublic class A\n{\n    public A(B1 b1, B2 b2)\n    {\n    }\n}\n\npublic class B1\n{\n    public B1(B2 b2, C1 c1, C2 c2)\n    {\n    }\n}\n\npublic class B2\n{\n    public B2(C1 c1, C2 c2)\n    {\n    }\n}\n\npublic class C1\n{\n    public C1(C2 c2, D1 d1, D2 d2)\n    {\n    }\n}\n\npublic class C2\n{\n    public C2(D1 d1, D2 d2)\n    {\n    }\n}\n\npublic class D1\n{\n}\n\npublic class D2\n{\n}\n\n#pragma warning restore SA1402, SA1649\n"
  },
  {
    "path": "bench/Autofac.Extensions.DependencyInjection.Bench/xunit.runner.json",
    "content": "{\n  \"shadowCopy\": false\n}\n"
  },
  {
    "path": "build/Coverage.runsettings",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<RunSettings>\n  <DataCollectionRunSettings>\n    <DataCollectors>\n      <DataCollector friendlyName=\"XPlat Code Coverage\">\n        <Configuration>\n          <Format>cobertura</Format>\n          <Exclude>[System.*]*</Exclude>\n          <ExcludeByFile>**/LoggerMessage.g.cs</ExcludeByFile>\n          <ExcludeByAttribute>GeneratedCodeAttribute</ExcludeByAttribute>\n          <UseSourceLink>false</UseSourceLink>\n          <SkipAutoProps>true</SkipAutoProps>\n          <DeterministicReport>false</DeterministicReport>\n        </Configuration>\n      </DataCollector>\n    </DataCollectors>\n  </DataCollectionRunSettings>\n</RunSettings>\n"
  },
  {
    "path": "build/Source.ruleset",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RuleSet Name=\"Autofac Analyzer Rules\" Description=\"Analyzer rules for Autofac assemblies.\" ToolsVersion=\"16.0\">\n  <IncludeAll Action=\"Warning\" />\n  <Rules AnalyzerId=\"Microsoft.Usage\" RuleNamespace=\"Microsoft.Usage\">\n    <!-- Implement standard exception constructors - not all of the exception constructors (e.g., parameterless) are desired in our system. -->\n    <Rule Id=\"CA1032\" Action=\"None\" />\n    <!-- Avoid excessive inheritance (must be explicitly enabled). -->\n    <Rule Id=\"CA1501\" Action=\"Warning\" />\n    <!-- Avoid excessive complexity (must be explicitly enabled). -->\n    <Rule Id=\"CA1502\" Action=\"Warning\" />\n    <!-- Avoid unmaintainable code (must be explicitly enabled). -->\n    <Rule Id=\"CA1505\" Action=\"Warning\" />\n    <!-- Avoid excessive class coupling (must be explicitly enabled). -->\n    <Rule Id=\"CA1506\" Action=\"Warning\" />\n    <!-- Use ArgumentNullException.ThrowIfNull - this isn't available until we stop targeting netstandard. -->\n    <Rule Id=\"CA1510\" Action=\"None\" />\n    <!-- Use ArgumentOutOfRangeException.ThrowIfNegative - this isn't available until we stop targeting anything below net8.0. -->\n    <Rule Id=\"CA1512\" Action=\"None\" />\n    <!-- Use ObjectDisposedException.ThrowIf - this isn't available until we stop targeting anything below net8.0. -->\n    <Rule Id=\"CA1513\" Action=\"None\" />\n    <!-- Change names to avoid reserved word overlaps (e.g., Delegate, GetType, etc.) - too many of these in the public API, we'd break if we fixed it. -->\n    <Rule Id=\"CA1716\" Action=\"None\" />\n    <!-- Cache a CompositeFormat object for use in String.Format - this isn't available until we stop targeting netstandard, and we only String.Format when throwing exceptions so the work/complexity isn't justified to increase perf just for those situations. -->\n    <Rule Id=\"CA1863\" Action=\"None\" />\n    <!-- Implement serialization constructors - false positive when building .NET Core. -->\n    <Rule Id=\"CA2229\" Action=\"None\" />\n    <!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core. -->\n    <Rule Id=\"CA2237\" Action=\"None\" />\n  </Rules>\n  <Rules AnalyzerId=\"StyleCop.Analyzers\" RuleNamespace=\"StyleCop.Analyzers\">\n    <!-- Prefix local calls with this. -->\n    <Rule Id=\"SA1101\" Action=\"None\" />\n    <!-- Use built-in type alias. -->\n    <Rule Id=\"SA1121\" Action=\"None\" />\n    <!-- Use String.Empty instead of \"\". -->\n    <Rule Id=\"SA1122\" Action=\"None\" />\n    <!-- Fields can't start with underscore. -->\n    <Rule Id=\"SA1309\" Action=\"None\" />\n  </Rules>\n</RuleSet>\n"
  },
  {
    "path": "build/Test.ruleset",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<RuleSet Name=\"Autofac Analyzer Rules\" Description=\"Analyzer rules for Autofac assemblies.\" ToolsVersion=\"16.0\">\n  <IncludeAll Action=\"Warning\" />\n  <Rules AnalyzerId=\"Microsoft.Usage\" RuleNamespace=\"Microsoft.Usage\">\n    <!-- Avoid excessive parameters on generic types (must be explicitly enabled). -->\n    <Rule Id=\"CA1005\" Action=\"Warning\" />\n    <!-- Don't catch general exceptions - test scenarios sometimes require general exception handling. -->\n    <Rule Id=\"CA1031\" Action=\"None\" />\n    <!-- Implement standard exception constructors - not all of the exception constructors (e.g., parameterless) are desired in our system. -->\n    <Rule Id=\"CA1032\" Action=\"None\" />\n    <!-- Avoid empty interfaces - in unit tests for service resolution, this happens a lot. -->\n    <Rule Id=\"CA1040\" Action=\"None\" />\n    <!-- Do not pass literals as localized parameters  - tests don't need to localize. -->\n    <Rule Id=\"CA1303\" Action=\"None\" />\n    <!-- Avoid excessive inheritance (must be explicitly enabled). -->\n    <Rule Id=\"CA1501\" Action=\"Warning\" />\n    <!-- Avoid excessive complexity (must be explicitly enabled). -->\n    <Rule Id=\"CA1502\" Action=\"Warning\" />\n    <!-- Avoid unmaintainable code (must be explicitly enabled). -->\n    <Rule Id=\"CA1505\" Action=\"Warning\" />\n    <!-- Avoid excessive class coupling (must be explicitly enabled). -->\n    <Rule Id=\"CA1506\" Action=\"Warning\" />\n    <!-- Use ArgumentNullException.ThrowIfNull - this isn't available until we stop targeting netstandard. -->\n    <Rule Id=\"CA1510\" Action=\"None\" />\n    <!-- Make API types internal - causes problems with tests and test assemblies. -->\n    <Rule Id=\"CA1515\" Action=\"None\" />\n    <!-- Remove the underscores from member name - unit test scenarios may use underscores. -->\n    <Rule Id=\"CA1707\" Action=\"None\" />\n    <!-- Change names to avoid reserved word overlaps (e.g., Delegate, GetType, etc.) - too many of these in the public API, we'd break if we fixed it. -->\n    <Rule Id=\"CA1716\" Action=\"None\" />\n    <!-- Internal class that appears to never be instantiated - lots of false positives here because they're test stubs created by Autofac registrations. -->\n    <Rule Id=\"CA1812\" Action=\"None\" />\n    <!-- Change Dispose() to call GC.SuppressFinalize - in tests we don't really care and it can impact readability. -->\n    <Rule Id=\"CA1816\" Action=\"None\" />\n    <!-- Mark members static - test methods may not access member data but also can't be static. -->\n    <Rule Id=\"CA1822\" Action=\"None\" />\n    <!-- Seal internal types for performance - in tests we don't really care and it gets painful to enforce. -->\n    <Rule Id=\"CA1852\" Action=\"None\" />\n    <!-- Prefer static readonly fields over constant array arguments - constant array arguments happen a lot in unit tests for assertions and test setup. -->\n    <Rule Id=\"CA1861\" Action=\"None\" />\n    <!-- Cache a CompositeFormat object for use in String.Format - this makes unit tests harder to read, and performance isn't an issue. -->\n    <Rule Id=\"CA1863\" Action=\"None\" />\n    <!-- Call ConfigureAwait on tasks - you shouldn't do this in unit test libraries; XUnit has an opposite analyzer. -->\n    <Rule Id=\"CA2007\" Action=\"None\" />\n    <!-- Implement serialization constructors - false positive when building .NET Core. -->\n    <Rule Id=\"CA2229\" Action=\"None\" />\n    <!-- Use Uri instead of string parameters - strings are easier for testing. -->\n    <Rule Id=\"CA2234\" Action=\"None\" />\n    <!-- Mark ISerializable types with SerializableAttribute - false positive when building .NET Core. -->\n    <Rule Id=\"CA2237\" Action=\"None\" />\n  </Rules>\n  <Rules AnalyzerId=\"StyleCop.Analyzers\" RuleNamespace=\"StyleCop.Analyzers\">\n    <!-- Prefix local calls with this. -->\n    <Rule Id=\"SA1101\" Action=\"None\" />\n    <!-- Use built-in type alias. -->\n    <Rule Id=\"SA1121\" Action=\"None\" />\n    <!-- Use String.Empty instead of \"\". -->\n    <Rule Id=\"SA1122\" Action=\"None\" />\n    <!-- Enforce order of class members by member type - sometimes putting test classes/data by the test helps. -->\n    <Rule Id=\"SA1201\" Action=\"None\" />\n    <!-- Enforce order of class members by member visibility - sometimes putting test classes/data by the test helps. -->\n    <Rule Id=\"SA1202\" Action=\"None\" />\n    <!-- Enforce order of static vs. non-static members - sometimes putting test classes/data by the test helps. -->\n    <Rule Id=\"SA1204\" Action=\"None\" />\n    <!-- Fields can't start with underscore. -->\n    <Rule Id=\"SA1309\" Action=\"None\" />\n    <!-- Elements should be documented. -->\n    <Rule Id=\"SA1600\" Action=\"None\" />\n    <!-- Partial items should be documented. -->\n    <Rule Id=\"SA1601\" Action=\"None\" />\n    <!-- Enumeration items should be documented. -->\n    <Rule Id=\"SA1602\" Action=\"None\" />\n    <!-- Parameter should be documented. -->\n    <Rule Id=\"SA1611\" Action=\"None\" />\n    <!-- Parameter documentation must be in the right order. -->\n    <Rule Id=\"SA1612\" Action=\"None\" />\n    <!-- Return value must be documented. -->\n    <Rule Id=\"SA1615\" Action=\"None\" />\n    <!-- Generic type parameters must be documented. -->\n    <Rule Id=\"SA1618\" Action=\"None\" />\n    <!-- Don't copy/paste documentation. -->\n    <Rule Id=\"SA1625\" Action=\"None\" />\n    <!-- Private member is unused - tests for reflection require members that may not get used. -->\n    <Rule Id=\"IDE0051\" Action=\"None\" />\n    <!-- Private member assigned value never read - tests for reflection require values that may not get used. -->\n    <Rule Id=\"IDE0052\" Action=\"None\" />\n    <!-- Remove unused parameter - tests for reflection require parameters that may not get used. -->\n    <Rule Id=\"IDE0060\" Action=\"None\" />\n  </Rules>\n</RuleSet>\n"
  },
  {
    "path": "build/stylecop.json",
    "content": "{\n  \"$schema\": \"https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json\",\n  \"settings\": {\n    \"documentationRules\": {\n      \"companyName\": \"Autofac Project\",\n      \"copyrightText\": \"Copyright (c) {companyName}. All rights reserved.\\nLicensed under the {licenseName} License. See {licenseFile} in the project root for license information.\",\n      \"variables\": {\n        \"licenseFile\": \"LICENSE\",\n        \"licenseName\": \"MIT\"\n      },\n      \"xmlHeader\": false\n    }\n  }\n}\n"
  },
  {
    "path": "codecov.yml",
    "content": "codecov:\r\n  branch: develop\r\n  require_ci_to_pass: true\r\ncoverage:\r\n  status:\r\n    project:\r\n      default:\r\n        threshold: 1%\r\n"
  },
  {
    "path": "default.proj",
    "content": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project DefaultTargets=\"All\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\" ToolsVersion=\"Current\">\n  <PropertyGroup>\n    <!-- Increment the overall semantic version here. -->\n    <Version>11.0.0</Version>\n    <SolutionName>Autofac.Extensions.DependencyInjection</SolutionName>\n    <Configuration Condition=\"'$(Configuration)'==''\">Release</Configuration>\n    <ArtifactDirectory>$([System.IO.Path]::Combine($(MSBuildProjectDirectory),\"artifacts\"))</ArtifactDirectory>\n    <PackageDirectory>$([System.IO.Path]::Combine($(ArtifactDirectory),\"packages\"))</PackageDirectory>\n    <LogDirectory>$([System.IO.Path]::Combine($(ArtifactDirectory),\"logs\"))</LogDirectory>\n    <CoverageRunSettings>$([System.IO.Path]::Combine($(MSBuildProjectDirectory),'build/Coverage.runsettings'))</CoverageRunSettings>\n    <BuildDateTime>$([System.DateTimeOffset]::UtcNow.ToString('yyyyMMddTHHmmssZ'))</BuildDateTime>\n  </PropertyGroup>\n  <Choose>\n    <When Condition=\"'$(GITHUB_REF_NAME)'==''\">\n      <PropertyGroup>\n        <Version>$(Version)-local</Version>\n      </PropertyGroup>\n    </When>\n    <When Condition=\"'$(GITHUB_REF_NAME)'=='master' Or $([System.Text.RegularExpressions.Regex]::IsMatch($(GITHUB_REF_NAME), `^v.+\\..+\\..+`))\">\n      <PropertyGroup>\n        <Version>$(Version)</Version>\n      </PropertyGroup>\n    </When>\n    <When Condition=\"'$(GITHUB_REF_NAME)'=='develop'\">\n      <PropertyGroup>\n        <Version>$(Version)-beta$(BuildDateTime)</Version>\n      </PropertyGroup>\n    </When>\n    <Otherwise>\n      <PropertyGroup>\n        <Version>$(Version)-alpha$(BuildDateTime)</Version>\n      </PropertyGroup>\n    </Otherwise>\n  </Choose>\n  <ItemGroup>\n    <CleanDirectory Include=\"$(ArtifactDirectory)\" />\n    <SourceProject Include=\"$(MSBuildProjectDirectory)/src/**/*.csproj\" />\n    <TestProject Include=\"$(MSBuildProjectDirectory)/test/**/*.csproj\" />\n    <SolutionFile Include=\"$(SolutionName).sln\" />\n  </ItemGroup>\n  <Target Name=\"All\">\n    <Message Text=\"****************************************\" Importance=\"high\" />\n    <Message Text=\"$(SolutionName) v$(Version)\" Importance=\"high\" />\n    <Message Text=\"$(Configuration) Configuration\" Importance=\"high\" />\n    <Message Text=\"$(BuildDateTime)\" Importance=\"high\" />\n    <Message Text=\"****************************************\" Importance=\"high\" />\n    <CallTarget Targets=\"Clean;Compile;Test;Package\" />\n  </Target>\n  <Target Name=\"Benchmarks\" DependsOnTargets=\"Compile\">\n    <Message Text=\"****************************************\" Importance=\"high\" />\n    <Message Text=\"Running Benchmarks\" Importance=\"high\" />\n    <Message Text=\"****************************************\" Importance=\"high\" />\n    <Exec Command=\"dotnet run --project &quot;$([System.IO.Path]::Combine($(MSBuildProjectDirectory),'bench/Autofac.Extensions.DependencyInjection.Bench'))&quot; -c $(Configuration) --no-launch-profile --no-restore --no-build -- --filter Autofac.Extensions.DependencyInjection.Bench.*\" />\n  </Target>\n  <Target Name=\"Clean\">\n    <RemoveDir Directories=\"@(CleanDirectory)\" />\n    <RemoveDir Directories=\"%(SourceProject.RootDir)%(SourceProject.Directory)bin;%(SourceProject.RootDir)%(SourceProject.Directory)obj\" />\n    <RemoveDir Directories=\"%(TestProject.RootDir)%(TestProject.Directory)bin;%(TestProject.RootDir)%(TestProject.Directory)obj\" />\n  </Target>\n  <Target Name=\"Compile\">\n    <Exec Command=\"dotnet --info\" />\n    <Exec Command=\"dotnet build &quot;%(SolutionFile.FullPath)&quot; -c $(Configuration) /p:Version=$(Version)\" />\n  </Target>\n  <Target Name=\"Package\">\n    <MakeDir Directories=\"$([System.IO.Path]::Combine($(PackageDirectory),%(PublishProject.Filename)))\" />\n    <Exec Command=\"dotnet pack &quot;%(SolutionFile.FullPath)&quot; -c $(Configuration) --output &quot;$(PackageDirectory)&quot; /p:Version=$(Version)\" />\n  </Target>\n  <Target Name=\"Test\">\n    <MakeDir Directories=\"$(LogDirectory)\" />\n    <Exec Command=\"dotnet test &quot;%(SolutionFile.FullPath)&quot; -c $(Configuration) --results-directory &quot;$(LogDirectory)&quot; --logger:trx /p:Version=$(Version) --collect:&quot;XPlat Code Coverage&quot; --settings &quot;$(CoverageRunSettings)&quot;\" />\n  </Target>\n</Project>\n"
  },
  {
    "path": "global.json",
    "content": "{\n  \"sdk\": {\n    \"rollForward\": \"latestFeature\",\n    \"version\": \"10.0.100\"\n  }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/Autofac.Extensions.DependencyInjection.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n  <PropertyGroup>\n    <!-- Assembly metadata -->\n    <AssemblyName>Autofac.Extensions.DependencyInjection</AssemblyName>\n    <AssemblyTitle>Autofac.Extensions.DependencyInjection</AssemblyTitle>\n    <Description>Autofac implementation of the interfaces in Microsoft.Extensions.DependencyInjection.Abstractions, the .NET Framework dependency injection abstraction.</Description>\n    <Copyright>Copyright © 2015 Autofac Contributors</Copyright>\n    <Authors>Autofac Contributors</Authors>\n    <Company>Autofac</Company>\n    <Product>Autofac</Product>\n    <AssemblyOriginatorKeyFile>../../Autofac.snk</AssemblyOriginatorKeyFile>\n    <SignAssembly>true</SignAssembly>\n    <NeutralLanguage>en-US</NeutralLanguage>\n    <!-- Frameworks and language features -->\n    <TargetFrameworks>net10.0;net8.0;netstandard2.1;netstandard2.0</TargetFrameworks>\n    <LangVersion>latest</LangVersion>\n    <Nullable>enable</Nullable>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <CodeAnalysisRuleSet>../../build/Source.ruleset</CodeAnalysisRuleSet>\n    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>\n    <AnalysisMode>AllEnabledByDefault</AnalysisMode>\n    <ImplicitUsings>enable</ImplicitUsings>\n    <!-- Packaging -->\n    <PackageId>Autofac.Extensions.DependencyInjection</PackageId>\n    <PackageTags>autofac;di;ioc;dependencyinjection;aspnet;aspnetcore</PackageTags>\n    <PackageReleaseNotes>Release notes are at https://github.com/autofac/Autofac.Extensions.DependencyInjection/releases</PackageReleaseNotes>\n    <PackageIcon>icon.png</PackageIcon>\n    <PackageProjectUrl>https://autofac.org</PackageProjectUrl>\n    <PackageLicenseExpression>MIT</PackageLicenseExpression>\n    <PackageReadmeFile>README.md</PackageReadmeFile>\n    <RepositoryType>git</RepositoryType>\n    <RepositoryUrl>https://github.com/autofac/Autofac.Extensions.DependencyInjection</RepositoryUrl>\n    <ContinuousIntegrationBuild Condition=\"'$(CI)' != '' \">true</ContinuousIntegrationBuild>\n    <PublishRepositoryUrl>true</PublishRepositoryUrl>\n    <EmbedAllSources>true</EmbedAllSources>\n    <IncludeSymbols>true</IncludeSymbols>\n    <SymbolPackageFormat>snupkg</SymbolPackageFormat>\n    <!-- OmniSharp/VS Code resource generation -->\n    <CoreCompileDependsOn>PrepareResources;$(CompileDependsOn)</CoreCompileDependsOn>\n  </PropertyGroup>\n  <ItemGroup>\n    <Using Include=\"System.Diagnostics.CodeAnalysis\" />\n  </ItemGroup>\n  <!-- Disable nullability warnings in netstandard2.0 -->\n  <PropertyGroup Condition=\"'$(TargetFramework)' == 'netstandard2.0'\">\n    <NoWarn>$(NoWarn);8765;8600;8601;8602;8603;8604</NoWarn>\n  </PropertyGroup>\n  <ItemGroup>\n    <None Include=\"..\\..\\build\\icon.png\" Pack=\"true\" PackagePath=\"\\\" />\n    <None Include=\"..\\..\\README.md\" Pack=\"true\" PackagePath=\"\\\" />\n  </ItemGroup>\n  <ItemGroup>\n    <AdditionalFiles Include=\"..\\..\\build\\stylecop.json\" Link=\"stylecop.json\" />\n  </ItemGroup>\n  <ItemGroup>\n    <PackageReference Include=\"Autofac\" Version=\"9.1.0\" />\n    <PackageReference Include=\"Microsoft.SourceLink.GitHub\" Version=\"10.0.103\" Condition=\"Exists('$(MSBuildThisFileDirectory)../../.git')\">\n      <PrivateAssets>all</PrivateAssets>\n    </PackageReference>\n    <PackageReference Include=\"StyleCop.Analyzers\" Version=\"1.2.0-beta.556\">\n      <PrivateAssets>all</PrivateAssets>\n    </PackageReference>\n    <PackageReference Include=\"Microsoft.Extensions.DependencyInjection.Abstractions\" Version=\"10.0.4\" />\n  </ItemGroup>\n  <ItemDefinitionGroup>\n    <EmbeddedResource>\n      <Generator>MSBuild:Compile</Generator>\n      <StronglyTypedLanguage>CSharp</StronglyTypedLanguage>\n      <StronglyTypedFileName>$(IntermediateOutputPath)%(Filename).Designer.cs</StronglyTypedFileName>\n      <StronglyTypedClassName>%(Filename)</StronglyTypedClassName>\n    </EmbeddedResource>\n  </ItemDefinitionGroup>\n  <ItemGroup>\n    <EmbeddedResource Update=\"KeyTypeConversionExceptionResources.resx\">\n      <StronglyTypedNamespace>Autofac.Extensions.DependencyInjection</StronglyTypedNamespace>\n    </EmbeddedResource>\n    <EmbeddedResource Update=\"KeyTypeManipulationResources.resx\">\n      <StronglyTypedNamespace>Autofac.Extensions.DependencyInjection</StronglyTypedNamespace>\n    </EmbeddedResource>\n    <EmbeddedResource Update=\"ServiceProviderExtensionsResources.resx\">\n      <StronglyTypedNamespace>Autofac.Extensions.DependencyInjection</StronglyTypedNamespace>\n    </EmbeddedResource>\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/AutofacChildLifetimeScopeConfigurationAdapter.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Configuration adapter for <see cref=\"AutofacChildLifetimeScopeServiceProviderFactory\" />.\n/// </summary>\npublic class AutofacChildLifetimeScopeConfigurationAdapter\n{\n    private readonly List<Action<ContainerBuilder>> _configurationActions = new();\n\n    /// <summary>\n    /// Gets the list of configuration actions to be executed on the <see cref=\"ContainerBuilder\"/> for the child <see cref=\"ILifetimeScope\"/>.\n    /// </summary>\n    public IReadOnlyList<Action<ContainerBuilder>> ConfigurationActions => _configurationActions;\n\n    /// <summary>\n    /// Adds a configuration action that will be executed when the child <see cref=\"ILifetimeScope\"/> is created.\n    /// </summary>\n    /// <param name=\"configurationAction\">Action on a <see cref=\"ContainerBuilder\"/> that adds component registrations to the container.</param>\n    /// <exception cref=\"ArgumentNullException\">Throws when the passed configuration-action is null.</exception>\n    public void Add(Action<ContainerBuilder> configurationAction)\n    {\n        if (configurationAction == null)\n        {\n            throw new ArgumentNullException(nameof(configurationAction));\n        }\n\n        _configurationActions.Add(configurationAction);\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/AutofacChildLifetimeScopeServiceProviderFactory.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// A factory for creating a <see cref=\"IServiceProvider\"/> that wraps a child <see cref=\"ILifetimeScope\"/> created from an existing parent <see cref=\"ILifetimeScope\"/>.\n/// </summary>\npublic class AutofacChildLifetimeScopeServiceProviderFactory : IServiceProviderFactory<AutofacChildLifetimeScopeConfigurationAdapter>\n{\n    private static readonly Action<ContainerBuilder> FallbackConfigurationAction = builder => { };\n    private readonly Action<ContainerBuilder> _containerConfigurationAction;\n    private readonly ILifetimeScope _rootLifetimeScope;\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"AutofacChildLifetimeScopeServiceProviderFactory\"/> class.\n    /// </summary>\n    /// <param name=\"rootLifetimeScopeAccessor\">A function to retrieve the root <see cref=\"ILifetimeScope\"/> instance.</param>\n    /// <param name=\"configurationAction\">Action on a <see cref=\"ContainerBuilder\"/> that adds component registrations to the container.</param>\n    public AutofacChildLifetimeScopeServiceProviderFactory(Func<ILifetimeScope> rootLifetimeScopeAccessor, Action<ContainerBuilder>? configurationAction = null)\n    {\n        if (rootLifetimeScopeAccessor == null)\n        {\n            throw new ArgumentNullException(nameof(rootLifetimeScopeAccessor));\n        }\n\n        _rootLifetimeScope = rootLifetimeScopeAccessor();\n        _containerConfigurationAction = configurationAction ?? FallbackConfigurationAction;\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"AutofacChildLifetimeScopeServiceProviderFactory\"/> class.\n    /// </summary>\n    /// <param name=\"rootLifetimeScope\">The root <see cref=\"ILifetimeScope\"/> instance.</param>\n    /// <param name=\"configurationAction\">Action on a <see cref=\"ContainerBuilder\"/> that adds component registrations to the container.</param>\n    public AutofacChildLifetimeScopeServiceProviderFactory(ILifetimeScope rootLifetimeScope, Action<ContainerBuilder>? configurationAction = null)\n    {\n        _rootLifetimeScope = rootLifetimeScope ?? throw new ArgumentNullException(nameof(rootLifetimeScope));\n        _containerConfigurationAction = configurationAction ?? FallbackConfigurationAction;\n    }\n\n    /// <summary>\n    /// Creates a container builder from an <see cref=\"IServiceCollection\" />.\n    /// </summary>\n    /// <param name=\"services\">The collection of services.</param>\n    /// <returns>A container builder that can be used to create an <see cref=\"IServiceProvider\" />.</returns>\n    public AutofacChildLifetimeScopeConfigurationAdapter CreateBuilder(IServiceCollection services)\n    {\n        var actions = new AutofacChildLifetimeScopeConfigurationAdapter();\n\n        actions.Add(builder => builder.Populate(services));\n        actions.Add(builder => _containerConfigurationAction(builder));\n\n        return actions;\n    }\n\n    /// <summary>\n    /// Creates an <see cref=\"IServiceProvider\" /> from the container builder.\n    /// </summary>\n    /// <param name=\"containerBuilder\">The adapter holding configuration applied to <see cref=\"ContainerBuilder\"/> creating the <see cref=\"IServiceProvider\"/>.</param>\n    /// <returns>An <see cref=\"IServiceProvider\" />.</returns>\n    public IServiceProvider CreateServiceProvider(AutofacChildLifetimeScopeConfigurationAdapter containerBuilder)\n    {\n        if (containerBuilder == null)\n        {\n            throw new ArgumentNullException(nameof(containerBuilder));\n        }\n\n        var scope = _rootLifetimeScope.BeginLifetimeScope(scopeBuilder =>\n        {\n            foreach (var action in containerBuilder.ConfigurationActions)\n            {\n                action(scopeBuilder);\n            }\n        });\n\n        return new AutofacServiceProvider(scope);\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/AutofacRegistration.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\nusing System.Reflection;\nusing Autofac.Builder;\nusing Autofac.Core;\nusing Autofac.Core.Activators;\nusing Autofac.Core.Activators.Delegate;\nusing Autofac.Core.Activators.Reflection;\nusing Autofac.Core.Resolving.Pipeline;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Extension methods for registering ASP.NET Core dependencies with Autofac.\n/// </summary>\npublic static class AutofacRegistration\n{\n    /// <summary>\n    /// Populates the Autofac container builder with the set of registered service descriptors\n    /// and makes <see cref=\"IServiceProvider\"/> and <see cref=\"IServiceScopeFactory\"/>\n    /// available in the container.\n    /// </summary>\n    /// <param name=\"builder\">\n    /// The <see cref=\"ContainerBuilder\"/> into which the registrations should be made.\n    /// </param>\n    /// <param name=\"descriptors\">\n    /// The set of service descriptors to register in the container.\n    /// </param>\n    public static void Populate(\n        this ContainerBuilder builder,\n        IEnumerable<ServiceDescriptor> descriptors)\n    {\n        Populate(builder, descriptors, null);\n    }\n\n    /// <summary>\n    /// Populates the Autofac container builder with the set of registered service descriptors\n    /// and makes <see cref=\"IServiceProvider\"/> and <see cref=\"IServiceScopeFactory\"/>\n    /// available in the container. Using this overload is incompatible with the ASP.NET Core\n    /// support for <see cref=\"IServiceProviderFactory{TContainerBuilder}\"/>.\n    /// </summary>\n    /// <param name=\"builder\">\n    /// The <see cref=\"ContainerBuilder\"/> into which the registrations should be made.\n    /// </param>\n    /// <param name=\"descriptors\">\n    /// The set of service descriptors to register in the container.\n    /// </param>\n    /// <param name=\"lifetimeScopeTagForSingletons\">\n    /// If provided and not <see langword=\"null\"/> then all registrations with lifetime <see cref=\"ServiceLifetime.Singleton\" /> are registered\n    /// using <see cref=\"IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.InstancePerMatchingLifetimeScope\" />\n    /// with provided <paramref name=\"lifetimeScopeTagForSingletons\"/>\n    /// instead of using <see cref=\"IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.SingleInstance\"/>.\n    /// </param>\n    /// <remarks>\n    /// <para>\n    /// Specifying a <paramref name=\"lifetimeScopeTagForSingletons\"/> addresses a specific case where you have\n    /// an application that uses Autofac but where you need to isolate a set of services in a child scope. For example,\n    /// if you have a large application that self-hosts ASP.NET Core items, you may want to isolate the ASP.NET\n    /// Core registrations in a child lifetime scope so they don't show up for the rest of the application.\n    /// This overload allows that. Note it is the developer's responsibility to execute this and create an\n    /// <see cref=\"AutofacServiceProvider\"/> using the child lifetime scope.\n    /// </para>\n    /// </remarks>\n    public static void Populate(\n        this ContainerBuilder builder,\n        IEnumerable<ServiceDescriptor> descriptors,\n        object? lifetimeScopeTagForSingletons)\n    {\n        if (descriptors is null)\n        {\n            throw new ArgumentNullException(nameof(descriptors));\n        }\n\n        if (builder is null)\n        {\n            throw new ArgumentNullException(nameof(builder));\n        }\n\n        builder.RegisterType<AutofacServiceProvider>()\n               .As<IServiceProvider>()\n               .As<IServiceProviderIsService>()\n               .As<IKeyedServiceProvider>()\n               .As<IServiceProviderIsKeyedService>()\n               .ExternallyOwned();\n\n        // Issue #83: IServiceScopeFactory must be a singleton and scopes must be flat, not hierarchical.\n        builder\n            .RegisterType<AutofacServiceScopeFactory>()\n            .As<IServiceScopeFactory>()\n            .SingleInstance();\n\n        // Shims for keyed service compatibility.\n        builder.ComponentRegistryBuilder.Registered += AddFromKeyedServiceParameterMiddleware;\n\n        Register(builder, descriptors, lifetimeScopeTagForSingletons);\n    }\n\n    /// <summary>\n    /// Inspect each component registration, and determine whether or not we can avoid adding the\n    /// <see cref=\"FromKeyedServicesAttribute\"/> parameter to the resolve pipeline.\n    /// </summary>\n    private static void AddFromKeyedServiceParameterMiddleware(object? sender, ComponentRegisteredEventArgs e)\n    {\n        var needFromKeyedServiceParameter = false;\n\n        // We can optimize quite significantly in the case where we are using\n        // the reflection activator. In that state we can inspect the\n        // constructors ahead of time and determine whether the parameter will\n        // even need to be added.\n        if (e.ComponentRegistration.Activator is ReflectionActivator reflectionActivator)\n        {\n            needFromKeyedServiceParameter = FromKeyedServicesUsageCache.RequiresFromKeyedServicesMiddleware(reflectionActivator);\n        }\n        else if (e.ComponentRegistration.Activator is DelegateActivator)\n        {\n            // For delegate activation there are very few paths that would let\n            // the FromKeyedServicesAttribute actually work, and none that MEDI\n            // supports directly.\n            //\n            // We're explicitly choosing here not to support [FromKeyedServices]\n            // on the Autofac-specific generic delegate resolve methods, to\n            // improve performance for the 99% case of other delegates that only\n            // receive an IComponentContext or an IServiceProvider.\n            needFromKeyedServiceParameter = false;\n        }\n        else if (e.ComponentRegistration.Activator is InstanceActivator)\n        {\n            // Instance activators don't use parameters.\n            needFromKeyedServiceParameter = false;\n        }\n        else\n        {\n            // Unknown activator, assume we need the parameter.\n            needFromKeyedServiceParameter = true;\n        }\n\n        e.ComponentRegistration.PipelineBuilding += (sender, pipeline) =>\n        {\n            if (needFromKeyedServiceParameter)\n            {\n                pipeline.Use(KeyedServiceMiddleware.InstanceWithFromKeyedServicesParameter, MiddlewareInsertionMode.StartOfPhase);\n            }\n            else\n            {\n                pipeline.Use(KeyedServiceMiddleware.InstanceWithoutFromKeyedServicesParameter, MiddlewareInsertionMode.StartOfPhase);\n            }\n        };\n    }\n\n    /// <summary>\n    /// Configures the exposed service type on a service registration.\n    /// </summary>\n    /// <typeparam name=\"TActivatorData\">The activator data type.</typeparam>\n    /// <typeparam name=\"TRegistrationStyle\">The object registration style.</typeparam>\n    /// <param name=\"registrationBuilder\">The registration being built.</param>\n    /// <param name=\"descriptor\">The service descriptor with service type and key information.</param>\n    /// <returns>\n    /// The <paramref name=\"registrationBuilder\" />, configured with the proper service type,\n    /// and available for additional configuration.\n    /// </returns>\n    private static IRegistrationBuilder<object, TActivatorData, TRegistrationStyle> ConfigureServiceType<TActivatorData, TRegistrationStyle>(\n        this IRegistrationBuilder<object, TActivatorData, TRegistrationStyle> registrationBuilder,\n        ServiceDescriptor descriptor)\n    {\n        // If it's keyed, the service key won't be null. A null key results in it _not_ being a keyed service.\n        if (descriptor.IsKeyedService)\n        {\n            var key = descriptor.ServiceKey!;\n            if (key.Equals(Microsoft.Extensions.DependencyInjection.KeyedService.AnyKey))\n            {\n                key = Autofac.Core.KeyedService.AnyKey;\n            }\n\n            registrationBuilder.Keyed(key, descriptor.ServiceType);\n        }\n        else\n        {\n            registrationBuilder.As(descriptor.ServiceType);\n        }\n\n        return registrationBuilder;\n    }\n\n    /// <summary>\n    /// Configures the lifecycle on a service registration.\n    /// </summary>\n    /// <typeparam name=\"TActivatorData\">The activator data type.</typeparam>\n    /// <typeparam name=\"TRegistrationStyle\">The object registration style.</typeparam>\n    /// <param name=\"registrationBuilder\">The registration being built.</param>\n    /// <param name=\"lifecycleKind\">The lifecycle specified on the service registration.</param>\n    /// <param name=\"lifetimeScopeTagForSingleton\">\n    /// If not <see langword=\"null\"/> then all registrations with lifetime <see cref=\"ServiceLifetime.Singleton\" /> are registered\n    /// using <see cref=\"IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.InstancePerMatchingLifetimeScope\" />\n    /// with provided <paramref name=\"lifetimeScopeTagForSingleton\"/>\n    /// instead of using <see cref=\"IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.SingleInstance\"/>.\n    /// </param>\n    /// <returns>\n    /// The <paramref name=\"registrationBuilder\" />, configured with the proper lifetime scope,\n    /// and available for additional configuration.\n    /// </returns>\n    private static IRegistrationBuilder<object, TActivatorData, TRegistrationStyle> ConfigureLifecycle<TActivatorData, TRegistrationStyle>(\n        this IRegistrationBuilder<object, TActivatorData, TRegistrationStyle> registrationBuilder,\n        ServiceLifetime lifecycleKind,\n        object? lifetimeScopeTagForSingleton)\n    {\n        switch (lifecycleKind)\n        {\n            case ServiceLifetime.Singleton:\n                if (lifetimeScopeTagForSingleton == null)\n                {\n                    registrationBuilder.SingleInstance();\n                }\n                else\n                {\n                    registrationBuilder.InstancePerMatchingLifetimeScope(lifetimeScopeTagForSingleton);\n                }\n\n                break;\n            case ServiceLifetime.Scoped:\n                registrationBuilder.InstancePerLifetimeScope();\n                break;\n            case ServiceLifetime.Transient:\n                registrationBuilder.InstancePerDependency();\n                break;\n        }\n\n        return registrationBuilder;\n    }\n\n    /// <summary>\n    /// Populates the Autofac container builder with the set of registered service descriptors.\n    /// </summary>\n    /// <param name=\"builder\">\n    /// The <see cref=\"ContainerBuilder\"/> into which the registrations should be made.\n    /// </param>\n    /// <param name=\"descriptors\">\n    /// The set of service descriptors to register in the container.\n    /// </param>\n    /// <param name=\"lifetimeScopeTagForSingletons\">\n    /// If not <see langword=\"null\"/> then all registrations with lifetime <see cref=\"ServiceLifetime.Singleton\" /> are registered\n    /// using <see cref=\"IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.InstancePerMatchingLifetimeScope\" />\n    /// with provided <paramref name=\"lifetimeScopeTagForSingletons\"/>\n    /// instead of using <see cref=\"IRegistrationBuilder{TLimit,TActivatorData,TRegistrationStyle}.SingleInstance\"/>.\n    /// </param>\n    [SuppressMessage(\"CA2000\", \"CA2000\", Justification = \"Registrations created here are disposed when the built container is disposed.\")]\n    private static void Register(\n        ContainerBuilder builder,\n        IEnumerable<ServiceDescriptor> descriptors,\n        object? lifetimeScopeTagForSingletons)\n    {\n        foreach (var descriptor in descriptors)\n        {\n            var implementationType = descriptor.NormalizedImplementationType();\n            if (implementationType != null)\n            {\n                // Test if an open generic type is being registered\n                var serviceTypeInfo = descriptor.ServiceType.GetTypeInfo();\n                if (serviceTypeInfo.IsGenericTypeDefinition)\n                {\n                    builder\n                        .RegisterGeneric(implementationType)\n                        .ConfigureServiceType(descriptor)\n                        .ConfigureLifecycle(descriptor.Lifetime, lifetimeScopeTagForSingletons);\n                }\n                else\n                {\n                    builder\n                        .RegisterType(implementationType)\n                        .ConfigureServiceType(descriptor)\n                        .ConfigureLifecycle(descriptor.Lifetime, lifetimeScopeTagForSingletons);\n                }\n\n                continue;\n            }\n\n            if (descriptor.IsKeyedService && descriptor.KeyedImplementationFactory != null)\n            {\n                var registration = RegistrationBuilder.ForDelegate(descriptor.ServiceType, (context, parameters) =>\n                {\n                    // At this point the context is always a ResolveRequestContext, which will expose the actual service type.\n                    var requestContext = (ResolveRequestContext)context;\n\n                    var serviceProvider = context.Resolve<IServiceProvider>();\n\n                    var keyedService = (Autofac.Core.KeyedService)requestContext.Service;\n                    var key = requestContext.Parameters.KeyedServiceKey<object>();\n\n                    return descriptor.KeyedImplementationFactory(serviceProvider, key);\n                })\n                .ConfigureServiceType(descriptor)\n                .ConfigureLifecycle(descriptor.Lifetime, lifetimeScopeTagForSingletons)\n                .CreateRegistration();\n\n                builder.RegisterComponent(registration);\n\n                continue;\n            }\n            else if (!descriptor.IsKeyedService && descriptor.ImplementationFactory != null)\n            {\n                var registration = RegistrationBuilder.ForDelegate(descriptor.ServiceType, (context, parameters) =>\n                    {\n                        var serviceProvider = context.Resolve<IServiceProvider>();\n                        return descriptor.ImplementationFactory(serviceProvider);\n                    })\n                    .ConfigureServiceType(descriptor)\n                    .ConfigureLifecycle(descriptor.Lifetime, lifetimeScopeTagForSingletons)\n                    .CreateRegistration();\n\n                builder.RegisterComponent(registration);\n                continue;\n            }\n\n            // It's not a type or factory, so it must be an instance.\n            builder\n                .RegisterInstance(descriptor.NormalizedImplementationInstance()!)\n                .ConfigureServiceType(descriptor)\n                .ConfigureLifecycle(descriptor.Lifetime, null)\n                .ExternallyOwned();\n        }\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/AutofacServiceProvider.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Autofac.Core;\nusing Microsoft.Extensions.DependencyInjection;\nusing KeyedService = Autofac.Core.KeyedService;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Autofac implementation of the ASP.NET Core <see cref=\"IServiceProvider\"/>.\n/// </summary>\n/// <seealso cref=\"IServiceProvider\" />\n/// <seealso cref=\"ISupportRequiredService\" />\npublic class AutofacServiceProvider : IServiceProvider, ISupportRequiredService, IKeyedServiceProvider, IServiceProviderIsService, IServiceProviderIsKeyedService, IDisposable, IAsyncDisposable\n{\n    private readonly ILifetimeScope _lifetimeScope;\n\n    private bool _disposed;\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"AutofacServiceProvider\"/> class.\n    /// </summary>\n    /// <param name=\"lifetimeScope\">\n    /// The lifetime scope from which services will be resolved.\n    /// </param>\n    public AutofacServiceProvider(ILifetimeScope lifetimeScope)\n    {\n        _lifetimeScope = lifetimeScope ?? throw new ArgumentNullException(nameof(lifetimeScope));\n    }\n\n    /// <summary>\n    /// Gets the underlying instance of <see cref=\"ILifetimeScope\" />.\n    /// </summary>\n    public ILifetimeScope LifetimeScope => _lifetimeScope;\n\n    /// <summary>\n    /// Gets the service object of the specified type.\n    /// </summary>\n    /// <param name=\"serviceType\">\n    /// An object that specifies the type of service object to get.\n    /// </param>\n    /// <param name=\"serviceKey\">\n    /// An object that specifies the key of service object to get.\n    /// </param>\n    /// <returns>\n    /// A service object of type <paramref name=\"serviceType\" />; or <see langword=\"null\" />\n    /// if there is no service object of type <paramref name=\"serviceType\" />.\n    /// </returns>\n    public object? GetKeyedService(Type serviceType, object? serviceKey)\n    {\n        if (serviceType is null)\n        {\n            throw new ArgumentNullException(nameof(serviceType));\n        }\n\n        var normalizedKey = NormalizeServiceKey(serviceType, serviceKey);\n\n        if (normalizedKey is null)\n        {\n            // A null key equates to \"not keyed.\"\n            return _lifetimeScope.ResolveOptional(serviceType);\n        }\n        else\n        {\n            try\n            {\n                return _lifetimeScope.ResolveOptionalService(new KeyedService(normalizedKey, serviceType));\n            }\n            catch (DependencyResolutionException ex)\n            {\n                // All exceptions resolving keyed services as of .NET 10 are\n                // expected to be InvalidOperationException.\n                throw new InvalidOperationException(ex.Message, ex);\n            }\n        }\n    }\n\n    /// <summary>\n    /// Gets service of type <paramref name=\"serviceType\" /> from the\n    /// <see cref=\"AutofacServiceProvider\" /> and requires it be present.\n    /// </summary>\n    /// <param name=\"serviceType\">\n    /// An object that specifies the type of service object to get.\n    /// </param>\n    /// <param name=\"serviceKey\">\n    /// An object that specifies the key of service object to get.\n    /// </param>\n    /// <returns>\n    /// A service object of type <paramref name=\"serviceType\" />.\n    /// </returns>\n    /// <exception cref=\"Autofac.Core.Registration.ComponentNotRegisteredException\">\n    /// Thrown if the <paramref name=\"serviceType\" /> isn't registered with the container.\n    /// </exception>\n    /// <exception cref=\"Autofac.Core.DependencyResolutionException\">\n    /// Thrown if the object can't be resolved from the container.\n    /// </exception>\n    public object GetRequiredKeyedService(Type serviceType, object? serviceKey)\n    {\n        if (serviceType is null)\n        {\n            throw new ArgumentNullException(nameof(serviceType));\n        }\n\n        var normalizedKey = NormalizeServiceKey(serviceType, serviceKey);\n\n        if (normalizedKey is null)\n        {\n            // A null key equates to \"not keyed.\"\n            return _lifetimeScope.Resolve(serviceType);\n        }\n        else\n        {\n            try\n            {\n                return _lifetimeScope.ResolveKeyed(normalizedKey, serviceType);\n            }\n            catch (DependencyResolutionException ex)\n            {\n                // All exceptions resolving keyed services as of .NET 10 are\n                // expected to be InvalidOperationException.\n                throw new InvalidOperationException(ex.Message, ex);\n            }\n        }\n    }\n\n    /// <summary>\n    /// Gets service of type <paramref name=\"serviceType\" /> from the\n    /// <see cref=\"AutofacServiceProvider\" /> and requires it be present.\n    /// </summary>\n    /// <param name=\"serviceType\">\n    /// An object that specifies the type of service object to get.\n    /// </param>\n    /// <returns>\n    /// A service object of type <paramref name=\"serviceType\" />.\n    /// </returns>\n    /// <exception cref=\"Autofac.Core.Registration.ComponentNotRegisteredException\">\n    /// Thrown if the <paramref name=\"serviceType\" /> isn't registered with the container.\n    /// </exception>\n    /// <exception cref=\"Autofac.Core.DependencyResolutionException\">\n    /// Thrown if the object can't be resolved from the container.\n    /// </exception>\n    public object GetRequiredService(Type serviceType)\n    {\n        try\n        {\n            return _lifetimeScope.Resolve(serviceType);\n        }\n        catch (DependencyResolutionException ex)\n        {\n            throw new InvalidOperationException(ex.Message, ex);\n        }\n    }\n\n    /// <inheritdoc />\n    public bool IsKeyedService(Type serviceType, object? serviceKey)\n    {\n        // Null service key means non-keyed.\n        if (serviceKey == null)\n        {\n            return IsService(serviceType);\n        }\n\n        return _lifetimeScope.ComponentRegistry.IsRegistered(new KeyedService(serviceKey, serviceType));\n    }\n\n    /// <inheritdoc />\n    public bool IsService(Type serviceType) => _lifetimeScope.ComponentRegistry.IsRegistered(new TypedService(serviceType));\n\n    /// <summary>\n    /// Gets the service object of the specified type.\n    /// </summary>\n    /// <param name=\"serviceType\">\n    /// An object that specifies the type of service object to get.\n    /// </param>\n    /// <returns>\n    /// A service object of type <paramref name=\"serviceType\" />; or <see langword=\"null\" />\n    /// if there is no service object of type <paramref name=\"serviceType\" />.\n    /// </returns>\n    public object? GetService(Type serviceType)\n    {\n        try\n        {\n            return _lifetimeScope.ResolveOptional(serviceType);\n        }\n        catch (DependencyResolutionException ex)\n        {\n            throw new InvalidOperationException(ex.Message, ex);\n        }\n    }\n\n    /// <summary>\n    /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.\n    /// </summary>\n    public void Dispose()\n    {\n        Dispose(true);\n        GC.SuppressFinalize(this);\n    }\n\n    /// <summary>\n    /// Performs a dispose operation asynchronously.\n    /// </summary>\n    /// <returns>A task to await disposal.</returns>\n    public async ValueTask DisposeAsync()\n    {\n        if (!_disposed)\n        {\n            _disposed = true;\n            await _lifetimeScope.DisposeAsync().ConfigureAwait(false);\n            GC.SuppressFinalize(this);\n        }\n    }\n\n    /// <summary>\n    /// Releases unmanaged and - optionally - managed resources.\n    /// </summary>\n    /// <param name=\"disposing\">\n    /// <see langword=\"true\" /> to release both managed and unmanaged resources;\n    /// <see langword=\"false\" /> to release only unmanaged resources.\n    /// </param>\n    protected virtual void Dispose(bool disposing)\n    {\n        if (!_disposed)\n        {\n            _disposed = true;\n            if (disposing)\n            {\n                _lifetimeScope.Dispose();\n            }\n        }\n    }\n\n    private static object? NormalizeServiceKey(Type serviceType, object? serviceKey)\n    {\n        if (serviceKey is null)\n        {\n            return null;\n        }\n\n        if (ReferenceEquals(serviceKey, Microsoft.Extensions.DependencyInjection.KeyedService.AnyKey))\n        {\n            if (!serviceType.IsCollection())\n            {\n                throw new InvalidOperationException(\"KeyedService.AnyKey cannot be used to resolve a single service.\");\n            }\n\n            return KeyedService.AnyKey;\n        }\n\n        return serviceKey;\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/AutofacServiceProviderFactory.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Autofac.Builder;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// A factory for creating a <see cref=\"ContainerBuilder\"/> and an <see cref=\"IServiceProvider\" />.\n/// </summary>\npublic class AutofacServiceProviderFactory : IServiceProviderFactory<ContainerBuilder>\n{\n    private static readonly Action<ContainerBuilder> FallbackConfigurationAction = builder => { };\n\n    private readonly Action<ContainerBuilder> _configurationAction;\n    private readonly ContainerBuildOptions _containerBuildOptions = ContainerBuildOptions.None;\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"AutofacServiceProviderFactory\"/> class.\n    /// </summary>\n    /// <param name=\"containerBuildOptions\">The container options to use when building the container.</param>\n    /// <param name=\"configurationAction\">Action on a <see cref=\"ContainerBuilder\"/> that adds component registrations to the container.</param>\n    public AutofacServiceProviderFactory(\n        ContainerBuildOptions containerBuildOptions,\n        Action<ContainerBuilder>? configurationAction = null)\n        : this(configurationAction) =>\n        _containerBuildOptions = containerBuildOptions;\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"AutofacServiceProviderFactory\"/> class.\n    /// </summary>\n    /// <param name=\"configurationAction\">Action on a <see cref=\"ContainerBuilder\"/> that adds component registrations to the container..</param>\n    public AutofacServiceProviderFactory(Action<ContainerBuilder>? configurationAction = null) =>\n        _configurationAction = configurationAction ?? FallbackConfigurationAction;\n\n    /// <summary>\n    /// Creates a container builder from an <see cref=\"IServiceCollection\" />.\n    /// </summary>\n    /// <param name=\"services\">The collection of services.</param>\n    /// <returns>A container builder that can be used to create an <see cref=\"IServiceProvider\" />.</returns>\n    public ContainerBuilder CreateBuilder(IServiceCollection services)\n    {\n        var builder = new ContainerBuilder();\n\n        builder.Populate(services);\n\n        _configurationAction(builder);\n\n        return builder;\n    }\n\n    /// <summary>\n    /// Creates an <see cref=\"IServiceProvider\" /> from the container builder.\n    /// </summary>\n    /// <param name=\"containerBuilder\">The container builder.</param>\n    /// <returns>An <see cref=\"IServiceProvider\" />.</returns>\n    public IServiceProvider CreateServiceProvider(ContainerBuilder containerBuilder)\n    {\n        if (containerBuilder == null)\n        {\n            throw new ArgumentNullException(nameof(containerBuilder));\n        }\n\n        var container = containerBuilder.Build(_containerBuildOptions);\n\n        return new AutofacServiceProvider(container);\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/AutofacServiceScope.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Autofac implementation of the ASP.NET Core <see cref=\"IServiceScope\"/>.\n/// Inherits from <see cref=\"AutofacServiceProvider\"/> to avoid a separate\n/// allocation per scope — every scope is itself a service provider.\n/// </summary>\n/// <seealso cref=\"IServiceScope\" />\ninternal class AutofacServiceScope : AutofacServiceProvider, IServiceScope\n{\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"AutofacServiceScope\"/> class.\n    /// </summary>\n    /// <param name=\"lifetimeScope\">\n    /// The lifetime scope from which services should be resolved for this service scope.\n    /// </param>\n    public AutofacServiceScope(ILifetimeScope lifetimeScope)\n        : base(lifetimeScope)\n    {\n    }\n\n    /// <summary>\n    /// Gets an <see cref=\"IServiceProvider\" /> corresponding to this service scope.\n    /// </summary>\n    /// <value>\n    /// An <see cref=\"IServiceProvider\" /> that can be used to resolve dependencies from the scope.\n    /// </value>\n    public IServiceProvider ServiceProvider => this;\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/AutofacServiceScopeFactory.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Autofac implementation of the ASP.NET Core <see cref=\"IServiceScopeFactory\"/>.\n/// </summary>\n/// <seealso cref=\"IServiceScopeFactory\" />\ninternal class AutofacServiceScopeFactory : IServiceScopeFactory\n{\n    private readonly ILifetimeScope _lifetimeScope;\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"AutofacServiceScopeFactory\"/> class.\n    /// </summary>\n    /// <param name=\"lifetimeScope\">The lifetime scope.</param>\n    public AutofacServiceScopeFactory(ILifetimeScope lifetimeScope)\n    {\n        _lifetimeScope = lifetimeScope;\n    }\n\n    /// <summary>\n    /// Creates an <see cref=\"IServiceScope\" /> which contains an\n    /// <see cref=\"System.IServiceProvider\" /> used to resolve dependencies within\n    /// the scope.\n    /// </summary>\n    /// <returns>\n    /// An <see cref=\"IServiceScope\" /> controlling the lifetime of the scope. Once\n    /// this is disposed, any scoped services that have been resolved\n    /// from the <see cref=\"IServiceScope.ServiceProvider\" />\n    /// will also be disposed.\n    /// </returns>\n    public IServiceScope CreateScope()\n    {\n        return new AutofacServiceScope(_lifetimeScope.BeginLifetimeScope());\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/FromKeyedServicesAttributeExtensions.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Globalization;\nusing System.Reflection;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Extensions for working with <see cref=\"FromKeyedServicesAttribute\"/>.\n/// </summary>\ninternal static class FromKeyedServicesAttributeExtensions\n{\n    /// <summary>\n    /// Resolves a constructor parameter based on keyed service requirements.\n    /// </summary>\n    /// <param name=\"attribute\">The attribute marking the keyed service dependency in a constructor.</param>\n    /// <param name=\"parameter\">The specific parameter being resolved that is marked with this attribute.</param>\n    /// <param name=\"context\">The component context under which the parameter is being resolved.</param>\n    /// <param name=\"parentServiceKey\">The key used for the containing resolve request.</param>\n    /// <returns>\n    /// The instance of the object that should be used for the parameter value.\n    /// </returns>\n    /// <exception cref=\"ArgumentNullException\">\n    /// Thrown if <paramref name=\"parameter\" /> or <paramref name=\"context\" /> is <see langword=\"null\" />.\n    /// </exception>\n    public static object? ResolveParameter(this FromKeyedServicesAttribute attribute, ParameterInfo parameter, IComponentContext context, object? parentServiceKey)\n    {\n        if (attribute is null)\n        {\n            throw new ArgumentNullException(nameof(attribute));\n        }\n\n        if (parameter is null)\n        {\n            throw new ArgumentNullException(nameof(parameter));\n        }\n\n        if (context is null)\n        {\n            throw new ArgumentNullException(nameof(context));\n        }\n\n        return attribute.LookupMode switch\n        {\n            ServiceKeyLookupMode.ExplicitKey => ResolveKeyed(parameter, context, NormalizeKey(attribute.Key)),\n            ServiceKeyLookupMode.InheritKey => ResolveKeyed(parameter, context, NormalizeKey(parentServiceKey)),\n            _ => ResolveUnkeyed(parameter, context),\n        };\n    }\n\n    private static object? ResolveUnkeyed(ParameterInfo parameter, IComponentContext context)\n    {\n        if (context.TryResolve(parameter.ParameterType, out var instance))\n        {\n            return instance;\n        }\n\n        return GetDefaultValueOrThrow(parameter, key: null);\n    }\n\n    private static object? ResolveKeyed(ParameterInfo parameter, IComponentContext context, object? key)\n    {\n        if (key is null)\n        {\n            return GetDefaultValueOrThrow(parameter, key);\n        }\n\n        if (context.TryResolveKeyed(key, parameter.ParameterType, out var instance))\n        {\n            return instance;\n        }\n\n        return GetDefaultValueOrThrow(parameter, key);\n    }\n\n    private static object? GetDefaultValueOrThrow(ParameterInfo parameter, object? key)\n    {\n        if (parameter.HasDefaultValue)\n        {\n            return parameter.DefaultValue;\n        }\n\n        if (key is null)\n        {\n            throw new InvalidOperationException(\n                string.Format(\n                    CultureInfo.CurrentCulture,\n                    \"Unable to resolve service for type '{0}'.\",\n                    parameter.ParameterType));\n        }\n\n        throw new InvalidOperationException(\n            string.Format(\n                CultureInfo.CurrentCulture,\n                \"Unable to resolve service for type '{0}' using key '{1}'.\",\n                parameter.ParameterType,\n                key));\n    }\n\n    private static object? NormalizeKey(object? key)\n    {\n        if (key is null)\n        {\n            return null;\n        }\n\n        return ReferenceEquals(key, Microsoft.Extensions.DependencyInjection.KeyedService.AnyKey)\n            ? Autofac.Core.KeyedService.AnyKey\n            : key;\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/FromKeyedServicesUsageCache.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Collections.Concurrent;\nusing Autofac.Core;\nusing Autofac.Core.Activators.Reflection;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Caches lookups for <see cref=\"FromKeyedServicesAttribute\"/> usage on constructor parameters.\n/// </summary>\n[ExcludeFromCodeCoverage]\ninternal static class FromKeyedServicesUsageCache\n{\n    private static readonly FromKeyedServicesUsageReflectionCache ReflectionCache = new();\n\n    static FromKeyedServicesUsageCache()\n    {\n        ReflectionCacheSet.Shared.RegisterExternalCache(ReflectionCache);\n    }\n\n    /// <summary>\n    /// Determines whether the resolve pipeline needs <see cref=\"KeyedServiceMiddleware\"/> for the given activator.\n    /// </summary>\n    /// <param name=\"activator\">The reflection activator being inspected.</param>\n    /// <returns><see langword=\"true\"/> when a constructor parameter uses <see cref=\"FromKeyedServicesAttribute\"/>; otherwise <see langword=\"false\"/>.</returns>\n    public static bool RequiresFromKeyedServicesMiddleware(ReflectionActivator activator)\n    {\n        if (activator is null)\n        {\n            throw new ArgumentNullException(nameof(activator));\n        }\n\n        var constructorFinder = activator.ConstructorFinder;\n        var cacheKey = new CacheKey(activator.LimitType, constructorFinder.GetType());\n\n#if NETSTANDARD2_0\n        if (ReflectionCache.TryGet(cacheKey, out var cachedResult))\n        {\n            return cachedResult;\n        }\n\n        var computed = ScanConstructors(constructorFinder, activator.LimitType);\n        return ReflectionCache.GetOrAdd(cacheKey, computed);\n#else\n        return ReflectionCache.GetOrAdd(\n            cacheKey,\n            static (_, state) => ScanConstructors(state.ConstructorFinder, state.LimitType),\n            (ConstructorFinder: constructorFinder, activator.LimitType));\n#endif\n    }\n\n    private static bool ScanConstructors(IConstructorFinder constructorFinder, Type limitType)\n    {\n        var constructors = constructorFinder.FindConstructors(limitType);\n\n        foreach (var constructor in constructors)\n        {\n            foreach (var parameter in constructor.GetParameters())\n            {\n                if (parameter.IsDefined(typeof(FromKeyedServicesAttribute), inherit: true))\n                {\n                    return true;\n                }\n            }\n        }\n\n        return false;\n    }\n\n    private readonly struct CacheKey : IEquatable<CacheKey>\n    {\n        public CacheKey(Type implementationType, Type constructorFinderType)\n        {\n            ImplementationType = implementationType ?? throw new ArgumentNullException(nameof(implementationType));\n            ConstructorFinderType = constructorFinderType ?? throw new ArgumentNullException(nameof(constructorFinderType));\n        }\n\n        private Type ImplementationType { get; }\n\n        private Type ConstructorFinderType { get; }\n\n        public bool Matches(ReflectionCacheClearPredicate clearPredicate)\n        {\n            var implementationAssemblies = new[] { ImplementationType.Assembly };\n            if (clearPredicate(ImplementationType, implementationAssemblies))\n            {\n                return true;\n            }\n\n            var constructorFinderAssemblies = new[] { ConstructorFinderType.Assembly };\n            return clearPredicate(ConstructorFinderType, constructorFinderAssemblies);\n        }\n\n        public bool Equals(CacheKey other)\n        {\n            return ImplementationType == other.ImplementationType &&\n                   ConstructorFinderType == other.ConstructorFinderType;\n        }\n\n        [ExcludeFromCodeCoverage]\n        public override bool Equals(object? obj)\n        {\n            return obj is CacheKey other && Equals(other);\n        }\n\n        public override int GetHashCode()\n        {\n            unchecked\n            {\n                return (ImplementationType.GetHashCode() * 397) ^ ConstructorFinderType.GetHashCode();\n            }\n        }\n    }\n\n    private sealed class FromKeyedServicesUsageReflectionCache : IReflectionCache\n    {\n        private readonly ConcurrentDictionary<CacheKey, bool> _cache = new();\n\n        public ReflectionCacheUsage Usage => ReflectionCacheUsage.Registration;\n\n        public bool TryGet(CacheKey key, out bool result)\n        {\n            return _cache.TryGetValue(key, out result);\n        }\n\n        public bool GetOrAdd(CacheKey key, bool value)\n        {\n            return _cache.GetOrAdd(key, value);\n        }\n\n        public bool GetOrAdd(CacheKey key, Func<CacheKey, (IConstructorFinder ConstructorFinder, Type LimitType), bool> valueFactory, (IConstructorFinder ConstructorFinder, Type LimitType) state)\n        {\n#if NETSTANDARD2_0\n            return _cache.GetOrAdd(key, cacheKey => valueFactory(cacheKey, state));\n#else\n            return _cache.GetOrAdd(key, valueFactory, state);\n#endif\n        }\n\n        public void Clear()\n        {\n            _cache.Clear();\n        }\n\n        public void Clear(ReflectionCacheClearPredicate clearPredicate)\n        {\n            if (clearPredicate is null)\n            {\n                throw new ArgumentNullException(nameof(clearPredicate));\n            }\n\n            foreach (var key in _cache.Keys)\n            {\n                if (key.Matches(clearPredicate))\n                {\n                    _cache.TryRemove(key, out _);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/KeyTypeConversionException.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Globalization;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Exception indicating that type conversion failed when trying to inject a key\n/// using the\n/// <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>.\n/// </summary>\n[ExcludeFromCodeCoverage]\npublic class KeyTypeConversionException : Exception\n{\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"KeyTypeConversionException\" /> class.\n    /// </summary>\n    /// <param name=\"resolutionKeyType\">\n    /// The type of the key specified during service resolution. This is what\n    /// would be injected into the constructor and needs to be converted.\n    /// </param>\n    /// <param name=\"attributeKeyType\">\n    /// The type of parameter marked with the\n    /// <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>.\n    /// This is what the key was trying to be converted to.\n    /// </param>\n    public KeyTypeConversionException(Type resolutionKeyType, Type attributeKeyType)\n        : this(resolutionKeyType, attributeKeyType, string.Format(CultureInfo.CurrentCulture, KeyTypeConversionExceptionResources.Message, resolutionKeyType, attributeKeyType))\n    {\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"KeyTypeConversionException\" /> class.\n    /// </summary>\n    /// <param name=\"resolutionKeyType\">\n    /// The type of the key specified during service resolution. This is what\n    /// would be injected into the constructor and needs to be converted.\n    /// </param>\n    /// <param name=\"attributeKeyType\">\n    /// The type of parameter marked with the\n    /// <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>.\n    /// This is what the key was trying to be converted to.\n    /// </param>\n    /// <param name=\"message\">\n    /// A specific message for the exception to override the default.\n    /// </param>\n    public KeyTypeConversionException(Type resolutionKeyType, Type attributeKeyType, string message)\n        : base(message)\n    {\n        ResolutionKeyType = resolutionKeyType;\n        AttributeKeyType = attributeKeyType;\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"KeyTypeConversionException\"/> class.\n    /// </summary>\n    /// <param name=\"resolutionKeyType\">\n    /// The type of the key specified during service resolution. This is what\n    /// would be injected into the constructor and needs to be converted.\n    /// </param>\n    /// <param name=\"attributeKeyType\">\n    /// The type of parameter marked with the\n    /// <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>.\n    /// This is what the key was trying to be converted to.\n    /// </param>\n    /// <param name=\"innerException\">The inner exception.</param>\n    public KeyTypeConversionException(Type resolutionKeyType, Type attributeKeyType, Exception? innerException)\n        : this(resolutionKeyType, attributeKeyType, string.Format(CultureInfo.CurrentCulture, KeyTypeConversionExceptionResources.Message, resolutionKeyType, attributeKeyType), innerException)\n    {\n    }\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"KeyTypeConversionException\"/> class.\n    /// </summary>\n    /// <param name=\"resolutionKeyType\">\n    /// The type of the key specified during service resolution. This is what\n    /// would be injected into the constructor and needs to be converted.\n    /// </param>\n    /// <param name=\"attributeKeyType\">\n    /// The type of parameter marked with the\n    /// <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>.\n    /// This is what the key was trying to be converted to.\n    /// </param>\n    /// <param name=\"message\">\n    /// A specific message for the exception to override the default.\n    /// </param>\n    /// <param name=\"innerException\">The inner exception.</param>\n    public KeyTypeConversionException(Type resolutionKeyType, Type attributeKeyType, string message, Exception? innerException)\n        : base(message, innerException)\n    {\n        ResolutionKeyType = resolutionKeyType;\n        AttributeKeyType = attributeKeyType;\n    }\n\n    /// <summary>\n    /// Gets the type of the parameter marked with the <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>.\n    /// </summary>\n    /// <value>\n    /// The <see cref=\"Type\"/> of parameter marked with the\n    /// <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>,\n    /// which is the destination where the key should be injected. This should\n    /// be compatible with the key provided during resolution.\n    /// </value>\n    public Type AttributeKeyType { get; }\n\n    /// <summary>\n    /// Gets the type of the key specified during service resolution.\n    /// </summary>\n    /// <value>\n    /// The <see cref=\"Type\"/> of key passed to the keyed service resolve\n    /// operation. This is what would be injected as a constructor parameter to\n    /// the service being resolved.\n    /// </value>\n    public Type ResolutionKeyType { get; }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/KeyTypeConversionExceptionResources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!--\n    Microsoft ResX Schema\n\n    Version 2.0\n\n    The primary goals of this format is to allow a simple XML format\n    that is mostly human readable. The generation and parsing of the\n    various data types are done through the TypeConverter classes\n    associated with the data types.\n\n    Example:\n\n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n\n    There are any number of \"resheader\" rows that contain simple\n    name/value pairs.\n\n    Each data row contains a name, and value. The row also contains a\n    type or mimetype. Type corresponds to a .NET class that support\n    text/value conversion through the TypeConverter architecture.\n    Classes that don't support this are serialized and stored with the\n    mimetype set.\n\n    The mimetype is used for serialized objects, and tells the\n    ResXResourceReader how to depersist the object. This is currently not\n    extensible. For a given mimetype the value must be set accordingly:\n\n    Note - application/x-microsoft.net.object.binary.base64 is the format\n    that the ResXResourceWriter will generate, however the reader can\n    read any of the formats listed below.\n\n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with\n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with\n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array\n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"Message\" xml:space=\"preserve\">\n    <value>Unable to convert key of type '{0}' to type '{1}' for parameter injection.</value>\n  </data>\n</root>\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/KeyTypeManipulation.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Collections.Concurrent;\nusing System.ComponentModel;\nusing System.Globalization;\nusing System.Reflection;\nusing Autofac.Core;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Utilities for converting keyed service key values into compatible types for\n/// injection using the <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>.\n/// This logic originally came from Autofac.Configuration but there isn't a good\n/// \"shared dependency\" location for things like this other than core Autofac.\n/// </summary>\ninternal class KeyTypeManipulation\n{\n    private static readonly KeyTypeManipulationReflectionCache ReflectionCache = new();\n\n    static KeyTypeManipulation()\n    {\n        ReflectionCacheSet.Shared.RegisterExternalCache(ReflectionCache);\n    }\n\n    /// <summary>\n    /// Converts an object to a type compatible with a given parameter.\n    /// </summary>\n    /// <param name=\"value\">The object value to convert.</param>\n    /// <param name=\"destinationType\">The destination <see cref=\"Type\"/> to which <paramref name=\"value\"/> should be converted.</param>\n    /// <param name=\"memberInfo\">The parameter for which the <paramref name=\"value\"/> is being converted.</param>\n    /// <returns>\n    /// An <see cref=\"object\"/> of type <paramref name=\"destinationType\"/>, converted using\n    /// type converters specified on <paramref name=\"memberInfo\"/> if available. If <paramref name=\"value\"/>\n    /// is <see langword=\"null\"/> then the output will be <see langword=\"null\"/> for reference\n    /// types and the default value for value types.\n    /// </returns>\n    /// <exception cref=\"InvalidOperationException\">\n    /// Thrown if conversion of the value fails.\n    /// </exception>\n    public static object? ChangeToCompatibleType(object? value, Type destinationType, ParameterInfo memberInfo)\n    {\n        TypeConverterAttribute? attrib = null;\n        if (memberInfo != null)\n        {\n            attrib = ReflectionCache.GetOrAddParameterConverterAttribute(memberInfo);\n        }\n\n        return ChangeToCompatibleType(value, destinationType, attrib);\n    }\n\n    /// <summary>\n    /// Converts an object to a type compatible with a given parameter.\n    /// </summary>\n    /// <param name=\"value\">The object value to convert.</param>\n    /// <param name=\"destinationType\">The destination <see cref=\"Type\"/> to which <paramref name=\"value\"/> should be converted.</param>\n    /// <param name=\"memberInfo\">The parameter for which the <paramref name=\"value\"/> is being converted.</param>\n    /// <returns>\n    /// An <see cref=\"object\"/> of type <paramref name=\"destinationType\"/>, converted using\n    /// type converters specified on <paramref name=\"memberInfo\"/> if available. If <paramref name=\"value\"/>\n    /// is <see langword=\"null\"/> then the output will be <see langword=\"null\"/> for reference\n    /// types and the default value for value types.\n    /// </returns>\n    /// <exception cref=\"InvalidOperationException\">\n    /// Thrown if conversion of the value fails.\n    /// </exception>\n    public static object? ChangeToCompatibleType(object? value, Type destinationType, MemberInfo memberInfo)\n    {\n        TypeConverterAttribute? attrib = null;\n        if (memberInfo != null)\n        {\n            attrib = ReflectionCache.GetOrAddMemberConverterAttribute(memberInfo);\n        }\n\n        return ChangeToCompatibleType(value, destinationType, attrib);\n    }\n\n    /// <summary>\n    /// Converts an object to a type compatible with a given parameter.\n    /// </summary>\n    /// <param name=\"value\">The object value to convert.</param>\n    /// <param name=\"destinationType\">The destination <see cref=\"Type\"/> to which <paramref name=\"value\"/> should be converted.</param>\n    /// <param name=\"converterAttribute\">A <see cref=\"TypeConverterAttribute\"/>, if available, specifying the type of converter to use.<paramref name=\"value\"/> is being converted.</param>\n    /// <returns>\n    /// An <see cref=\"object\"/> of type <paramref name=\"destinationType\"/>, converted using\n    /// any type converters specified in <paramref name=\"converterAttribute\"/> if available. If <paramref name=\"value\"/>\n    /// is <see langword=\"null\"/> then the output will be <see langword=\"null\"/> for reference\n    /// types and the default value for value types.\n    /// </returns>\n    /// <exception cref=\"InvalidOperationException\">\n    /// Thrown if conversion of the value fails.\n    /// </exception>\n    public static object? ChangeToCompatibleType(object? value, Type destinationType, TypeConverterAttribute? converterAttribute = null)\n    {\n        if (destinationType == null)\n        {\n            throw new ArgumentNullException(nameof(destinationType));\n        }\n\n        if (value == null)\n        {\n            return destinationType.GetTypeInfo().IsValueType\n                ? ReflectionCache.GetOrAddDefaultValue(destinationType)\n                : null;\n        }\n\n        // Try implicit conversion.\n        if (destinationType.IsInstanceOfType(value))\n        {\n            return value;\n        }\n\n        TypeConverter converter;\n\n        // Try to get custom type converter information.\n        if (converterAttribute != null && !string.IsNullOrEmpty(converterAttribute.ConverterTypeName))\n        {\n            try\n            {\n                converter = GetTypeConverterFromName(converterAttribute.ConverterTypeName);\n            }\n            catch (InvalidOperationException ex)\n            {\n                throw new KeyTypeConversionException(value.GetType(), destinationType, ex);\n            }\n\n            if (converter.CanConvertFrom(value.GetType()))\n            {\n                return converter.ConvertFrom(null, CultureInfo.InvariantCulture, value);\n            }\n        }\n\n        // If there's not a custom converter specified via attribute, try for a default.\n        converter = TypeDescriptor.GetConverter(value.GetType());\n        if (converter.CanConvertTo(destinationType))\n        {\n            return converter.ConvertTo(null, CultureInfo.InvariantCulture, value, destinationType);\n        }\n\n        // Try explicit opposite conversion.\n        converter = TypeDescriptor.GetConverter(destinationType);\n        if (converter.CanConvertFrom(value.GetType()))\n        {\n            return converter.ConvertFrom(null, CultureInfo.InvariantCulture, value);\n        }\n\n        // Try a TryParse method.\n        if (value is string stringValue)\n        {\n            // Some types in later frameworks have string TryParse and ReadOnlySpan<char> TryParse\n            // so they result in an AmbiguousMatchException unless we specify.\n            var parser = ReflectionCache.GetOrAddTryParseMethod(destinationType);\n            if (parser != null)\n            {\n                var parameters = new object?[] { stringValue, null };\n                if ((bool)parser.Invoke(null, parameters)!)\n                {\n                    return parameters[1];\n                }\n            }\n        }\n\n        throw new KeyTypeConversionException(value.GetType(), destinationType);\n    }\n\n    /// <summary>\n    /// Instantiates a type converter from its type name.\n    /// </summary>\n    /// <param name=\"converterTypeName\">\n    /// The name of the <see cref=\"Type\"/> of the <see cref=\"TypeConverter\"/>.\n    /// </param>\n    /// <returns>\n    /// The instantiated <see cref=\"TypeConverter\"/>.\n    /// </returns>\n    /// <exception cref=\"InvalidOperationException\">\n    /// Thrown if <paramref name=\"converterTypeName\"/> does not correspond\n    /// to a <see cref=\"TypeConverter\"/>.\n    /// </exception>\n    private static TypeConverter GetTypeConverterFromName(string converterTypeName)\n    {\n        var converterType = ReflectionCache.GetOrAddConverterType(converterTypeName);\n\n        return (TypeConverter)Activator.CreateInstance(converterType)!;\n    }\n\n    [ExcludeFromCodeCoverage]\n    private sealed class KeyTypeManipulationReflectionCache : IReflectionCache\n    {\n        private readonly ConcurrentDictionary<ParameterInfo, TypeConverterAttribute?> _parameterConverterAttributes = new();\n        private readonly ConcurrentDictionary<MemberInfo, TypeConverterAttribute?> _memberConverterAttributes = new();\n        private readonly ConcurrentDictionary<string, Type> _converterTypeCache = new(StringComparer.Ordinal);\n        private readonly ConcurrentDictionary<Type, MethodInfo?> _tryParseMethodCache = new();\n        private readonly ConcurrentDictionary<Type, object?> _defaultValueCache = new();\n\n        public ReflectionCacheUsage Usage => ReflectionCacheUsage.Resolution;\n\n        public TypeConverterAttribute? GetOrAddParameterConverterAttribute(ParameterInfo parameter)\n        {\n            return _parameterConverterAttributes.GetOrAdd(\n                parameter,\n                static p => p.GetCustomAttributes(typeof(TypeConverterAttribute), true)\n                    .Cast<TypeConverterAttribute>()\n                    .FirstOrDefault());\n        }\n\n        public TypeConverterAttribute? GetOrAddMemberConverterAttribute(MemberInfo member)\n        {\n            return _memberConverterAttributes.GetOrAdd(\n                member,\n                static m => m.GetCustomAttributes(typeof(TypeConverterAttribute), true)\n                    .Cast<TypeConverterAttribute>()\n                    .FirstOrDefault());\n        }\n\n        public Type GetOrAddConverterType(string converterTypeName)\n        {\n            return _converterTypeCache.GetOrAdd(\n                converterTypeName,\n                static name =>\n                {\n                    var resolvedType = Type.GetType(name, true)!;\n                    if (!typeof(TypeConverter).GetTypeInfo().IsAssignableFrom(resolvedType.GetTypeInfo()))\n                    {\n                        throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, KeyTypeManipulationResources.TypeConverterAttributeTypeNotConverter, name));\n                    }\n\n                    return resolvedType;\n                });\n        }\n\n        public MethodInfo? GetOrAddTryParseMethod(Type destinationType)\n        {\n            return _tryParseMethodCache.GetOrAdd(\n                destinationType,\n                static type =>\n                {\n                    var parameterTypes = new[] { typeof(string), type.MakeByRefType() };\n                    return type.GetMethod(\"TryParse\", BindingFlags.Static | BindingFlags.Public, null, CallingConventions.Standard, parameterTypes, null);\n                });\n        }\n\n        public object? GetOrAddDefaultValue(Type destinationType)\n        {\n            return _defaultValueCache.GetOrAdd(destinationType, static t => Activator.CreateInstance(t));\n        }\n\n        public void Clear()\n        {\n            _parameterConverterAttributes.Clear();\n            _memberConverterAttributes.Clear();\n            _converterTypeCache.Clear();\n            _tryParseMethodCache.Clear();\n            _defaultValueCache.Clear();\n        }\n\n        public void Clear(ReflectionCacheClearPredicate clearPredicate)\n        {\n            if (clearPredicate is null)\n            {\n                throw new ArgumentNullException(nameof(clearPredicate));\n            }\n\n            foreach (var parameter in _parameterConverterAttributes.Keys)\n            {\n                var member = parameter.Member;\n                var assemblies = GetParameterAssemblies(parameter);\n                if (clearPredicate(member, assemblies))\n                {\n                    _parameterConverterAttributes.TryRemove(parameter, out _);\n                }\n            }\n\n            foreach (var member in _memberConverterAttributes.Keys)\n            {\n                if (clearPredicate(member, new[] { member.Module.Assembly }))\n                {\n                    _memberConverterAttributes.TryRemove(member, out _);\n                }\n            }\n\n            foreach (var type in _tryParseMethodCache.Keys)\n            {\n                if (clearPredicate(type, new[] { type.Assembly }))\n                {\n                    _tryParseMethodCache.TryRemove(type, out _);\n                }\n            }\n\n            foreach (var type in _defaultValueCache.Keys)\n            {\n                if (clearPredicate(type, new[] { type.Assembly }))\n                {\n                    _defaultValueCache.TryRemove(type, out _);\n                }\n            }\n\n            foreach (var entry in _converterTypeCache)\n            {\n                if (clearPredicate(entry.Value, new[] { entry.Value.Assembly }))\n                {\n                    _converterTypeCache.TryRemove(entry.Key, out _);\n                }\n            }\n        }\n\n        private static IEnumerable<Assembly> GetParameterAssemblies(ParameterInfo parameter)\n        {\n            var memberAssembly = parameter.Member.Module.Assembly;\n            var parameterAssembly = parameter.ParameterType.Assembly;\n\n            if (ReferenceEquals(memberAssembly, parameterAssembly))\n            {\n                yield return memberAssembly;\n                yield break;\n            }\n\n            yield return memberAssembly;\n            yield return parameterAssembly;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/KeyTypeManipulationResources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!--\n    Microsoft ResX Schema\n\n    Version 2.0\n\n    The primary goals of this format is to allow a simple XML format\n    that is mostly human readable. The generation and parsing of the\n    various data types are done through the TypeConverter classes\n    associated with the data types.\n\n    Example:\n\n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n\n    There are any number of \"resheader\" rows that contain simple\n    name/value pairs.\n\n    Each data row contains a name, and value. The row also contains a\n    type or mimetype. Type corresponds to a .NET class that support\n    text/value conversion through the TypeConverter architecture.\n    Classes that don't support this are serialized and stored with the\n    mimetype set.\n\n    The mimetype is used for serialized objects, and tells the\n    ResXResourceReader how to depersist the object. This is currently not\n    extensible. For a given mimetype the value must be set accordingly:\n\n    Note - application/x-microsoft.net.object.binary.base64 is the format\n    that the ResXResourceWriter will generate, however the reader can\n    read any of the formats listed below.\n\n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with\n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with\n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array\n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"TypeConversionUnsupported\" xml:space=\"preserve\">\n    <value>Unable to convert object of type '{0}' to type '{1}'.</value>\n  </data>\n  <data name=\"TypeConverterAttributeTypeNotConverter\" xml:space=\"preserve\">\n    <value>The type '{0}' specified in the TypeConverterAttribute is not a TypeConverter.</value>\n  </data>\n</root>\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/KeyedServiceMiddleware.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Collections.Concurrent;\nusing System.Reflection;\nusing Autofac.Core;\nusing Autofac.Core.Resolving.Pipeline;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Middleware that supports keyed service compatibility.\n/// </summary>\ninternal class KeyedServiceMiddleware : IResolveMiddleware\n{\n    private readonly bool _addFromKeyedServiceParameter;\n\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"KeyedServiceMiddleware\"/> class.\n    /// </summary>\n    /// <param name=\"addFromKeyedServiceParameter\">Whether or not the from-keyed-service parameter should be added.</param>\n    public KeyedServiceMiddleware(bool addFromKeyedServiceParameter)\n    {\n        _addFromKeyedServiceParameter = addFromKeyedServiceParameter;\n    }\n\n    /// <summary>\n    /// Gets a single instance of this middleware that does not add the keyed services parameter.\n    /// </summary>\n    public static KeyedServiceMiddleware InstanceWithoutFromKeyedServicesParameter { get; } = new(addFromKeyedServiceParameter: false);\n\n    /// <summary>\n    /// Gets a single instance of this middleware that adds the keyed services parameter.\n    /// </summary>\n    public static KeyedServiceMiddleware InstanceWithFromKeyedServicesParameter { get; } = new(addFromKeyedServiceParameter: true);\n\n    /// <inheritdoc />\n    public PipelinePhase Phase => PipelinePhase.Activation;\n\n    /// <inheritdoc />\n    public void Execute(ResolveRequestContext context, Action<ResolveRequestContext> next)\n    {\n        Parameter? microsoftServiceKeyParameter = null;\n        Parameter? fromKeyedServicesParameter = null;\n\n        var keyedService = context.Service as Autofac.Core.KeyedService;\n        object? inheritedServiceKey = null;\n\n        if (keyedService is not null)\n        {\n            if (Autofac.Core.KeyedService.IsAnyKey(keyedService.ServiceKey))\n            {\n                context.Parameters.TryGetKeyedServiceKey<object>(out inheritedServiceKey);\n            }\n            else\n            {\n                inheritedServiceKey = keyedService.ServiceKey;\n            }\n        }\n\n        var effectiveServiceKey = inheritedServiceKey;\n\n        if (keyedService is not null &&\n            effectiveServiceKey is not null &&\n            !Autofac.Core.KeyedService.IsAnyKey(effectiveServiceKey))\n        {\n            microsoftServiceKeyParameter = new MicrosoftServiceKeyParameter(effectiveServiceKey);\n        }\n\n        if (_addFromKeyedServiceParameter)\n        {\n            // [FromKeyedServices(\"key\")] - Specifies a keyed service\n            // for injection into a constructor. This is similar to the\n            // Autofac [KeyFilter] attribute.\n            fromKeyedServicesParameter = new FromKeyedServicesParameter(inheritedServiceKey);\n        }\n\n        if (microsoftServiceKeyParameter is not null || fromKeyedServicesParameter is not null)\n        {\n            context.ChangeParameters(AppendParameters(context.Parameters, microsoftServiceKeyParameter, fromKeyedServicesParameter));\n        }\n\n        next(context);\n    }\n\n    private static List<Parameter> AppendParameters(IEnumerable<Parameter> original, Parameter? first, Parameter? second)\n    {\n        // Build a concrete list rather than using yield return, which would\n        // allocate a compiler-generated state machine on every call.\n        var list = new List<Parameter>(original is ICollection<Parameter> col ? col.Count + 2 : 4);\n        list.AddRange(original);\n\n        if (first is not null)\n        {\n            list.Add(first);\n        }\n\n        if (second is not null)\n        {\n            list.Add(second);\n        }\n\n        return list;\n    }\n\n    /// <summary>\n    /// Caches the presence of relevant attributes on parameters to avoid repeated reflection calls.\n    /// </summary>\n    private static class ParameterAttributeCache\n    {\n        private static readonly ParameterAttributeReflectionCache ReflectionCache = new();\n\n        static ParameterAttributeCache()\n        {\n            ReflectionCacheSet.Shared.RegisterExternalCache(ReflectionCache);\n        }\n\n        /// <summary>\n        /// Determines whether the parameter has the <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/> defined.\n        /// </summary>\n        /// <param name=\"parameter\">The parameter to check.</param>\n        /// <returns>\n        /// <see langword=\"true\"/> if the parameter has the attribute; otherwise, <see langword=\"false\"/>.\n        /// </returns>\n        public static bool HasMicrosoftServiceKey(ParameterInfo parameter)\n        {\n            return ReflectionCache.GetOrAddMicrosoftServiceKeyAttributePresence(parameter);\n        }\n\n        /// <summary>\n        /// Gets the <see cref=\"FromKeyedServicesAttribute\"/> defined on the parameter, if any.\n        /// </summary>\n        /// <param name=\"parameter\">The parameter to check.</param>\n        /// <returns>\n        /// The <see cref=\"FromKeyedServicesAttribute\"/> if defined; otherwise, <see langword=\"null\"/>.\n        /// </returns>\n        public static FromKeyedServicesAttribute? GetFromKeyedServicesAttribute(ParameterInfo parameter)\n        {\n            return ReflectionCache.GetOrAddFromKeyedServicesAttribute(parameter);\n        }\n\n        [ExcludeFromCodeCoverage]\n        private sealed class ParameterAttributeReflectionCache : IReflectionCache\n        {\n            private readonly ConcurrentDictionary<ParameterInfo, bool> _microsoftServiceKeyAttributePresence = new();\n            private readonly ConcurrentDictionary<ParameterInfo, FromKeyedServicesAttribute?> _fromKeyedServicesAttributes = new();\n\n            public ReflectionCacheUsage Usage => ReflectionCacheUsage.Resolution;\n\n            public bool GetOrAddMicrosoftServiceKeyAttributePresence(ParameterInfo parameter)\n            {\n                return _microsoftServiceKeyAttributePresence.GetOrAdd(\n                    parameter,\n                    static p => Attribute.IsDefined(p, typeof(Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute), inherit: true));\n            }\n\n            public FromKeyedServicesAttribute? GetOrAddFromKeyedServicesAttribute(ParameterInfo parameter)\n            {\n                return _fromKeyedServicesAttributes.GetOrAdd(\n                    parameter,\n                    static p => p.GetCustomAttribute<FromKeyedServicesAttribute>(inherit: true));\n            }\n\n            public void Clear()\n            {\n                _microsoftServiceKeyAttributePresence.Clear();\n                _fromKeyedServicesAttributes.Clear();\n            }\n\n            public void Clear(ReflectionCacheClearPredicate clearPredicate)\n            {\n                if (clearPredicate is null)\n                {\n                    throw new ArgumentNullException(nameof(clearPredicate));\n                }\n\n                foreach (var parameter in _microsoftServiceKeyAttributePresence.Keys)\n                {\n                    if (Matches(clearPredicate, parameter))\n                    {\n                        _microsoftServiceKeyAttributePresence.TryRemove(parameter, out _);\n                    }\n                }\n\n                foreach (var parameter in _fromKeyedServicesAttributes.Keys)\n                {\n                    if (Matches(clearPredicate, parameter))\n                    {\n                        _fromKeyedServicesAttributes.TryRemove(parameter, out _);\n                    }\n                }\n            }\n\n            private static bool Matches(ReflectionCacheClearPredicate clearPredicate, ParameterInfo parameter)\n            {\n                var member = parameter.Member;\n                var memberAssembly = member.Module.Assembly;\n                var parameterAssembly = parameter.ParameterType.Assembly;\n\n                if (ReferenceEquals(memberAssembly, parameterAssembly))\n                {\n                    return clearPredicate(member, new[] { memberAssembly });\n                }\n\n                return clearPredicate(member, new[] { memberAssembly, parameterAssembly });\n            }\n        }\n    }\n\n    /// <summary>\n    /// A <see cref=\"Parameter\"/> that supplies the service key for parameters\n    /// marked with <see cref=\"Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute\"/>.\n    /// Uses a field instead of a closure to avoid delegate/closure allocations.\n    /// </summary>\n    private sealed class MicrosoftServiceKeyParameter : Parameter\n    {\n        private readonly object _serviceKey;\n\n        public MicrosoftServiceKeyParameter(object serviceKey)\n        {\n            _serviceKey = serviceKey;\n        }\n\n        public override bool CanSupplyValue(ParameterInfo pi, IComponentContext context, [NotNullWhen(true)] out Func<object?>? valueProvider)\n        {\n            if (ParameterAttributeCache.HasMicrosoftServiceKey(pi))\n            {\n                var key = _serviceKey;\n                valueProvider = () => KeyTypeManipulation.ChangeToCompatibleType(key, pi.ParameterType, pi);\n                return true;\n            }\n\n            valueProvider = null;\n            return false;\n        }\n    }\n\n    /// <summary>\n    /// A <see cref=\"Parameter\"/> that supplies keyed service dependencies for parameters\n    /// marked with <see cref=\"FromKeyedServicesAttribute\"/>.\n    /// Uses a field instead of a closure to avoid delegate/closure allocations.\n    /// </summary>\n    private sealed class FromKeyedServicesParameter : Parameter\n    {\n        private readonly object? _requestedServiceKey;\n\n        public FromKeyedServicesParameter(object? requestedServiceKey)\n        {\n            _requestedServiceKey = requestedServiceKey;\n        }\n\n        public override bool CanSupplyValue(ParameterInfo pi, IComponentContext context, [NotNullWhen(true)] out Func<object?>? valueProvider)\n        {\n            var filter = ParameterAttributeCache.GetFromKeyedServicesAttribute(pi);\n            if (filter is not null)\n            {\n                var key = _requestedServiceKey;\n                valueProvider = () => filter.ResolveParameter(pi, context, key);\n                return true;\n            }\n\n            valueProvider = null;\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/Polyfills/NotNullWhenAttribute.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\n#if NETSTANDARD2_0\n\nnamespace System.Diagnostics.CodeAnalysis;\n\n/// <summary>\n/// Polyfill for <see cref=\"NotNullWhenAttribute\"/> which is not available in netstandard2.0.\n/// Specifies that when a method returns <see cref=\"ReturnValue\"/>,\n/// the parameter will not be null even if the corresponding type allows it.\n/// </summary>\n[AttributeUsage(AttributeTargets.Parameter, Inherited = false)]\ninternal sealed class NotNullWhenAttribute : Attribute\n{\n    /// <summary>\n    /// Initializes a new instance of the <see cref=\"NotNullWhenAttribute\"/> class.\n    /// </summary>\n    /// <param name=\"returnValue\">\n    /// The return value condition. If the method returns this value, the associated parameter will not be null.\n    /// </param>\n    public NotNullWhenAttribute(bool returnValue) => ReturnValue = returnValue;\n\n    /// <summary>\n    /// Gets a value indicating whether the return value should be true or false for the parameter to be non-null.\n    /// </summary>\n    public bool ReturnValue { get; }\n}\n\n#endif\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Runtime.CompilerServices;\n\n[assembly: InternalsVisibleTo(\"Autofac.Extensions.DependencyInjection.Test, PublicKey=00240000048000009400000006020000002400005253413100040000010001008728425885ef385e049261b18878327dfaaf0d666dea3bd2b0e4f18b33929ad4e5fbc9087e7eda3c1291d2de579206d9b4292456abffbe8be6c7060b36da0c33b883e3878eaf7c89fddf29e6e27d24588e81e86f3a22dd7b1a296b5f06fbfb500bbd7410faa7213ef4e2ce7622aefc03169b0324bcd30ccfe9ac8204e4960be6\")]\n[assembly: CLSCompliant(false)]\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/ServiceCollectionExtensions.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Extension methods on <see cref=\"IServiceCollection\"/> to register the <see cref=\"IServiceProviderFactory{TContainerBuilder}\"/>.\n/// </summary>\npublic static class ServiceCollectionExtensions\n{\n    /// <summary>\n    /// Adds the <see cref=\"AutofacServiceProviderFactory\"/> to the service collection. ONLY FOR PRE-ASP.NET 3.0 HOSTING. THIS WON'T WORK\n    /// FOR ASP.NET CORE 3.0+ OR GENERIC HOSTING.\n    /// </summary>\n    /// <param name=\"services\">The service collection to add the factory to.</param>\n    /// <param name=\"configurationAction\">Action on a <see cref=\"ContainerBuilder\"/> that adds component registrations to the container.</param>\n    /// <returns>The service collection.</returns>\n    public static IServiceCollection AddAutofac(this IServiceCollection services, Action<ContainerBuilder>? configurationAction = null)\n    {\n        return services.AddSingleton<IServiceProviderFactory<ContainerBuilder>>(new AutofacServiceProviderFactory(configurationAction));\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/ServiceDescriptorExtensions.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Extensions for working with <see cref=\"ServiceDescriptor\"/>.\n/// </summary>\ninternal static class ServiceDescriptorExtensions\n{\n    /// <summary>\n    /// Normalizes the implementation instance data between keyed and not keyed services.\n    /// </summary>\n    /// <param name=\"descriptor\">\n    /// The <see cref=\"ServiceDescriptor\"/> to normalize.\n    /// </param>\n    /// <returns>\n    /// The appropriate implementation instance from the service descriptor.\n    /// </returns>\n    public static object? NormalizedImplementationInstance(this ServiceDescriptor descriptor) => descriptor.IsKeyedService ? descriptor.KeyedImplementationInstance : descriptor.ImplementationInstance;\n\n    /// <summary>\n    /// Normalizes the implementation type data between keyed and not keyed services.\n    /// </summary>\n    /// <param name=\"descriptor\">\n    /// The <see cref=\"ServiceDescriptor\"/> to normalize.\n    /// </param>\n    /// <returns>\n    /// The appropriate implementation type from the service descriptor.\n    /// </returns>\n    public static Type? NormalizedImplementationType(this ServiceDescriptor descriptor) => descriptor.IsKeyedService ? descriptor.KeyedImplementationType : descriptor.ImplementationType;\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/ServiceProviderExtensions.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Globalization;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Extension methods for use with the <see cref=\"AutofacServiceProvider\"/>.\n/// </summary>\npublic static class ServiceProviderExtensions\n{\n    /// <summary>\n    /// Tries to cast the instance of <see cref=\"ILifetimeScope\"/> from <see cref=\"AutofacServiceProvider\"/> when possible.\n    /// </summary>\n    /// <param name=\"serviceProvider\">The instance of <see cref=\"IServiceProvider\"/>.</param>\n    /// <exception cref=\"InvalidOperationException\">Throws an <see cref=\"InvalidOperationException\"/> when instance of <see cref=\"IServiceProvider\"/> can't be assigned to <see cref=\"AutofacServiceProvider\"/>.</exception>\n    /// <returns>Returns the instance of <see cref=\"ILifetimeScope\"/> exposed by <see cref=\"AutofacServiceProvider\"/>.</returns>\n    public static ILifetimeScope GetAutofacRoot(this IServiceProvider serviceProvider)\n    {\n        if (serviceProvider is not AutofacServiceProvider autofacServiceProvider)\n        {\n            throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, ServiceProviderExtensionsResources.WrongProviderType, serviceProvider?.GetType()));\n        }\n\n        return autofacServiceProvider.LifetimeScope;\n    }\n}\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/ServiceProviderExtensionsResources.resx",
    "content": "﻿<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<root>\n  <!--\n    Microsoft ResX Schema\n\n    Version 2.0\n\n    The primary goals of this format is to allow a simple XML format\n    that is mostly human readable. The generation and parsing of the\n    various data types are done through the TypeConverter classes\n    associated with the data types.\n\n    Example:\n\n    ... ado.net/XML headers & schema ...\n    <resheader name=\"resmimetype\">text/microsoft-resx</resheader>\n    <resheader name=\"version\">2.0</resheader>\n    <resheader name=\"reader\">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>\n    <resheader name=\"writer\">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>\n    <data name=\"Name1\"><value>this is my long string</value><comment>this is a comment</comment></data>\n    <data name=\"Color1\" type=\"System.Drawing.Color, System.Drawing\">Blue</data>\n    <data name=\"Bitmap1\" mimetype=\"application/x-microsoft.net.object.binary.base64\">\n        <value>[base64 mime encoded serialized .NET Framework object]</value>\n    </data>\n    <data name=\"Icon1\" type=\"System.Drawing.Icon, System.Drawing\" mimetype=\"application/x-microsoft.net.object.bytearray.base64\">\n        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>\n        <comment>This is a comment</comment>\n    </data>\n\n    There are any number of \"resheader\" rows that contain simple\n    name/value pairs.\n\n    Each data row contains a name, and value. The row also contains a\n    type or mimetype. Type corresponds to a .NET class that support\n    text/value conversion through the TypeConverter architecture.\n    Classes that don't support this are serialized and stored with the\n    mimetype set.\n\n    The mimetype is used for serialized objects, and tells the\n    ResXResourceReader how to depersist the object. This is currently not\n    extensible. For a given mimetype the value must be set accordingly:\n\n    Note - application/x-microsoft.net.object.binary.base64 is the format\n    that the ResXResourceWriter will generate, however the reader can\n    read any of the formats listed below.\n\n    mimetype: application/x-microsoft.net.object.binary.base64\n    value   : The object must be serialized with\n            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.soap.base64\n    value   : The object must be serialized with\n            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter\n            : and then encoded with base64 encoding.\n\n    mimetype: application/x-microsoft.net.object.bytearray.base64\n    value   : The object must be serialized into a byte array\n            : using a System.ComponentModel.TypeConverter\n            : and then encoded with base64 encoding.\n    -->\n  <xsd:schema id=\"root\" xmlns=\"\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:msdata=\"urn:schemas-microsoft-com:xml-msdata\">\n    <xsd:import namespace=\"http://www.w3.org/XML/1998/namespace\" />\n    <xsd:element name=\"root\" msdata:IsDataSet=\"true\">\n      <xsd:complexType>\n        <xsd:choice maxOccurs=\"unbounded\">\n          <xsd:element name=\"metadata\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" use=\"required\" type=\"xsd:string\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"assembly\">\n            <xsd:complexType>\n              <xsd:attribute name=\"alias\" type=\"xsd:string\" />\n              <xsd:attribute name=\"name\" type=\"xsd:string\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"data\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n                <xsd:element name=\"comment\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"2\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" msdata:Ordinal=\"1\" />\n              <xsd:attribute name=\"type\" type=\"xsd:string\" msdata:Ordinal=\"3\" />\n              <xsd:attribute name=\"mimetype\" type=\"xsd:string\" msdata:Ordinal=\"4\" />\n              <xsd:attribute ref=\"xml:space\" />\n            </xsd:complexType>\n          </xsd:element>\n          <xsd:element name=\"resheader\">\n            <xsd:complexType>\n              <xsd:sequence>\n                <xsd:element name=\"value\" type=\"xsd:string\" minOccurs=\"0\" msdata:Ordinal=\"1\" />\n              </xsd:sequence>\n              <xsd:attribute name=\"name\" type=\"xsd:string\" use=\"required\" />\n            </xsd:complexType>\n          </xsd:element>\n        </xsd:choice>\n      </xsd:complexType>\n    </xsd:element>\n  </xsd:schema>\n  <resheader name=\"resmimetype\">\n    <value>text/microsoft-resx</value>\n  </resheader>\n  <resheader name=\"version\">\n    <value>2.0</value>\n  </resheader>\n  <resheader name=\"reader\">\n    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <resheader name=\"writer\">\n    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>\n  </resheader>\n  <data name=\"WrongProviderType\" xml:space=\"preserve\">\n    <value>Unable to retrieve Autofac root lifetime scope from service provider of type {0}.</value>\n  </data>\n</root>\n"
  },
  {
    "path": "src/Autofac.Extensions.DependencyInjection/TypeExtensions.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\nusing System.Collections.Concurrent;\nusing Autofac.Core;\n\nnamespace Autofac.Extensions.DependencyInjection;\n\n/// <summary>\n/// Extensions for working with types.\n/// </summary>\ninternal static class TypeExtensions\n{\n    private static readonly TypeExtensionsReflectionCache ReflectionCache = new();\n\n    static TypeExtensions()\n    {\n        ReflectionCacheSet.Shared.RegisterExternalCache(ReflectionCache);\n    }\n\n    /// <summary>\n    /// Checks a type to determine if it is some kind of collection or enumerable.\n    /// </summary>\n    /// <param name=\"serviceType\">\n    /// The type to check.\n    /// </param>\n    /// <returns><see langword=\"true\"/> if the type is a collection or enumerable; otherwise, <see langword=\"false\"/>.</returns>\n    internal static bool IsCollection(this Type serviceType)\n    {\n        return ReflectionCache.GetOrAddCollectionType(\n            serviceType,\n            static type =>\n            {\n                if (type.IsArray)\n                {\n                    return true;\n                }\n\n                if (!type.IsGenericType)\n                {\n                    return false;\n                }\n\n                return IsGenericTypeDefinedBy(type, typeof(IEnumerable<>)) ||\n                       IsGenericListOrCollectionInterfaceType(type);\n            });\n    }\n\n    private static bool IsGenericTypeDefinedBy(Type type, Type openGeneric)\n    {\n        return !type.ContainsGenericParameters &&\n               type.IsGenericType &&\n               type.GetGenericTypeDefinition() == openGeneric;\n    }\n\n    private static bool IsGenericListOrCollectionInterfaceType(Type type)\n    {\n        return IsGenericTypeDefinedBy(type, typeof(IList<>)) ||\n               IsGenericTypeDefinedBy(type, typeof(ICollection<>)) ||\n               IsGenericTypeDefinedBy(type, typeof(IReadOnlyCollection<>)) ||\n               IsGenericTypeDefinedBy(type, typeof(IReadOnlyList<>));\n    }\n\n    [ExcludeFromCodeCoverage]\n    private sealed class TypeExtensionsReflectionCache : IReflectionCache\n    {\n        private readonly ConcurrentDictionary<Type, bool> _collectionTypeCache = new();\n\n        public ReflectionCacheUsage Usage => ReflectionCacheUsage.Resolution;\n\n        public bool GetOrAddCollectionType(Type serviceType, Func<Type, bool> valueFactory)\n        {\n            return _collectionTypeCache.GetOrAdd(serviceType, valueFactory);\n        }\n\n        public void Clear()\n        {\n            _collectionTypeCache.Clear();\n        }\n\n        public void Clear(ReflectionCacheClearPredicate clearPredicate)\n        {\n            if (clearPredicate is null)\n            {\n                throw new ArgumentNullException(nameof(clearPredicate));\n            }\n\n            foreach (var type in _collectionTypeCache.Keys)\n            {\n                if (clearPredicate(type, new[] { type.Assembly }))\n                {\n                    _collectionTypeCache.TryRemove(type, out _);\n                }\n            }\n        }\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Integration.Test/Autofac.Extensions.DependencyInjection.Integration.Test.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n  <PropertyGroup>\n    <TargetFrameworks>net10.0;net8.0</TargetFrameworks>\n    <NoWarn>$(NoWarn);CS1591</NoWarn>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <AssemblyOriginatorKeyFile>../../Autofac.snk</AssemblyOriginatorKeyFile>\n    <SignAssembly>true</SignAssembly>\n    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>\n    <CodeAnalysisRuleSet>../../build/Test.ruleset</CodeAnalysisRuleSet>\n    <AnalysisMode>AllEnabledByDefault</AnalysisMode>\n    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>\n    <IsPackable>false</IsPackable>\n    <LangVersion>latest</LangVersion>\n    <ImplicitUsings>enable</ImplicitUsings>\n  </PropertyGroup>\n\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\src\\Autofac.Extensions.DependencyInjection\\Autofac.Extensions.DependencyInjection.csproj\" />\n  </ItemGroup>\n  <ItemGroup>\n    <AdditionalFiles Include=\"..\\..\\build\\stylecop.json\" Link=\"stylecop.json\" />\n  </ItemGroup>\n  <ItemGroup Condition=\" '$(TargetFramework)' == 'net8.0' \">\n    <PackageReference Include=\"Microsoft.AspNetCore.Mvc.Testing\" Version=\"8.0.25\" />\n    <ProjectReference Include=\"..\\Integration.Net8\\Integration.Net8.csproj\" />\n  </ItemGroup>\n  <ItemGroup Condition=\" '$(TargetFramework)' == 'net10.0' \">\n    <PackageReference Include=\"Microsoft.AspNetCore.Mvc.Testing\" Version=\"10.0.4\" />\n    <ProjectReference Include=\"..\\Integration.Net10\\Integration.Net10.csproj\" />\n  </ItemGroup>\n  <ItemGroup>\n    <PackageReference Include=\"coverlet.collector\" Version=\"8.0.0\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"18.3.0\" />\n    <PackageReference Include=\"StyleCop.Analyzers\" Version=\"1.2.0-beta.556\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n    <PackageReference Include=\"xunit\" Version=\"2.9.3\" />\n    <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"3.1.5\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>\n    </PackageReference>\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Integration.Test/IntegrationTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.AspNetCore.Mvc.Testing;\nusing Xunit;\n\n#if NET10_0\nusing Integration.Net10;\n#endif\n#if NET8_0\nusing Integration.Net8;\n#endif\n\nnamespace Autofac.Extensions.DependencyInjection.Integration.Test;\n\npublic class IntegrationTests : IClassFixture<WebApplicationFactory<Startup>>\n{\n    public IntegrationTests(WebApplicationFactory<Startup> appFactory)\n    {\n        AppFactory = appFactory;\n    }\n\n    public WebApplicationFactory<Startup> AppFactory { get; }\n\n    [Fact]\n    public async Task GetDate()\n    {\n        var client = AppFactory.CreateClient();\n        var response = await client.GetAsync(new Uri(\"/Date\", UriKind.Relative));\n        response.EnsureSuccessStatusCode();\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Integration.Test/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\n[assembly: CLSCompliant(false)]\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Assertions.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Autofac.Core;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\ninternal static class Assertions\n{\n    public static void AssertRegistered<TService>(this IComponentContext context)\n    {\n        Assert.True(context.IsRegistered<TService>());\n    }\n\n    public static void AssertNotRegistered<TService>(this IComponentContext context)\n    {\n        Assert.False(context.IsRegistered<TService>());\n    }\n\n    public static void AssertImplementation<TService, TImplementation>(this IComponentContext context)\n    {\n        var service = context.Resolve<TService>();\n        Assert.IsAssignableFrom<TImplementation>(service);\n    }\n\n    public static void AssertSharing<TService>(this IComponentContext context, InstanceSharing sharing)\n    {\n        var cr = context.RegistrationFor<TService>();\n        Assert.Equal(sharing, cr.Sharing);\n    }\n\n    public static void AssertLifetime<TService, TLifetime>(this IComponentContext context)\n    {\n        var cr = context.RegistrationFor<TService>();\n        Assert.IsType<TLifetime>(cr.Lifetime);\n    }\n\n    public static void AssertOwnership<TService>(this IComponentContext context, InstanceOwnership ownership)\n    {\n        var cr = context.RegistrationFor<TService>();\n        Assert.Equal(ownership, cr.Ownership);\n    }\n\n    public static IComponentRegistration RegistrationFor<TService>(this IComponentContext context)\n    {\n        Assert.True(context.ComponentRegistry.TryGetRegistration(new TypedService(typeof(TService)), out IComponentRegistration r));\n        return r;\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Autofac.Extensions.DependencyInjection.Test.csproj",
    "content": "﻿<Project Sdk=\"Microsoft.NET.Sdk\">\n  <PropertyGroup>\n    <TargetFrameworks>net10.0;net8.0</TargetFrameworks>\n    <NoWarn>$(NoWarn);CS1591</NoWarn>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <AssemblyOriginatorKeyFile>../../Autofac.snk</AssemblyOriginatorKeyFile>\n    <SignAssembly>true</SignAssembly>\n    <GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>\n    <CodeAnalysisRuleSet>../../build/Test.ruleset</CodeAnalysisRuleSet>\n    <AnalysisMode>AllEnabledByDefault</AnalysisMode>\n    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>\n    <IsPackable>false</IsPackable>\n    <LangVersion>latest</LangVersion>\n    <ImplicitUsings>enable</ImplicitUsings>\n  </PropertyGroup>\n  <ItemGroup>\n    <Using Include=\"Xunit\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\src\\Autofac.Extensions.DependencyInjection\\Autofac.Extensions.DependencyInjection.csproj\" />\n  </ItemGroup>\n  <ItemGroup>\n    <AdditionalFiles Include=\"..\\..\\build\\stylecop.json\" Link=\"stylecop.json\" />\n  </ItemGroup>\n  <ItemGroup>\n    <PackageReference Include=\"coverlet.collector\" Version=\"8.0.0\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n    <PackageReference Include=\"Microsoft.Extensions.DependencyInjection\" Version=\"10.0.4\" />\n    <PackageReference Include=\"Microsoft.Extensions.DependencyInjection.Specification.Tests\" Version=\"10.0.4\" />\n    <PackageReference Include=\"Microsoft.Extensions.Options\" Version=\"10.0.4\" />\n    <PackageReference Include=\"Microsoft.NET.Test.Sdk\" Version=\"18.3.0\" />\n    <PackageReference Include=\"StyleCop.Analyzers\" Version=\"1.2.0-beta.556\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n    <PackageReference Include=\"xunit\" Version=\"2.9.3\" />\n    <PackageReference Include=\"xunit.runner.visualstudio\" Version=\"3.1.5\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>\n    </PackageReference>\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/AutofacChildLifetimeScopeConfigurationAdapterTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic sealed class AutofacChildLifetimeScopeConfigurationAdapterTests\n{\n    [Fact]\n    public void AddMultipleConfigurationContainsConfigurations()\n    {\n        var adapter = new AutofacChildLifetimeScopeConfigurationAdapter();\n        adapter.Add(builder => { });\n        adapter.Add(builder => { });\n\n        Assert.Equal(2, adapter.ConfigurationActions.Count);\n    }\n\n    [Fact]\n    public void AddNullConfigurationThrows()\n        => Assert.Throws<ArgumentNullException>(() => new AutofacChildLifetimeScopeConfigurationAdapter().Add(null));\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/AutofacChildLifetimeScopeServiceProviderFactoryTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Diagnostics.CodeAnalysis;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic sealed class AutofacChildLifetimeScopeServiceProviderFactoryTests\n{\n    [Fact]\n    public void CreateBuilderReturnsNewInstance()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScope);\n\n        var configurationAdapter = factory.CreateBuilder(new ServiceCollection());\n\n        Assert.NotNull(configurationAdapter);\n    }\n\n    [Fact]\n    public void CreateBuilderExecutesConfigurationActionWhenProvided()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScope, b => b.Register(c => \"Foo\"));\n\n        var configurationAdapter = factory.CreateBuilder(new ServiceCollection());\n\n        var builder = new ContainerBuilder();\n\n        foreach (var action in configurationAdapter.ConfigurationActions)\n        {\n            action(builder);\n        }\n\n        Assert.Equal(\"Foo\", builder.Build().Resolve<string>());\n    }\n\n    [Fact]\n    public void CreateBuilderAllowsForNullConfigurationAction()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScope);\n\n        var configurationAdapter = factory.CreateBuilder(new ServiceCollection());\n\n        Assert.NotNull(configurationAdapter);\n    }\n\n    [Fact]\n    public void CreateBuilderReturnsInstanceWithServicesPopulated()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScope);\n        var services = new ServiceCollection().AddTransient<object>();\n\n        var configurationAdapter = factory.CreateBuilder(services);\n\n        var builder = new ContainerBuilder();\n\n        foreach (var action in configurationAdapter.ConfigurationActions)\n        {\n            action(builder);\n        }\n\n        Assert.True(builder.Build().IsRegistered<object>());\n    }\n\n    [Fact]\n    public void CreateServiceProviderBuildsServiceProviderUsingAdapter()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScope);\n        var services = new ServiceCollection().AddTransient<object>();\n        var configurationAdapter = factory.CreateBuilder(services);\n\n        var serviceProvider = factory.CreateServiceProvider(configurationAdapter);\n\n        Assert.NotNull(serviceProvider.GetService(typeof(object)));\n    }\n\n    [Fact]\n    public void CreateServiceProviderThrowsWhenProvidedNullAdapter()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScope);\n\n        var exception = Assert.Throws<ArgumentNullException>(() => factory.CreateServiceProvider(null));\n\n        Assert.Equal(\"containerBuilder\", exception.ParamName);\n    }\n\n    [Fact]\n    public void CreateServiceProviderReturnsAutofacServiceProvider()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScope);\n\n        var serviceProvider = factory.CreateServiceProvider(new AutofacChildLifetimeScopeConfigurationAdapter());\n\n        Assert.IsType<AutofacServiceProvider>(serviceProvider);\n    }\n\n    [Fact]\n    public void CreateServiceProviderAddDepToServiceCollectionAndAddConfigurationTypesResolvable()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScope);\n\n        var services = new ServiceCollection().AddTransient<DependencyOne>();\n\n        var configurationAdapter = factory.CreateBuilder(services);\n\n        configurationAdapter.Add(builder => builder.RegisterType<DependencyTwo>());\n\n        var serviceProvider = factory.CreateServiceProvider(configurationAdapter);\n\n        serviceProvider.GetRequiredService<DependencyOne>();\n        serviceProvider.GetRequiredService<DependencyTwo>();\n    }\n\n    [Fact]\n    public void CreateServiceProviderAddDepToRootContainerResolvable()\n    {\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(GetRootLifetimeScopeWithDependency<DependencyOne>(typeof(DependencyOne)));\n\n        var configurationAdapter = factory.CreateBuilder(new ServiceCollection());\n\n        var serviceProvider = factory.CreateServiceProvider(configurationAdapter);\n\n        serviceProvider.GetRequiredService<DependencyOne>();\n    }\n\n    [Fact]\n    public void Ctor_NullRootAccessor()\n    {\n        Assert.Throws<ArgumentNullException>(() => new AutofacChildLifetimeScopeServiceProviderFactory((Func<ILifetimeScope>)null!));\n    }\n\n    [Fact]\n    public void Ctor_NullRootScope()\n    {\n        Assert.Throws<ArgumentNullException>(() => new AutofacChildLifetimeScopeServiceProviderFactory((ILifetimeScope)null!));\n    }\n\n    private static ILifetimeScope GetRootLifetimeScope() => new ContainerBuilder().Build();\n\n    private static ILifetimeScope GetRootLifetimeScopeWithDependency<TAs>(Type type)\n    {\n        var containerBuilder = new ContainerBuilder();\n\n        containerBuilder\n            .RegisterType(type)\n            .As<TAs>();\n\n        return containerBuilder.Build();\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Instantiated via dependency injection.\")]\n    private class DependencyOne\n    {\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Instantiated via dependency injection.\")]\n    private class DependencyTwo\n    {\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/AutofacRegistrationTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Diagnostics.CodeAnalysis;\nusing Autofac.Core;\nusing Autofac.Core.Lifetime;\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.Options;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic class AutofacRegistrationTests\n{\n    [Fact]\n    public void PopulateRegistersServiceProvider()\n    {\n        var builder = new ContainerBuilder();\n        builder.Populate(Enumerable.Empty<ServiceDescriptor>());\n        var container = builder.Build();\n\n        container.AssertRegistered<IServiceProvider>();\n    }\n\n    [Fact]\n    public void PopulateThrowsForNullBuilder()\n    {\n        Assert.Throws<ArgumentNullException>(() => AutofacRegistration.Populate(null, Enumerable.Empty<ServiceDescriptor>()));\n    }\n\n    [Fact]\n    public void PopulateThrowsForNullDescriptors()\n    {\n        Assert.Throws<ArgumentNullException>(() => new ContainerBuilder().Populate(null));\n    }\n\n    [Fact]\n    public void CorrectServiceProviderIsRegistered()\n    {\n        var builder = new ContainerBuilder();\n        builder.Populate(Enumerable.Empty<ServiceDescriptor>());\n        var container = builder.Build();\n\n        container.AssertImplementation<IServiceProvider, AutofacServiceProvider>();\n    }\n\n    [Fact]\n    public void ServiceProviderInstancesAreNotTracked()\n    {\n        var builder = new ContainerBuilder();\n        builder.Populate(Enumerable.Empty<ServiceDescriptor>());\n        var container = builder.Build();\n\n        container.AssertOwnership<IServiceProvider>(InstanceOwnership.ExternallyOwned);\n    }\n\n    [Fact]\n    public void PopulateRegistersServiceScopeFactory()\n    {\n        var builder = new ContainerBuilder();\n        builder.Populate(Enumerable.Empty<ServiceDescriptor>());\n        var container = builder.Build();\n\n        container.AssertRegistered<IServiceScopeFactory>();\n    }\n\n    [Fact]\n    public void ServiceScopeFactoryIsRegistered()\n    {\n        var builder = new ContainerBuilder();\n        builder.Populate(Enumerable.Empty<ServiceDescriptor>());\n        var container = builder.Build();\n\n        container.AssertImplementation<IServiceScopeFactory, AutofacServiceScopeFactory>();\n    }\n\n    [Fact]\n    public void CanRegisterTransientService()\n    {\n        var builder = new ContainerBuilder();\n        var descriptor = new ServiceDescriptor(typeof(IService), typeof(Service), ServiceLifetime.Transient);\n        builder.Populate(new ServiceDescriptor[] { descriptor });\n        var container = builder.Build();\n\n        container.AssertLifetime<IService, CurrentScopeLifetime>();\n        container.AssertSharing<IService>(InstanceSharing.None);\n        container.AssertOwnership<IService>(InstanceOwnership.OwnedByLifetimeScope);\n    }\n\n    [Fact]\n    public void CanRegisterSingletonService()\n    {\n        var builder = new ContainerBuilder();\n        var descriptor = new ServiceDescriptor(typeof(IService), typeof(Service), ServiceLifetime.Singleton);\n        builder.Populate(new ServiceDescriptor[] { descriptor });\n        var container = builder.Build();\n\n        container.AssertLifetime<IService, RootScopeLifetime>();\n        container.AssertSharing<IService>(InstanceSharing.Shared);\n        container.AssertOwnership<IService>(InstanceOwnership.OwnedByLifetimeScope);\n    }\n\n    [Fact]\n    public void CanRebaseSingletonServiceToNamedLifetimeScope()\n    {\n        var builder = new ContainerBuilder();\n        var descriptor = new ServiceDescriptor(typeof(IService), typeof(Service), ServiceLifetime.Singleton);\n        builder.Populate(new ServiceDescriptor[] { descriptor }, \"MY_SCOPE\");\n        var container = builder.Build();\n\n        container.AssertLifetime<IService, MatchingScopeLifetime>();\n        container.AssertSharing<IService>(InstanceSharing.Shared);\n        container.AssertOwnership<IService>(InstanceOwnership.OwnedByLifetimeScope);\n    }\n\n    [Fact]\n    public void CanRegisterScopedService()\n    {\n        var builder = new ContainerBuilder();\n        var descriptor = new ServiceDescriptor(typeof(IService), typeof(Service), ServiceLifetime.Scoped);\n        builder.Populate(new ServiceDescriptor[] { descriptor });\n        var container = builder.Build();\n\n        container.AssertLifetime<IService, CurrentScopeLifetime>();\n        container.AssertSharing<IService>(InstanceSharing.Shared);\n        container.AssertOwnership<IService>(InstanceOwnership.OwnedByLifetimeScope);\n    }\n\n    [Fact]\n    public void CanRegisterGenericService()\n    {\n        var builder = new ContainerBuilder();\n        var descriptor = new ServiceDescriptor(typeof(IList<>), typeof(List<>), ServiceLifetime.Scoped);\n        builder.Populate(new ServiceDescriptor[] { descriptor });\n        var container = builder.Build();\n\n        container.AssertRegistered<IList<IService>>();\n    }\n\n    [Fact]\n    public void CanRegisterFactoryService()\n    {\n        var builder = new ContainerBuilder();\n        var descriptor = new ServiceDescriptor(typeof(IService), sp => new Service(), ServiceLifetime.Transient);\n        builder.Populate(new ServiceDescriptor[] { descriptor });\n        var container = builder.Build();\n\n        container.AssertRegistered<Func<IServiceProvider, IService>>();\n    }\n\n    [Fact]\n    public void CanResolveOptionsFromChildScopeProvider()\n    {\n        // Issue #32: Registering options in a child scope fails to resolve IOptions<T>.\n        var container = new ContainerBuilder().Build();\n        var scope = container.BeginLifetimeScope(b =>\n        {\n            var services = new ServiceCollection();\n            services\n                .AddOptions()\n                .Configure<TestOptions>(opt =>\n                {\n                    opt.Value = 6;\n                });\n            b.Populate(services);\n        });\n\n        using var provider = new AutofacServiceProvider(scope);\n        var options = provider.GetRequiredService<IOptions<TestOptions>>();\n        Assert.Equal(6, options.Value.Value);\n    }\n\n    [Fact]\n    public void CanGenerateFactoryService()\n    {\n        var builder = new ContainerBuilder();\n        var descriptor = new ServiceDescriptor(typeof(IService), typeof(Service), ServiceLifetime.Transient);\n        builder.Populate(new ServiceDescriptor[] { descriptor });\n        var container = builder.Build();\n\n        container.AssertRegistered<Func<IService>>();\n    }\n\n    [Fact]\n    public void ServiceCollectionConfigurationIsRetainedInRootContainer()\n    {\n        var collection = new ServiceCollection();\n        collection.AddOptions();\n        collection.Configure<TestOptions>(options =>\n        {\n            options.Value = 5;\n        });\n\n        var builder = new ContainerBuilder();\n        builder.Populate(collection);\n        var container = builder.Build();\n\n        var resolved = container.Resolve<IOptions<TestOptions>>();\n        Assert.NotNull(resolved.Value);\n        Assert.Equal(5, resolved.Value.Value);\n    }\n\n    [Fact]\n    public void RegistrationsAddedAfterPopulateComeLastWhenResolvedWithIEnumerable()\n    {\n        const string s1 = \"s1\";\n        const string s2 = \"s2\";\n        const string s3 = \"s3\";\n        const string s4 = \"s4\";\n\n        var collection = new ServiceCollection();\n        collection.AddTransient(provider => s1);\n        collection.AddTransient(provider => s2);\n        var builder = new ContainerBuilder();\n        builder.Populate(collection);\n        builder.Register(c => s3);\n        builder.Register(c => s4);\n        var container = builder.Build();\n\n        var resolved = container.Resolve<IEnumerable<string>>().ToArray();\n\n        Assert.Equal(resolved, new[] { s1, s2, s3, s4 });\n    }\n\n    [Fact]\n    public void RegistrationsAddedBeforePopulateComeFirstWhenResolvedWithIEnumerable()\n    {\n        const string s1 = \"s1\";\n        const string s2 = \"s2\";\n        const string s3 = \"s3\";\n        const string s4 = \"s4\";\n\n        var builder = new ContainerBuilder();\n        builder.Register(c => s1);\n        builder.Register(c => s2);\n        var collection = new ServiceCollection();\n        collection.AddTransient(provider => s3);\n        collection.AddTransient(provider => s4);\n        builder.Populate(collection);\n        var container = builder.Build();\n\n        var resolved = container.Resolve<IEnumerable<string>>().ToArray();\n\n        Assert.Equal(resolved, new[] { s1, s2, s3, s4 });\n    }\n\n    private class Service : IService\n    {\n    }\n\n    private interface IService\n    {\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Instantiated via dependency injection.\")]\n    private class TestOptions\n    {\n        public int Value { get; set; }\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/AutofacServiceProviderFactoryTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Autofac.Builder;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic class AutofacServiceProviderFactoryTests\n{\n    [Fact]\n    public void CreateBuilderReturnsNewInstance()\n    {\n        var factory = new AutofacServiceProviderFactory();\n\n        var builder = factory.CreateBuilder(new ServiceCollection());\n\n        Assert.NotNull(builder);\n    }\n\n    [Fact]\n    public void CreateBuilderExecutesConfigurationActionWhenProvided()\n    {\n        var factory = new AutofacServiceProviderFactory(config => config.Register(c => \"Foo\"));\n\n        var builder = factory.CreateBuilder(new ServiceCollection());\n\n        Assert.Equal(\"Foo\", builder.Build().Resolve<string>());\n    }\n\n    [Fact]\n    public void CreateBuilderAllowsForNullConfigurationAction()\n    {\n        var factory = new AutofacServiceProviderFactory();\n\n        var builder = factory.CreateBuilder(new ServiceCollection());\n\n        Assert.NotNull(builder);\n    }\n\n    [Fact]\n    public void CreateBuilderReturnsInstanceWithServicesPopulated()\n    {\n        var factory = new AutofacServiceProviderFactory();\n        var services = new ServiceCollection();\n        services.AddTransient<object>();\n\n        var builder = factory.CreateBuilder(services);\n\n        Assert.True(builder.Build().IsRegistered<object>());\n    }\n\n    [Fact]\n    public void CreateServiceProviderBuildsServiceProviderUsingContainerBuilder()\n    {\n        var factory = new AutofacServiceProviderFactory();\n        var services = new ServiceCollection().AddTransient<object>();\n        var builder = factory.CreateBuilder(services);\n\n        var serviceProvider = factory.CreateServiceProvider(builder);\n\n        Assert.NotNull(serviceProvider.GetService(typeof(object)));\n    }\n\n    [Fact]\n    public void CreateServiceProviderThrowsWhenProvidedNullContainerBuilder()\n    {\n        var factory = new AutofacServiceProviderFactory();\n\n        var exception = Assert.Throws<ArgumentNullException>(() => factory.CreateServiceProvider(null));\n\n        Assert.Equal(\"containerBuilder\", exception.ParamName);\n    }\n\n    [Fact]\n    public void CreateServiceProviderReturnsAutofacServiceProvider()\n    {\n        var factory = new AutofacServiceProviderFactory();\n\n        var serviceProvider = factory.CreateServiceProvider(new ContainerBuilder());\n\n        Assert.IsType<AutofacServiceProvider>(serviceProvider);\n    }\n\n    [Fact]\n    public void CreateServiceProviderUsesDefaultContainerBuildOptionsWhenNotProvided()\n    {\n        var factory = new AutofacServiceProviderFactory();\n        var services = new ServiceCollection().AddSingleton(\"Foo\");\n        var builder = factory.CreateBuilder(services);\n\n        var serviceProvider = factory.CreateServiceProvider(builder);\n\n        Assert.NotNull(serviceProvider.GetService<Lazy<string>>());\n    }\n\n    [Fact]\n    public void CreateServiceProviderUsesContainerBuildOptionsWhenProvided()\n    {\n        var options = ContainerBuildOptions.ExcludeDefaultModules;\n        var factory = new AutofacServiceProviderFactory(options);\n        var services = new ServiceCollection().AddSingleton(\"Foo\");\n        var builder = factory.CreateBuilder(services);\n\n        var serviceProvider = factory.CreateServiceProvider(builder);\n\n        Assert.Null(serviceProvider.GetService<Lazy<string>>());\n    }\n\n    [Fact]\n    public void CanProvideContainerBuildOptionsAndConfigurationAction()\n    {\n        var factory = new AutofacServiceProviderFactory(\n            ContainerBuildOptions.ExcludeDefaultModules,\n            config => config.Register(c => \"Foo\"));\n        var builder = factory.CreateBuilder(new ServiceCollection());\n\n        var serviceProvider = factory.CreateServiceProvider(builder);\n\n        Assert.NotNull(serviceProvider.GetService<string>());\n        Assert.Null(serviceProvider.GetService<Lazy<string>>());\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/AutofacServiceProviderTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Autofac.Builder;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\n// Most of the functionality is verified via the specification tests. These are some extras for error handling, etc.\npublic class AutofacServiceProviderTests\n{\n    [Fact]\n    public void Ctor_NullLifetimeScope()\n    {\n        Assert.Throws<ArgumentNullException>(() => new AutofacServiceProvider(null!));\n    }\n\n    [Fact]\n    public void GetKeyedService_NullServiceType()\n    {\n        using var provider = new AutofacServiceProvider(new ContainerBuilder().Build());\n        Assert.Throws<ArgumentNullException>(() => provider.GetKeyedService(null!, \"key\"));\n    }\n\n    [Fact]\n    public void GetRequiredKeyedService_NullServiceType()\n    {\n        using var provider = new AutofacServiceProvider(new ContainerBuilder().Build());\n        Assert.Throws<ArgumentNullException>(() => provider.GetRequiredKeyedService(null!, \"key\"));\n    }\n\n    [Fact]\n    public void GetRequiredService_DependencyResolutionFails()\n    {\n        var builder = new ContainerBuilder();\n        using var provider = new AutofacServiceProvider(builder.Build());\n        Assert.Throws<InvalidOperationException>(() => provider.GetRequiredService<DivideByZeroException>());\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/FromKeyedServicesAttributeExtensionsTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Reflection;\nusing Autofac.Core;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic class FromKeyedServicesAttributeExtensionsTests\n{\n    [Fact]\n    public void ResolveParameterExplicitKey()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.Explicit));\n        var parameter = GetParameter(nameof(ParameterTargets.Explicit));\n\n        var value = attribute.ResolveParameter(parameter, container, parentServiceKey: \"parent\");\n\n        Assert.IsType<KeyedService>(value);\n    }\n\n    [Fact]\n    public void ResolveParameterInheritedAnyKeyUsedForCollection()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.InheritedCollection));\n        var parameter = GetParameter(nameof(ParameterTargets.InheritedCollection));\n\n        var value = attribute.ResolveParameter(parameter, container, parentServiceKey: Microsoft.Extensions.DependencyInjection.KeyedService.AnyKey);\n\n        var services = Assert.IsAssignableFrom<IEnumerable<IService>>(value);\n        Assert.NotEmpty(services);\n    }\n\n    [Fact]\n    public void ResolveParameterInheritedAnyKeyUsedForNonCollection()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.Inherited));\n        var parameter = GetParameter(nameof(ParameterTargets.Inherited));\n\n        Assert.Throws<DependencyResolutionException>(() =>\n            attribute.ResolveParameter(parameter, container, parentServiceKey: Microsoft.Extensions.DependencyInjection.KeyedService.AnyKey));\n    }\n\n    [Fact]\n    public void ResolveParameterInheritedKey()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.Inherited));\n        var parameter = GetParameter(nameof(ParameterTargets.Inherited));\n\n        var value = attribute.ResolveParameter(parameter, container, parentServiceKey: \"inherited\");\n\n        Assert.IsType<InheritedKeyedService>(value);\n    }\n\n    [Fact]\n    public void ResolveParameterInheritedKeyIsNull()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.InheritedWithDefault));\n        var parameter = GetParameter(nameof(ParameterTargets.InheritedWithDefault));\n\n        var value = attribute.ResolveParameter(parameter, container, parentServiceKey: null);\n\n        Assert.Equal(\"fallback\", value);\n    }\n\n    [Fact]\n    public void ResolveParameterKeyedServiceMissingAndNoDefault()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.ExplicitMissingNoDefault));\n        var parameter = GetParameter(nameof(ParameterTargets.ExplicitMissingNoDefault));\n\n        var ex = Assert.Throws<InvalidOperationException>(() => attribute.ResolveParameter(parameter, container, parentServiceKey: \"missing\"));\n\n        Assert.Contains(\"using key\", ex.Message, StringComparison.Ordinal);\n    }\n\n    [Fact]\n    public void ResolveParameterNullAttribute()\n    {\n        using var container = BuildContainer();\n        var parameter = GetParameter(nameof(ParameterTargets.Explicit));\n\n        var ex = Assert.Throws<ArgumentNullException>(() =>\n            FromKeyedServicesAttributeExtensions.ResolveParameter(null!, parameter, container, parentServiceKey: null));\n\n        Assert.Equal(\"attribute\", ex.ParamName);\n    }\n\n    [Fact]\n    public void ResolveParameterNullContext()\n    {\n        var attribute = GetAttribute(nameof(ParameterTargets.Explicit));\n        var parameter = GetParameter(nameof(ParameterTargets.Explicit));\n\n        var ex = Assert.Throws<ArgumentNullException>(() =>\n            attribute.ResolveParameter(parameter, null!, parentServiceKey: null));\n\n        Assert.Equal(\"context\", ex.ParamName);\n    }\n\n    [Fact]\n    public void ResolveParameterNullParameter()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.Explicit));\n\n        var ex = Assert.Throws<ArgumentNullException>(() =>\n            attribute.ResolveParameter(null!, container, parentServiceKey: null));\n\n        Assert.Equal(\"parameter\", ex.ParamName);\n    }\n\n    [Fact]\n    public void ResolveParameterResolveFails()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.ExplicitWithDefault));\n        var parameter = GetParameter(nameof(ParameterTargets.ExplicitWithDefault));\n\n        var value = attribute.ResolveParameter(parameter, container, parentServiceKey: null);\n\n        Assert.Equal(\"fallback\", value);\n    }\n\n    [Fact]\n    public void ResolveParameterUnkeyedServiceMissingAndNoDefault()\n    {\n        using var container = BuildContainer();\n        var attribute = GetAttribute(nameof(ParameterTargets.NullKeyNoDefault));\n        var parameter = GetParameter(nameof(ParameterTargets.NullKeyNoDefault));\n\n        var ex = Assert.Throws<InvalidOperationException>(() => attribute.ResolveParameter(parameter, container, parentServiceKey: null));\n\n        Assert.Contains(\"Unable to resolve service for type\", ex.Message, StringComparison.Ordinal);\n        Assert.DoesNotContain(\"using key\", ex.Message, StringComparison.Ordinal);\n    }\n\n    private static IContainer BuildContainer()\n    {\n        var builder = new ContainerBuilder();\n        builder.RegisterType<KeyedService>().Keyed<IService>(\"explicit\");\n        builder.RegisterType<InheritedKeyedService>().Keyed<IService>(\"inherited\");\n        return builder.Build();\n    }\n\n    private static FromKeyedServicesAttribute GetAttribute(string methodName)\n    {\n        return GetParameter(methodName).GetCustomAttribute<FromKeyedServicesAttribute>()!;\n    }\n\n    private static ParameterInfo GetParameter(string methodName)\n    {\n        return typeof(ParameterTargets).GetMethod(methodName)!.GetParameters()[0];\n    }\n\n    private interface IService\n    {\n    }\n\n    private sealed class KeyedService : IService\n    {\n    }\n\n    private sealed class InheritedKeyedService : IService\n    {\n    }\n\n    private sealed class ParameterTargets\n    {\n        public void Explicit([FromKeyedServices(\"explicit\")] IService service)\n        {\n        }\n\n        public void Inherited([FromKeyedServices] IService service)\n        {\n        }\n\n        public void InheritedCollection([FromKeyedServices] IEnumerable<IService> service)\n        {\n        }\n\n        public void InheritedWithDefault([FromKeyedServices] string service = \"fallback\")\n        {\n        }\n\n        public void ExplicitWithDefault([FromKeyedServices(\"missing\")] string service = \"fallback\")\n        {\n        }\n\n        public void ExplicitMissingNoDefault([FromKeyedServices(\"missing\")] IService service)\n        {\n        }\n\n        public void NullKeyNoDefault([FromKeyedServices(null)] string service)\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/FromKeyedServicesUsageCacheTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Autofac.Core;\nusing Autofac.Core.Activators.Reflection;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic class FromKeyedServicesUsageCacheTests\n{\n    [Fact]\n    public void RequiresFromKeyedServicesMiddlewareAttributeNotUsed()\n    {\n        var activator = GetReflectionActivator<NoFromKeyedServices>();\n\n        var needsMiddleware = FromKeyedServicesUsageCache.RequiresFromKeyedServicesMiddleware(activator);\n\n        Assert.False(needsMiddleware);\n    }\n\n    [Fact]\n    public void RequiresFromKeyedServicesMiddlewareAttributeUsed()\n    {\n        var activator = GetReflectionActivator<UsesFromKeyedServices>();\n\n        var needsMiddleware = FromKeyedServicesUsageCache.RequiresFromKeyedServicesMiddleware(activator);\n\n        Assert.True(needsMiddleware);\n    }\n\n    [Fact]\n    public void RequiresFromKeyedServicesMiddlewareCachesForSubsequentCalls()\n    {\n        var activator = GetReflectionActivator<UsesFromKeyedServices>();\n\n        var first = FromKeyedServicesUsageCache.RequiresFromKeyedServicesMiddleware(activator);\n        var second = FromKeyedServicesUsageCache.RequiresFromKeyedServicesMiddleware(activator);\n\n        Assert.True(first);\n        Assert.Equal(first, second);\n    }\n\n    [Fact]\n    public void RequiresFromKeyedServicesMiddlewareNullActivator()\n    {\n        var ex = Assert.Throws<ArgumentNullException>(() => FromKeyedServicesUsageCache.RequiresFromKeyedServicesMiddleware(null!));\n        Assert.Equal(\"activator\", ex.ParamName);\n    }\n\n    private static ReflectionActivator GetReflectionActivator<T>()\n        where T : class\n    {\n        var services = new ServiceCollection();\n        services.AddTransient<T>();\n\n        var builder = new ContainerBuilder();\n        builder.Populate(services);\n\n        using var container = builder.Build();\n        var typedService = new TypedService(typeof(T));\n        var registration = container.ComponentRegistry.RegistrationsFor(typedService).Single();\n\n        return Assert.IsType<ReflectionActivator>(registration.Activator);\n    }\n\n    private sealed class UsesFromKeyedServices\n    {\n        public UsesFromKeyedServices([FromKeyedServices(\"k\")] object service)\n        {\n        }\n    }\n\n    private sealed class NoFromKeyedServices\n    {\n        public NoFromKeyedServices(object service)\n        {\n        }\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/KeyTypeManipulationFixture.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.ComponentModel;\nusing System.Diagnostics.CodeAnalysis;\nusing System.Globalization;\nusing System.Net;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic class KeyTypeManipulationFixture\n{\n    [Fact]\n    public void ChangeToCompatibleTypeAllowsNullMemberInfo()\n    {\n        var actual = KeyTypeManipulation.ChangeToCompatibleType(\"123\", typeof(int), (System.Reflection.MemberInfo)null!);\n        Assert.Equal(123, actual);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeAllowsNullParameterInfo()\n    {\n        var actual = KeyTypeManipulation.ChangeToCompatibleType(\"123\", typeof(int), (System.Reflection.ParameterInfo)null!);\n        Assert.Equal(123, actual);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeLooksForTryParseMethod()\n    {\n        var address = \"127.0.0.1\";\n        var value = KeyTypeManipulation.ChangeToCompatibleType(address, typeof(IPAddress));\n        Assert.Equal(value, IPAddress.Parse(address));\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeNoConversionNeeded()\n    {\n        var actual = KeyTypeManipulation.ChangeToCompatibleType(15, typeof(int));\n        Assert.Equal(15, actual);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeNullDestinationType()\n    {\n        var ex = Assert.Throws<ArgumentNullException>(() => KeyTypeManipulation.ChangeToCompatibleType(\"15\", null!));\n        Assert.Equal(\"destinationType\", ex.ParamName);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeNullReferenceType()\n    {\n        var actual = KeyTypeManipulation.ChangeToCompatibleType(null, typeof(string));\n        Assert.Null(actual);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeNullValueType()\n    {\n        var actual = KeyTypeManipulation.ChangeToCompatibleType(null, typeof(int));\n        Assert.Equal(0, actual);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeTryParseFails()\n    {\n        var ex = Assert.Throws<KeyTypeConversionException>(() => KeyTypeManipulation.ChangeToCompatibleType(\"not-valid\", typeof(ParseOnlyType)));\n        Assert.Equal(typeof(string), ex.ResolutionKeyType);\n        Assert.Equal(typeof(ParseOnlyType), ex.AttributeKeyType);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeTypeConverterAttributeCannotConvertFromFallsBackToDefaultConversion()\n    {\n        var actual = KeyTypeManipulation.ChangeToCompatibleType(\n            15,\n            typeof(string),\n            new TypeConverterAttribute(typeof(NonConvertingConverter)));\n\n        Assert.Equal(\"15\", actual);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeTypeConverterAttributeIsInvalid()\n    {\n        var ex = Assert.Throws<KeyTypeConversionException>(() =>\n            KeyTypeManipulation.ChangeToCompatibleType(\"15\", typeof(int), new TypeConverterAttribute(typeof(string))));\n\n        Assert.Equal(typeof(string), ex.ResolutionKeyType);\n        Assert.Equal(typeof(int), ex.AttributeKeyType);\n        Assert.IsType<InvalidOperationException>(ex.InnerException);\n    }\n\n    [Theory]\n    [MemberData(nameof(ParsingCultures))]\n    public void ChangeToCompatibleTypeUsesInvariantCulture(CultureInfo culture)\n    {\n        TestCulture.With(\n            culture,\n            () =>\n            {\n                var actual = KeyTypeManipulation.ChangeToCompatibleType(\"123.456\", typeof(double));\n                Assert.Equal(123.456, actual);\n            });\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeUsesTypeConverterOnParameter()\n    {\n        var ctor = typeof(HasTypeConverterAttributes).GetConstructor(new Type[] { typeof(Convertible) });\n        var member = ctor.GetParameters().First();\n        var actual = KeyTypeManipulation.ChangeToCompatibleType(\"25\", typeof(Convertible), member) as Convertible;\n        Assert.NotNull(actual);\n        Assert.Equal(25, actual.Value);\n    }\n\n    [Fact]\n    public void ChangeToCompatibleTypeUsesTypeConverterOnProperty()\n    {\n        var member = typeof(HasTypeConverterAttributes).GetProperty(\"Property\");\n        var actual = KeyTypeManipulation.ChangeToCompatibleType(\"25\", typeof(Convertible), member) as Convertible;\n        Assert.NotNull(actual);\n        Assert.Equal(25, actual.Value);\n    }\n\n    public static IEnumerable<object[]> ParsingCultures()\n    {\n        yield return new object[] { new CultureInfo(\"en-US\") };\n        yield return new object[] { new CultureInfo(\"es-MX\") };\n        yield return new object[] { new CultureInfo(\"it-IT\") };\n        yield return new object[] { CultureInfo.InvariantCulture };\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Class instantiated through reflection.\")]\n    private class Convertible\n    {\n        public int Value { get; set; }\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Class instantiated through reflection.\")]\n    private class ConvertibleConverter : TypeConverter\n    {\n        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)\n        {\n            return sourceType == typeof(string) || base.CanConvertFrom(context, sourceType);\n        }\n\n        public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object value)\n        {\n            if (value == null)\n            {\n                return null;\n            }\n\n            if (value is not string str)\n            {\n                return base.ConvertFrom(context, culture, value);\n            }\n\n            var converter = TypeDescriptor.GetConverter(typeof(int));\n            return new Convertible { Value = (int)converter.ConvertFromString(context, culture, str) };\n        }\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Class instantiated through reflection.\")]\n    private class NonConvertingConverter : TypeConverter\n    {\n        public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)\n        {\n            return false;\n        }\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Class instantiated through reflection.\")]\n    private class HasTypeConverterAttributes\n    {\n        public HasTypeConverterAttributes([TypeConverter(typeof(ConvertibleConverter))] Convertible parameter)\n        {\n            Property = parameter;\n        }\n\n        [TypeConverter(typeof(ConvertibleConverter))]\n        public Convertible Property { get; set; }\n    }\n\n    private readonly struct ParseOnlyType\n    {\n        public static bool TryParse(string value, out ParseOnlyType parsed)\n        {\n            parsed = default;\n            return false;\n        }\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/KeyedServiceTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\nusing MicrosoftServiceKey = Microsoft.Extensions.DependencyInjection.ServiceKeyAttribute;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic class KeyedServiceTests\n{\n    [Fact]\n    public void CollectionKeyedResolutionWithAnyKeyOnNestedParameters()\n    {\n        var services = new ServiceCollection();\n\n        // The key should be injected when AnyKey is used.\n        services.AddKeyedTransient<IService, ServiceKeyAwareService>(\"a\");\n        services.AddKeyedTransient<IService, ServiceKeyAwareService>(\"b\");\n\n        var builder = new ContainerBuilder();\n        builder.Populate(services);\n\n        var container = builder.Build();\n        using var serviceProvider = new AutofacServiceProvider(container);\n\n        var result = string.Join(\"\", serviceProvider.GetKeyedServices<IService>(KeyedService.AnyKey).Select(s => s.Value));\n        Assert.Equal(\"ab\", result);\n    }\n\n    [Fact]\n    public void KeyedResolutionWithFromKeyedServicesAndNormalDependency()\n    {\n        var services = new ServiceCollection();\n        services.AddTransient<INormalDependency, NormalDependency>();\n        services.AddKeyedTransient<IKeyedDependency, KeyedDependency>(\"dep\");\n        services.AddKeyedTransient<IMixedService, MixedService>(\"svc\");\n\n        var builder = new ContainerBuilder();\n        builder.Populate(services);\n\n        var container = builder.Build();\n        using var serviceProvider = new AutofacServiceProvider(container);\n\n        var resolved = serviceProvider.GetRequiredKeyedService<IMixedService>(\"svc\");\n\n        Assert.Equal(\"dep:normal\", resolved.Value);\n    }\n\n    private interface IService\n    {\n        string Value { get; }\n    }\n\n    private sealed class ServiceKeyAwareService : IService\n    {\n        private readonly string _resolvedKey;\n\n        public ServiceKeyAwareService([MicrosoftServiceKey] string resolvedKey)\n        {\n            _resolvedKey = resolvedKey;\n        }\n\n        public string Value => _resolvedKey;\n    }\n\n    private interface IKeyedDependency\n    {\n        string Value { get; }\n    }\n\n    private interface INormalDependency\n    {\n        string Value { get; }\n    }\n\n    private interface IMixedService\n    {\n        string Value { get; }\n    }\n\n    private sealed class KeyedDependency : IKeyedDependency\n    {\n        public string Value => \"dep\";\n    }\n\n    private sealed class NormalDependency : INormalDependency\n    {\n        public string Value => \"normal\";\n    }\n\n    private sealed class MixedService : IMixedService\n    {\n        private readonly IKeyedDependency _keyedDependency;\n        private readonly INormalDependency _normalDependency;\n\n        public MixedService([FromKeyedServices(\"dep\")] IKeyedDependency keyedDependency, INormalDependency normalDependency)\n        {\n            _keyedDependency = keyedDependency;\n            _normalDependency = normalDependency;\n        }\n\n        public string Value => $\"{_keyedDependency.Value}:{_normalDependency.Value}\";\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\n[assembly: CLSCompliant(false)]\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/ServiceCollectionExtensionsTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic sealed class ServiceCollectionExtensionsTests\n{\n    [Fact]\n    public void AddAutofacReturnsProvidedServiceCollection()\n    {\n        var collection = new ServiceCollection();\n\n        var returnedCollection = collection.AddAutofac();\n\n        Assert.Same(collection, returnedCollection);\n    }\n\n    [Fact]\n    public void AddAutofacAddsAutofacServiceProviderFactoryToCollection()\n    {\n        var collection = new ServiceCollection();\n\n        collection.AddAutofac();\n\n        var service = collection.FirstOrDefault(s => s.ServiceType == typeof(IServiceProviderFactory<ContainerBuilder>));\n        Assert.NotNull(service);\n        Assert.Equal(ServiceLifetime.Singleton, service.Lifetime);\n    }\n\n    [Fact]\n    public void AddAutofacPassesConfigurationActionToAutofacServiceProviderFactory()\n    {\n        var collection = new ServiceCollection();\n\n        collection.AddAutofac(config => config.Register(c => \"Foo\"));\n\n        var serviceProvider = collection.BuildServiceProvider();\n        var factory = (IServiceProviderFactory<ContainerBuilder>)serviceProvider.GetService(typeof(IServiceProviderFactory<ContainerBuilder>));\n        var builder = factory.CreateBuilder(collection);\n        Assert.Equal(\"Foo\", builder.Build().Resolve<string>());\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/ServiceProviderExtensionsTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic sealed class ServiceProviderExtensionsTests\n{\n    [Fact]\n    public void GetAutofacRootReturnsLifetimeScope()\n    {\n        var containerBuilder = new ContainerBuilder();\n        containerBuilder.Populate(new ServiceCollection());\n\n        var container = containerBuilder.Build();\n        var serviceProvider = container.Resolve<IServiceProvider>();\n\n        Assert.NotNull(serviceProvider.GetAutofacRoot());\n    }\n\n    [Fact]\n    public void GetAutofacRootServiceProviderNotAutofacServiceProviderThrows()\n        => Assert.Throws<InvalidOperationException>(() =>\n            new ServiceCollection().BuildServiceProvider().GetAutofacRoot());\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/AssumedBehaviorTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Diagnostics.CodeAnalysis;\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\n/// <summary>\n/// Additional tests to illustrate undocumented yet assumed behaviors in\n/// the Microsoft.Extensions.DependencyInjection container/scope.\n/// </summary>\npublic abstract class AssumedBehaviorTests\n{\n    [Fact]\n    public void DisposingScopeAlsoDisposesServiceProvider()\n    {\n        // You can't resolve things from a scope's service provider\n        // if you dispose the scope.\n        var services = new ServiceCollection().AddScoped<DisposeTracker>();\n        var rootProvider = CreateServiceProvider(services);\n        var scope = rootProvider.CreateScope();\n        Assert.NotNull(scope.ServiceProvider.GetRequiredService<DisposeTracker>());\n        scope.Dispose();\n        Assert.Throws<ObjectDisposedException>(() => scope.ServiceProvider.GetRequiredService<DisposeTracker>());\n    }\n\n    [Fact]\n    public void DisposingScopeAndProviderOnlyDisposesObjectsOnce()\n    {\n        // Disposing the service provider and then the scope only\n        // runs one disposal on the resolved objects.\n        var services = new ServiceCollection().AddScoped<DisposeTracker>();\n        var rootProvider = CreateServiceProvider(services);\n        var scope = rootProvider.CreateScope();\n        var tracker = scope.ServiceProvider.GetRequiredService<DisposeTracker>();\n        ((IDisposable)scope.ServiceProvider).Dispose();\n        Assert.True(tracker.Disposed);\n        Assert.Equal(1, tracker.DisposeCount);\n        scope.Dispose();\n        Assert.Equal(1, tracker.DisposeCount);\n    }\n\n    [Fact]\n    public void DisposingScopeServiceProviderStopsNewScopes()\n    {\n        // You can't create a new child scope if you've disposed of\n        // the parent scope service provider.\n        var rootProvider = CreateServiceProvider(new ServiceCollection());\n        using var scope = rootProvider.CreateScope();\n        ((IDisposable)scope.ServiceProvider).Dispose();\n        Assert.Throws<ObjectDisposedException>(() => scope.ServiceProvider.CreateScope());\n    }\n\n    [Fact]\n    public void DisposingScopeServiceProviderStopsScopeResolutions()\n    {\n        // You can't resolve things from a scope if you dispose the\n        // scope's service provider.\n        var services = new ServiceCollection().AddScoped<DisposeTracker>();\n        var rootProvider = CreateServiceProvider(services);\n        using var scope = rootProvider.CreateScope();\n        Assert.NotNull(scope.ServiceProvider.GetRequiredService<DisposeTracker>());\n        ((IDisposable)scope.ServiceProvider).Dispose();\n        Assert.Throws<ObjectDisposedException>(() => scope.ServiceProvider.GetRequiredService<DisposeTracker>());\n    }\n\n    [Fact]\n    public void ResolvedProviderNotSameAsParent()\n    {\n        // Resolving a provider from another provider yields a new object.\n        // (It's not just returning \"this\" - it's a different IServiceProvider.)\n        var parent = CreateServiceProvider(new ServiceCollection());\n        var resolved = parent.GetRequiredService<IServiceProvider>();\n        Assert.NotSame(parent, resolved);\n    }\n\n    [Fact]\n    public void ResolvedProviderUsesSameScopeAsParent()\n    {\n        // Resolving a provider from another provider will still resolve\n        // items from the same scope.\n        var services = new ServiceCollection().AddScoped<DisposeTracker>();\n        var root = CreateServiceProvider(services);\n        using var scope = root.CreateScope();\n        var parent = scope.ServiceProvider;\n        var resolved = parent.GetRequiredService<IServiceProvider>();\n        Assert.Same(parent.GetRequiredService<DisposeTracker>(), resolved.GetRequiredService<DisposeTracker>());\n    }\n\n    [Fact]\n    public void ServiceProviderWillNotResolveAfterDispose()\n    {\n        // You can't resolve things from a service provider\n        // if you dispose it.\n        var services = new ServiceCollection().AddScoped<DisposeTracker>();\n        var rootProvider = CreateServiceProvider(services);\n        Assert.NotNull(rootProvider.GetRequiredService<DisposeTracker>());\n        ((IDisposable)rootProvider).Dispose();\n        Assert.Throws<ObjectDisposedException>(() => rootProvider.GetRequiredService<DisposeTracker>());\n    }\n\n    [Fact]\n    public async Task ServiceProviderDisposesAsync()\n    {\n        // You can't resolve things from a service provider\n        // if you dispose it.\n        var services = new ServiceCollection().AddScoped<AsyncDisposeTracker>();\n        var rootProvider = CreateServiceProvider(services);\n        var tracker = rootProvider.GetRequiredService<AsyncDisposeTracker>();\n        var asyncDisposer = (IAsyncDisposable)rootProvider;\n\n        await asyncDisposer.DisposeAsync();\n\n        Assert.True(tracker.AsyncDisposed);\n        Assert.False(tracker.SyncDisposed);\n    }\n\n    [Fact]\n    public async Task ServiceScopeDisposesAsync()\n    {\n        // You can't resolve things from a service provider\n        // if you dispose it.\n        var services = new ServiceCollection().AddScoped<AsyncDisposeTracker>();\n        var rootProvider = CreateServiceProvider(services);\n\n        AsyncDisposeTracker tracker;\n\n        // Try out the new \"CreateAsyncScope\" method.\n        var scope = rootProvider.CreateAsyncScope();\n        await using (scope.ConfigureAwait(false))\n        {\n            tracker = scope.ServiceProvider.GetRequiredService<AsyncDisposeTracker>();\n        }\n\n        Assert.True(tracker.AsyncDisposed);\n        Assert.False(tracker.SyncDisposed);\n    }\n\n    [Fact]\n    public void ServiceScopeFactoryIsSingleton()\n    {\n        // Issue #83: M.E.DI assumes service scope factory is singleton, but\n        // there's no compatibility test for it yet.\n        var services = new ServiceCollection();\n        var rootProvider = CreateServiceProvider(services);\n        var rootFactory1 = rootProvider.GetRequiredService<IServiceScopeFactory>();\n        var rootFactory2 = rootProvider.GetRequiredService<IServiceScopeFactory>();\n        Assert.Same(rootFactory1, rootFactory2);\n\n        var childScope = rootFactory1.CreateScope();\n        var childFactory = childScope.ServiceProvider.GetRequiredService<IServiceScopeFactory>();\n        Assert.Same(rootFactory1, childFactory);\n    }\n\n    [Fact]\n    public void ServiceScopesAreFlat()\n    {\n        // Issue #83: M.E.DI assumes service scopes are flat - disposing of\n        // a \"parent\" scope won't actually invalidate a \"child\" because\n        // they're not related in that fashion.\n        var services = new ServiceCollection().AddSingleton<DisposeTracker>();\n        var rootProvider = CreateServiceProvider(services);\n\n        var outerScope = rootProvider.CreateScope();\n        var innerScope = outerScope.ServiceProvider.CreateScope();\n        outerScope.Dispose();\n\n        // This part will blow up if the scopes are hierarchical.\n        innerScope.ServiceProvider.GetRequiredService<DisposeTracker>();\n        innerScope.Dispose();\n    }\n\n    [Fact]\n    public void ServiceInstancesRegisteredAreNotDisposedWhenTheProviderIsDisposed()\n    {\n        using var externalService = new DisposeTracker();\n        var services = new ServiceCollection().AddSingleton(externalService);\n        var rootProvider = CreateServiceProvider(services);\n        ((IDisposable)rootProvider).Dispose();\n        Assert.False(externalService.Disposed);\n    }\n\n    protected abstract IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection);\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Class instantiated through reflection.\")]\n    private class DisposeTrackerConsumer\n    {\n        public DisposeTrackerConsumer(IEnumerable<DisposeTracker> trackers)\n        {\n            Trackers = trackers;\n        }\n\n        public IEnumerable<DisposeTracker> Trackers { get; }\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Instantiated via dependency injection.\")]\n    private class DisposeTracker : IDisposable\n    {\n        public int DisposeCount { get; set; }\n\n        public bool Disposed { get; set; }\n\n        public void Dispose()\n        {\n            Disposed = true;\n            DisposeCount++;\n        }\n    }\n\n    [SuppressMessage(\"CA1812\", \"CA1812\", Justification = \"Instantiated via dependency injection.\")]\n    private class AsyncDisposeTracker : IDisposable, IAsyncDisposable\n    {\n        public bool SyncDisposed { get; set; }\n\n        public bool AsyncDisposed { get; set; }\n\n        public void Dispose()\n        {\n            SyncDisposed = true;\n        }\n\n        public async ValueTask DisposeAsync()\n        {\n            await Task.Delay(1).ConfigureAwait(false);\n\n            AsyncDisposed = true;\n        }\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/BuilderAssumedBehaviorTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class BuilderAssumedBehaviorTests : AssumedBehaviorTests\n{\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)\n    {\n        var builder = new ContainerBuilder();\n        builder.Populate(serviceCollection);\n        var container = builder.Build();\n        return container.Resolve<IServiceProvider>();\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/BuilderKeyedSpecificationTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection.Specification;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class BuilderKeyedSpecificationTests : KeyedDependencyInjectionSpecificationTests\n{\n    public override bool SupportsIServiceProviderIsKeyedService => true;\n\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection collection)\n    {\n        var builder = new ContainerBuilder();\n        builder.Populate(collection);\n        var container = builder.Build();\n        return container.Resolve<IServiceProvider>();\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/BuilderSpecificationTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection.Specification;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class BuilderSpecificationTests : DependencyInjectionSpecificationTests\n{\n    public override bool SupportsIServiceProviderIsService => true;\n\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)\n    {\n        var builder = new ContainerBuilder();\n        builder.Populate(serviceCollection);\n        var container = builder.Build();\n        return container.Resolve<IServiceProvider>();\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/ChildScopeFactoryAssumedBehaviorTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class ChildScopeFactoryAssumedBehaviorTests : AssumedBehaviorTests\n{\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)\n    {\n        var container = new ContainerBuilder().Build();\n        var rootScope = container.BeginLifetimeScope();\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(() => rootScope);\n        return factory.CreateServiceProvider(factory.CreateBuilder(serviceCollection));\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/ChildScopeFactoryKeyedSpecificationTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection.Specification;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class ChildScopeFactoryKeyedSpecificationTests : KeyedDependencyInjectionSpecificationTests\n{\n    public override bool SupportsIServiceProviderIsKeyedService => true;\n\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection collection)\n    {\n        var container = new ContainerBuilder().Build();\n        var rootScope = container.BeginLifetimeScope();\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(() => rootScope);\n        return factory.CreateServiceProvider(factory.CreateBuilder(collection));\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/ChildScopeFactorySpecificationTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection.Specification;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class ChildScopeFactorySpecificationTests : DependencyInjectionSpecificationTests\n{\n    public override bool SupportsIServiceProviderIsService => true;\n\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)\n    {\n        var container = new ContainerBuilder().Build();\n        var rootScope = container.BeginLifetimeScope();\n        var factory = new AutofacChildLifetimeScopeServiceProviderFactory(() => rootScope);\n        return factory.CreateServiceProvider(factory.CreateBuilder(serviceCollection));\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/FactoryAssumedBehaviorTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class FactoryAssumedBehaviorTests : AssumedBehaviorTests\n{\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)\n    {\n        var factory = new AutofacServiceProviderFactory();\n        return factory.CreateServiceProvider(factory.CreateBuilder(serviceCollection));\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/FactoryKeyedSpecificationTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection.Specification;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class FactoryKeyedSpecificationTests : KeyedDependencyInjectionSpecificationTests\n{\n    public override bool SupportsIServiceProviderIsKeyedService => true;\n\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection collection)\n    {\n        var factory = new AutofacServiceProviderFactory();\n        return factory.CreateServiceProvider(factory.CreateBuilder(collection));\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/FactorySpecificationTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\nusing Microsoft.Extensions.DependencyInjection.Specification;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class FactorySpecificationTests : DependencyInjectionSpecificationTests\n{\n    public override bool SupportsIServiceProviderIsService => true;\n\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)\n    {\n        var factory = new AutofacServiceProviderFactory();\n        return factory.CreateServiceProvider(factory.CreateBuilder(serviceCollection));\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/Specification/MicrosoftAssumedBehaviorTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.Extensions.DependencyInjection;\n\nnamespace Autofac.Extensions.DependencyInjection.Test.Specification;\n\npublic class MicrosoftAssumedBehaviorTests : AssumedBehaviorTests\n{\n    protected override IServiceProvider CreateServiceProvider(IServiceCollection serviceCollection)\n    {\n        return serviceCollection.BuildServiceProvider();\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/TestCulture.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Globalization;\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic static class TestCulture\n{\n    public static void With(CultureInfo culture, Action test)\n    {\n        var originalCulture = Thread.CurrentThread.CurrentCulture;\n        var originalUICulture = Thread.CurrentThread.CurrentUICulture;\n        Thread.CurrentThread.CurrentCulture = culture;\n        Thread.CurrentThread.CurrentUICulture = culture;\n        CultureInfo.CurrentCulture.ClearCachedData();\n        CultureInfo.CurrentUICulture.ClearCachedData();\n        try\n        {\n            test?.Invoke();\n        }\n        finally\n        {\n            Thread.CurrentThread.CurrentCulture = originalCulture;\n            Thread.CurrentThread.CurrentUICulture = originalUICulture;\n            CultureInfo.CurrentCulture.ClearCachedData();\n            CultureInfo.CurrentUICulture.ClearCachedData();\n        }\n    }\n}\n"
  },
  {
    "path": "test/Autofac.Extensions.DependencyInjection.Test/TypeExtensionsTests.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Autofac.Extensions.DependencyInjection.Test;\n\npublic class TypeExtensionsTests\n{\n    [Fact]\n    public void IsCollectionCachesLookups()\n    {\n        var type = typeof(IReadOnlyList<int>);\n\n        var first = type.IsCollection();\n        var second = type.IsCollection();\n\n        Assert.True(first);\n        Assert.Equal(first, second);\n    }\n\n    [Theory]\n    [InlineData(typeof(int[]))]\n    [InlineData(typeof(IEnumerable<int>))]\n    [InlineData(typeof(IList<int>))]\n    [InlineData(typeof(ICollection<int>))]\n    [InlineData(typeof(IReadOnlyCollection<int>))]\n    [InlineData(typeof(IReadOnlyList<int>))]\n    public void IsCollectionSupportedCollectionTypes(Type type)\n    {\n        Assert.True(type.IsCollection());\n    }\n\n    [Theory]\n    [InlineData(typeof(string))]\n    [InlineData(typeof(List<int>))]\n    [InlineData(typeof(Dictionary<string, string>))]\n    [InlineData(typeof(IEnumerable<>))]\n    public void IsCollectionUnsupportedTypes(Type type)\n    {\n        Assert.False(type.IsCollection());\n    }\n}\n"
  },
  {
    "path": "test/Integration.Net10/Controllers/DateController.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Integration.Net10.Controllers;\n\n[ApiController]\n[Route(\"[controller]\")]\npublic class DateController : ControllerBase\n{\n    public DateController(IDateProvider dateProvider)\n    {\n        DateProvider = dateProvider;\n    }\n\n    public IDateProvider DateProvider { get; }\n\n    [HttpGet]\n    public ActionResult<DateTimeOffset> Get() => DateProvider.GetDate();\n}\n"
  },
  {
    "path": "test/Integration.Net10/DateProvider.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Integration.Net10;\n\npublic class DateProvider : IDateProvider\n{\n    public DateTimeOffset GetDate() => DateTimeOffset.UtcNow;\n}\n"
  },
  {
    "path": "test/Integration.Net10/IDateProvider.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Integration.Net10;\n\npublic interface IDateProvider\n{\n    DateTimeOffset GetDate();\n}\n"
  },
  {
    "path": "test/Integration.Net10/Integration.Net10.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n  <PropertyGroup>\n    <TargetFramework>net10.0</TargetFramework>\n    <NoWarn>$(NoWarn);CS1591</NoWarn>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <AssemblyOriginatorKeyFile>../../Autofac.snk</AssemblyOriginatorKeyFile>\n    <SignAssembly>true</SignAssembly>\n    <Nullable>enable</Nullable>\n    <CodeAnalysisRuleSet>../../build/Test.ruleset</CodeAnalysisRuleSet>\n    <AnalysisMode>AllEnabledByDefault</AnalysisMode>\n    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>\n    <ImplicitUsings>enable</ImplicitUsings>\n  </PropertyGroup>\n  <ItemGroup>\n    <AdditionalFiles Include=\"..\\..\\build\\stylecop.json\" Link=\"stylecop.json\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\src\\Autofac.Extensions.DependencyInjection\\Autofac.Extensions.DependencyInjection.csproj\" />\n  </ItemGroup>\n  <ItemGroup>\n    <PackageReference Include=\"StyleCop.Analyzers\" Version=\"1.2.0-beta.556\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "test/Integration.Net10/Program.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Autofac.Extensions.DependencyInjection;\n\nnamespace Integration.Net10;\n\npublic static class Program\n{\n    public static IHostBuilder CreateHostBuilder(string[] args) =>\n        Host.CreateDefaultBuilder(args)\n            .UseServiceProviderFactory(new AutofacServiceProviderFactory())\n            .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());\n\n    public static async Task Main(string[] args) => await CreateHostBuilder(args).Build().RunAsync().ConfigureAwait(false);\n}\n"
  },
  {
    "path": "test/Integration.Net10/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\n[assembly: CLSCompliant(false)]\n"
  },
  {
    "path": "test/Integration.Net10/Properties/launchSettings.json",
    "content": "{\n  \"profiles\": {\n    \"Integration.Net10\": {\n      \"applicationUrl\": \"https://localhost:7154;http://localhost:7155\",\n      \"commandName\": \"Project\",\n      \"dotnetRunMessages\": true,\n      \"environmentVariables\": {\n        \"ASPNETCORE_ENVIRONMENT\": \"Development\"\n      },\n      \"launchBrowser\": true\n    }\n  }\n}\n"
  },
  {
    "path": "test/Integration.Net10/Startup.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Diagnostics.CodeAnalysis;\nusing Autofac;\n\nnamespace Integration.Net10;\n\n[SuppressMessage(\"CA1052\", \"CA1052\", Justification = \"Startup must not be a static class.\")]\npublic class Startup\n{\n    public static void Configure(IApplicationBuilder app)\n    {\n        app.UseRouting()\n           .UseEndpoints(endpoints => endpoints.MapControllers());\n    }\n\n    public static void ConfigureServices(IServiceCollection services)\n    {\n        services.AddMvc();\n    }\n\n    public static void ConfigureContainer(ContainerBuilder builder)\n    {\n        builder.RegisterType<DateProvider>().As<IDateProvider>();\n    }\n}\n"
  },
  {
    "path": "test/Integration.Net10/appsettings.Development.json",
    "content": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Information\"\n    }\n  }\n}\n"
  },
  {
    "path": "test/Integration.Net10/appsettings.json",
    "content": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"None\"\n    }\n  }\n}\n"
  },
  {
    "path": "test/Integration.Net8/Controllers/DateController.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Microsoft.AspNetCore.Mvc;\n\nnamespace Integration.Net8.Controllers;\n\n[ApiController]\n[Route(\"[controller]\")]\npublic class DateController : ControllerBase\n{\n    public DateController(IDateProvider dateProvider)\n    {\n        DateProvider = dateProvider;\n    }\n\n    public IDateProvider DateProvider { get; }\n\n    [HttpGet]\n    public ActionResult<DateTimeOffset> Get() => DateProvider.GetDate();\n}\n"
  },
  {
    "path": "test/Integration.Net8/DateProvider.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Integration.Net8;\n\npublic class DateProvider : IDateProvider\n{\n    public DateTimeOffset GetDate() => DateTimeOffset.UtcNow;\n}\n"
  },
  {
    "path": "test/Integration.Net8/IDateProvider.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nnamespace Integration.Net8;\n\npublic interface IDateProvider\n{\n    DateTimeOffset GetDate();\n}\n"
  },
  {
    "path": "test/Integration.Net8/Integration.Net8.csproj",
    "content": "<Project Sdk=\"Microsoft.NET.Sdk.Web\">\n  <PropertyGroup>\n    <TargetFramework>net8.0</TargetFramework>\n    <NoWarn>$(NoWarn);CS1591</NoWarn>\n    <GenerateDocumentationFile>true</GenerateDocumentationFile>\n    <AssemblyOriginatorKeyFile>../../Autofac.snk</AssemblyOriginatorKeyFile>\n    <SignAssembly>true</SignAssembly>\n    <Nullable>enable</Nullable>\n    <CodeAnalysisRuleSet>../../build/Test.ruleset</CodeAnalysisRuleSet>\n    <AnalysisMode>AllEnabledByDefault</AnalysisMode>\n    <EnforceCodeStyleInBuild>true</EnforceCodeStyleInBuild>\n    <ImplicitUsings>enable</ImplicitUsings>\n  </PropertyGroup>\n  <ItemGroup>\n    <AdditionalFiles Include=\"..\\..\\build\\stylecop.json\" Link=\"stylecop.json\" />\n  </ItemGroup>\n  <ItemGroup>\n    <ProjectReference Include=\"..\\..\\src\\Autofac.Extensions.DependencyInjection\\Autofac.Extensions.DependencyInjection.csproj\" />\n  </ItemGroup>\n  <ItemGroup>\n    <PackageReference Include=\"StyleCop.Analyzers\" Version=\"1.2.0-beta.556\">\n      <PrivateAssets>all</PrivateAssets>\n      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>\n    </PackageReference>\n  </ItemGroup>\n</Project>\n"
  },
  {
    "path": "test/Integration.Net8/Program.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing Autofac.Extensions.DependencyInjection;\n\nnamespace Integration.Net8;\n\npublic static class Program\n{\n    public static IHostBuilder CreateHostBuilder(string[] args) =>\n        Host.CreateDefaultBuilder(args)\n            .UseServiceProviderFactory(new AutofacServiceProviderFactory())\n            .ConfigureWebHostDefaults(webBuilder => webBuilder.UseStartup<Startup>());\n\n    public static async Task Main(string[] args) => await CreateHostBuilder(args).Build().RunAsync().ConfigureAwait(false);\n}\n"
  },
  {
    "path": "test/Integration.Net8/Properties/AssemblyInfo.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\n[assembly: CLSCompliant(false)]\n"
  },
  {
    "path": "test/Integration.Net8/Properties/launchSettings.json",
    "content": "{\n  \"profiles\": {\n    \"Integration.Net8\": {\n      \"applicationUrl\": \"https://localhost:7154;http://localhost:7155\",\n      \"commandName\": \"Project\",\n      \"dotnetRunMessages\": true,\n      \"environmentVariables\": {\n        \"ASPNETCORE_ENVIRONMENT\": \"Development\"\n      },\n      \"launchBrowser\": true\n    }\n  }\n}\n"
  },
  {
    "path": "test/Integration.Net8/Startup.cs",
    "content": "﻿// Copyright (c) Autofac Project. All rights reserved.\n// Licensed under the MIT License. See LICENSE in the project root for license information.\n\nusing System.Diagnostics.CodeAnalysis;\nusing Autofac;\n\nnamespace Integration.Net8;\n\n[SuppressMessage(\"CA1052\", \"CA1052\", Justification = \"Startup must not be a static class.\")]\npublic class Startup\n{\n    public static void Configure(IApplicationBuilder app)\n    {\n        app.UseRouting()\n           .UseEndpoints(endpoints => endpoints.MapControllers());\n    }\n\n    public static void ConfigureServices(IServiceCollection services)\n    {\n        services.AddMvc();\n    }\n\n    public static void ConfigureContainer(ContainerBuilder builder)\n    {\n        builder.RegisterType<DateProvider>().As<IDateProvider>();\n    }\n}\n"
  },
  {
    "path": "test/Integration.Net8/appsettings.Development.json",
    "content": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"Information\"\n    }\n  }\n}\n"
  },
  {
    "path": "test/Integration.Net8/appsettings.json",
    "content": "{\n  \"Logging\": {\n    \"LogLevel\": {\n      \"Default\": \"None\"\n    }\n  }\n}\n"
  }
]