Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error message "Error configuring services in an external startup class. ---> System.IO.FileNotFoundException : Could not load file or assembly 'System.ComponentModel, Version=8.0.0.0" when migrating to .NET 8 with in-process model #10391

Open
mtv-tuanva opened this issue Aug 13, 2024 · 16 comments

Comments

@mtv-tuanva
Copy link

I followed this guideline to migrate azure function in-process model to .NET 8 (#9951 (comment)).
But after deploying to azure window function app, I got following error message even all functions is able working well

Microsoft.Azure.WebJobs.Script.ExternalStartupException : Error configuring services in an external startup class. ---> System.IO.FileNotFoundException : Could not load file or assembly 'System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. at XXX.Startup.Configure(IFunctionsHostBuilder builder) at Startup.cs : 84 at Microsoft.Azure.Functions.Extensions.DependencyInjection.FunctionsStartup.Configure(WebJobsBuilderContext context,IWebJobsBuilder builder) at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.ConfigureStartup(IWebJobsStartup startup,WebJobsBuilderContext context,IWebJobsBuilder builder) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 162 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.ConfigureAndLogUserConfiguredServices(IWebJobsStartup startup,WebJobsBuilderContext context,IWebJobsBuilder builder,ILoggerFactory loggerFactory) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 130 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.UseWebJobsStartup(IWebJobsBuilder builder,Type startupType,WebJobsBuilderContext context,ILoggerFactory loggerFactory) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 115 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.UseExternalStartup(IWebJobsBuilder builder,IWebJobsStartupTypeLocator startupTypeLocator,WebJobsBuilderContext context,ILoggerFactory loggerFactory) at D:\a\_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 213 at Microsoft.Azure.WebJobs.Script.ScriptHostBuilderExtensions.<>c__DisplayClass7_0.<AddScriptHostCore>b__1(HostBuilderContext context,IWebJobsBuilder webJobsBuilder) at /_/src/WebJobs.Script/ScriptHostBuilderExtensions.cs : 235 End of inner exception

How do I find the System.ComponentModel package with Version=8.0.0.0? I see the latest version from Nuget is 4.3.0 instead of 8.0.0.0.

Does anyone know the issue and help me how to fix it?

Thank you,
Tuan Vo

@jkingcynergy
Copy link

Also seeing a similar issue

@mtv-tuanva
Copy link
Author

mtv-tuanva commented Aug 20, 2024

Hi @bhagyshricompany, any feedback on this issue?

The issue happened after I deploying the .NET 8 azure function with in-process model first, then I configured the setting FUNCTIONS_INPROC_NET8_ENABLED = 1 after that.
image

Notice: the error message will disappear after a day.

@aravindM365
Copy link

I am stuck with this issue as well. Does this have a resolution?

@ipetrouchtchak-fi
Copy link

ipetrouchtchak-fi commented Aug 27, 2024

I am stuck with this issue as well. Does this have a resolution?

@mtv-tuanva, @aravindM365, try adding <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
inside the <PropertyGroup> section in your csproj file.

@aravindM365
Copy link

I am stuck with this issue as well. Does this have a resolution?

@mtv-tuanva, @aravindM365, try adding <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput> inside the <PropertyGroup> section in your csproj file.

It's already there in the csproj file.

  <PropertyGroup>
    <TargetFramework>net8.0</TargetFramework>
    <AzureFunctionsVersion>v4</AzureFunctionsVersion>
    <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
  </PropertyGroup>

@patrick-steele
Copy link

Seeing the same issue on two of our function apps (running locally - Windows 11, VS 2022, haven't tried running in Azure yet)

All I did was upgrade two .NET 6 Function apps to target .NET 8 (leaving them as in-process functions). I also have the _FunctionsSkipCleanOutput set to true in my csproj file. I updated my local.settings.json to have the required settings for .NET 8 in-process support:

"FUNCTIONS_INPROC_NET8_ENABLED": "1"
"FUNCTIONS_WORKER_RUNTIME": "dotnet"

Both of these apps fail to start when I hit F5. One fails with:

Error configuring services in an external startup class. XXX: Could not load file or assembly 'System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

The other one fails with:

Error configuring services in an external startup class. XXX: Could not load file or assembly 'System.Data.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.

In Visual Studio, I also went to Tools -> Options -> Projects and Solution -> Azure Functions. Checked to make sure I had the most recent Azure Function toolsets and they are up to date.

@aravindM365
Copy link

You can try adding the Extension Bundle in host.json to resolve this issue.

{
    "version": "2.0",
    "extensionBundle": {
        "id": "Microsoft.Azure.Functions.ExtensionBundle",
        "version": "[4.0.0, 5.0.0)"
    }
}

@patrick-steele
Copy link

@aravindM365 Extension Bundles don't apply to C#. Both of our functions apps are complied C# code. Trying to use extensions results in the error:

Extension bundle configuration should not be present for the function app with pre-compiled functions. Please remove extension bundle configuration from host.json

@aravindM365
Copy link

aravindM365 commented Aug 30, 2024

That's strange because ours is also compiled C# code but adding the extension bundle resolved the original error of this thread. Here is the complete host.json in case it helps.

{
  "version": "2.0",
  "logging": {
    "applicationInsights": {
      "samplingExcludedTypes": "Request",
      "samplingSettings": {
        "isEnabled": true
      }
    }
  },
  "extensionBundle": {
    "id": "Microsoft.Azure.Functions.ExtensionBundle",
    "version": "[4.0.0, 5.0.0)"
  }
}

@patrick-steele
Copy link

@aravindM365 This fixed your issue running locally? Or in Azure? I have not tested the upgraded (.NET 8) function apps in Azure yet since I can't even do any local testing due to the issue outlined in my original reply.

For reference, this is the version information the runtime dumps before I get the error about removing extensionBundle:

Azure Functions Core Tools
Core Tools Version:       4.0.5907 Commit hash: N/A +807e89766a92b14fd07b9f0bc2bea1d8777ab209 (64-bit)
Function Runtime Version: 4.834.3.22875

@aravindM365
Copy link

After the .Net 8 upgrade, everything worked fine locally. I only saw the original error mentioned on this thread when I published my function app to Azure. Sounds like our issues are different.

@patrick-steele
Copy link

And you stuck with the in-process model, right? Or did you upgrade to the isolated one?

@aravindM365
Copy link

aravindM365 commented Aug 30, 2024

The function apps I upgraded to .Net 8 are still in in-process model, yes.

@agrawalamit31
Copy link

agrawalamit31 commented Sep 23, 2024

Hello All,

I am using Azure function and upgraded to .Net 8 with in-proc and facing below issue only at Azure not locally

Microsoft.Azure.WebJobs.Script.ExternalStartupException : Error configuring services in an external startup class. --->
System.IO.FileNotFoundException : Could not load file or assembly 'System.ComponentModel, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified. at XXX.Startup.Configure(IFunctionsHostBuilder builder) at Startup.cs : 84 at Microsoft.Azure.Functions.Extensions.DependencyInjection.FunctionsStartup.Configure(WebJobsBuilderContext context,IWebJobsBuilder builder) at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.ConfigureStartup(IWebJobsStartup startup,WebJobsBuilderContext context,IWebJobsBuilder builder) at D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 162 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.ConfigureAndLogUserConfiguredServices(IWebJobsStartup startup,WebJobsBuilderContext context,IWebJobsBuilder builder,ILoggerFactory loggerFactory) at D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 130 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.UseWebJobsStartup(IWebJobsBuilder builder,Type startupType,WebJobsBuilderContext context,ILoggerFactory loggerFactory) at D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 115 at Microsoft.Azure.WebJobs.WebJobsBuilderExtensions.UseExternalStartup(IWebJobsBuilder builder,IWebJobsStartupTypeLocator startupTypeLocator,WebJobsBuilderContext context,ILoggerFactory loggerFactory) at D:\a_work\1\s\src\Microsoft.Azure.WebJobs.Host\Hosting\WebJobsBuilderExtensions.cs : 213 at Microsoft.Azure.WebJobs.Script.ScriptHostBuilderExtensions.<>c__DisplayClass7_0.b__1(HostBuilderContext context,IWebJobsBuilder webJobsBuilder) at /_/src/WebJobs.Script/ScriptHostBuilderExtensions.cs : 235 End of inner exception
How do I find the System.ComponentModel package with Version=8.0.0.0? I see the latest version from Nuget is 4.3.0 instead of 8.0.0.0.

I tried adding try adding <_FunctionsSkipCleanOutput>true</_FunctionsSkipCleanOutput>
inside the section in your csproj file and it din't work for me.

Please suggest.

@mprecd
Copy link

mprecd commented Jan 14, 2025

And you stuck with the in-process model, right? Or did you upgrade to the isolated one?

Any updates.. Did this work locally for you ? I am running into same issue

@ekanshgarg7021
Copy link

If it is an error in your local setup of In-Process, you need to add this in your local.settings.json:
"FUNCTIONS_INPROC_NET8_ENABLED": "1"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants