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

Transitive dependencies in custom code not being resolved when debugging #1146

Open
Andrew-Lahikainen opened this issue Aug 27, 2024 · 9 comments
Labels

Comments

@Andrew-Lahikainen
Copy link

Andrew-Lahikainen commented Aug 27, 2024

Describe the Bug with repro steps

I have a custom code function app with the following dependencies:

Functions.csproj

<PackageReference Include="Azure.Data.Tables" Version="12.9.0" />
<PackageReference Include="Azure.Storage.Blobs" Version="12.21.2" />

They have a dependency on Azure.Core which seemingly cannot be resolved at runtime when my function is triggered (run through local debugger).

LogicApp/lib/custom/net8/Functions.deps.json

"Azure.Storage.Blobs/12.21.2": {
  "dependencies": {
    "Azure.Storage.Common": "12.20.1",
    "System.Text.Json": "4.7.2"
  },
  "runtime": {
    "lib/net6.0/Azure.Storage.Blobs.dll": {
      "assemblyVersion": "12.21.2.0",
      "fileVersion": "12.2100.224.40807"
    }
  }
},
"Azure.Storage.Common/12.20.1": {
  "dependencies": {
    "Azure.Core": "1.41.0",
    "System.IO.Hashing": "6.0.0"
  },
  "runtime": {
    "lib/net6.0/Azure.Storage.Common.dll": {
      "assemblyVersion": "12.20.1.0",
      "fileVersion": "12.2000.124.37501"
    }
  }
},
"Azure.Core/1.41.0": {
  "dependencies": {
    "Microsoft.Bcl.AsyncInterfaces": "1.1.1",
    "System.ClientModel": "1.0.0",
    "System.Diagnostics.DiagnosticSource": "6.0.1",
    "System.Memory.Data": "1.0.2",
    "System.Numerics.Vectors": "4.5.0",
    "System.Text.Encodings.Web": "4.7.2",
    "System.Text.Json": "4.7.2",
    "System.Threading.Tasks.Extensions": "4.5.4"
  },
  "runtime": {
    "lib/net6.0/Azure.Core.dll": {
      "assemblyVersion": "1.41.0.0",
      "fileVersion": "1.4100.24.36109"
    }
  }
}
...
"Azure.Core/1.41.0": {
  "type": "package",
  "serviceable": true,
  "sha512": "sha512-7OO8rPCVSvXj2IQET3NkRf8hU2ZDCCvCIUhlrE089qkLNpNfWufJnBwHRKLAOWF3bhKBGJS/9hPBgjJ8kupUIg==",
  "path": "azure.core/1.41.0",
  "hashPath": "azure.core.1.41.0.nupkg.sha512"
}

I have verified the package exists on my machine:
image

Stacktrace:

 *  Executing task in folder LogicApp: C:\Users\AndrewLahikainen\.azurelogicapps\dependencies\DotNetSDK\dotnet.exe C:\Users\AndrewLahikainen\.azure-functions-core-tools\Functions\ExtensionBundles\Microsoft.Azure.Functions.ExtensionBundle.Workflows\1.81.39\bin\Microsoft.Azure.Workflows.BuildTasks.DebugSymbolGenerator.dll 

Generating debug symbols...
Debug symbols generated.
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task in folder LogicApp: C:\Users\AndrewLahikainen\.azurelogicapps\dependencies\FuncCoreTools\func host start 


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


Functions:

        ParseAndUploadContent:  http://localhost:7071/api/ParseAndUploadContent/triggers/When_a_HTTP_request_is_received/invoke

        GetPageMapping: workflowActionTrigger

        WorkflowDispatcher: edgeWorkflowRuntimeTrigger

For detailed output, run func with --verbose flag.
[2024-08-27T21:55:59.294Z] Worker process started and initialized.
[2024-08-27T21:56:03.504Z] Host lock lease acquired by instance ID '0000000000000000000000000D54F659'.
[2024-08-27T21:56:32.987Z] Executing 'Functions.ParseAndUploadContent' (Reason='This function was programmatically called via the host APIs.', Id=51e1cc58-1350-4842-a09d-5890345f9085)
[2024-08-27T21:56:33.481Z] Executing 'Functions.WorkflowDispatcher' (Reason='(null)', Id=c9a7169a-5072-4c81-9ce1-e33d166e6b3b)
[2024-08-27T21:56:33.625Z] Executing 'Functions.GetPageMapping' (Reason='(null)', Id=dcc54439-b581-42e7-b619-f86f6b24165b)
[2024-08-27T21:56:33.760Z] Function 'GetPageMapping', Invocation id 'dcc54439-b581-42e7-b619-f86f6b24165b': An exception was thrown by the invocation.
[2024-08-27T21:56:33.765Z] Result: Function 'GetPageMapping', Invocation id 'dcc54439-b581-42e7-b619-f86f6b24165b': An exception was thrown by the invocation.
Exception: System.AggregateException: One or more errors occurred. (Could not load file or assembly 'Azure.Core, Version=1.41.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.)
[2024-08-27T21:56:33.769Z]  ---> System.IO.FileNotFoundException: Could not load file or assembly 'Azure.Core, Version=1.41.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.
[2024-08-27T21:56:33.772Z] File name: 'Azure.Core, Version=1.41.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'
[2024-08-27T21:56:33.776Z]    at Dd.LogicApps.OnenotePublisher.Storage.BlobStorageApi.GetBlob(String region, String path)
[2024-08-27T21:56:33.779Z]    at Dd.LogicApps.OnenotePublisher.GetPageMapping.Run(String region, String path) in C:\Users\AndrewLahikainen\Workspace\LogicApps\OnenotePublisher\Function\Workflow\GetPageMapping.cs:line 31
[2024-08-27T21:56:33.782Z]    --- End of inner exception stack trace ---
[2024-08-27T21:56:33.786Z]    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
[2024-08-27T21:56:33.789Z]    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
[2024-08-27T21:56:33.792Z]    at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionInvoker`2.<>c.<InvokeAsync>b__6_0(Task`1 t) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionInvoker.cs:line 32
[2024-08-27T21:56:33.796Z]    at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
[2024-08-27T21:56:33.800Z]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)     
[2024-08-27T21:56:33.802Z] --- End of stack trace from previous location ---
[2024-08-27T21:56:33.804Z]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)     
[2024-08-27T21:56:33.807Z]    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[2024-08-27T21:56:33.811Z] --- End of stack trace from previous location ---
[2024-08-27T21:56:33.814Z]    at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionExecutor.cs:line 49
[2024-08-27T21:56:33.817Z]    at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-08-27T21:56:33.819Z]    at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77
Stack:    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
[2024-08-27T21:56:33.821Z]    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
[2024-08-27T21:56:33.823Z]    at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionInvoker`2.<>c.<InvokeAsync>b__6_0(Task`1 t) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionInvoker.cs:line 32
[2024-08-27T21:56:33.825Z]    at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
[2024-08-27T21:56:33.827Z]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)     
[2024-08-27T21:56:33.829Z] --- End of stack trace from previous location ---
[2024-08-27T21:56:33.831Z]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)     
[2024-08-27T21:56:33.833Z]    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[2024-08-27T21:56:33.837Z] --- End of stack trace from previous location ---
[2024-08-27T21:56:33.833Z] Executed 'Functions.GetPageMapping' (Failed, Id=dcc54439-b581-42e7-b619-f86f6b24165b, Duration=181ms)
[2024-08-27T21:56:33.839Z]    at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionExecutor.cs:line 49
[2024-08-27T21:56:33.848Z]    at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-08-27T21:56:33.851Z]    at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77.
[2024-08-27T21:56:33.844Z] System.Private.CoreLib: Exception while executing function: Functions.GetPageMapping. System.Private.CoreLib: Result: Failure      
Exception: System.AggregateException: One or more errors occurred. (Could not load file or assembly 'Azure.Core, Version=1.41.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.)
[2024-08-27T21:56:33.857Z]  ---> System.IO.FileNotFoundException: Could not load file or assembly 'Azure.Core, Version=1.41.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'. The system cannot find the file specified.
[2024-08-27T21:56:33.861Z] File name: 'Azure.Core, Version=1.41.0.0, Culture=neutral, PublicKeyToken=92742159e12e44c8'
[2024-08-27T21:56:33.863Z]    at Dd.LogicApps.OnenotePublisher.Storage.BlobStorageApi.GetBlob(String region, String path)
[2024-08-27T21:56:33.865Z]    at Dd.LogicApps.OnenotePublisher.GetPageMapping.Run(String region, String path) in C:\Users\AndrewLahikainen\Workspace\LogicApps\OnenotePublisher\Function\Workflow\GetPageMapping.cs:line 31
[2024-08-27T21:56:33.867Z]    --- End of inner exception stack trace ---
[2024-08-27T21:56:33.869Z]    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
[2024-08-27T21:56:33.870Z]    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
[2024-08-27T21:56:33.871Z]    at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionInvoker`2.<>c.<InvokeAsync>b__6_0(Task`1 t) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionInvoker.cs:line 32
[2024-08-27T21:56:33.874Z]    at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
[2024-08-27T21:56:33.877Z]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)     
[2024-08-27T21:56:33.879Z] --- End of stack trace from previous location ---
[2024-08-27T21:56:33.880Z]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)     
[2024-08-27T21:56:33.881Z]    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[2024-08-27T21:56:33.883Z] --- End of stack trace from previous location ---
[2024-08-27T21:56:33.884Z]    at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionExecutor.cs:line 49
[2024-08-27T21:56:33.886Z]    at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-08-27T21:56:33.888Z]    at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77
[2024-08-27T21:56:33.890Z]    at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a\_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88
Stack:    at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
[2024-08-27T21:56:33.895Z]    at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
[2024-08-27T21:56:33.899Z]    at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionInvoker`2.<>c.<InvokeAsync>b__6_0(Task`1 t) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionInvoker.cs:line 32
[2024-08-27T21:56:33.902Z]    at System.Threading.Tasks.ContinuationResultTaskFromResultTask`2.InnerInvoke()
[2024-08-27T21:56:33.904Z]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
[2024-08-27T21:56:33.905Z] --- End of stack trace from previous location ---
[2024-08-27T21:56:33.909Z]    at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)     
[2024-08-27T21:56:33.911Z]    at System.Threading.Tasks.Task.ExecuteWithThreadLocal(Task& currentTaskSlot, Thread threadPoolThread)
[2024-08-27T21:56:33.913Z] --- End of stack trace from previous location ---
[2024-08-27T21:56:33.915Z]    at Microsoft.Azure.Functions.Worker.Invocation.DefaultFunctionExecutor.ExecuteAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\Invocation\DefaultFunctionExecutor.cs:line 49
[2024-08-27T21:56:33.917Z]    at Microsoft.Azure.Functions.Worker.OutputBindings.OutputBindingsMiddleware.Invoke(FunctionContext context, FunctionExecutionDelegate next) in D:\a\_work\1\s\src\DotNetWorker.Core\OutputBindings\OutputBindingsMiddleware.cs:line 13
[2024-08-27T21:56:33.919Z]    at Microsoft.Azure.Functions.Worker.FunctionsApplication.InvokeFunctionAsync(FunctionContext context) in D:\a\_work\1\s\src\DotNetWorker.Core\FunctionsApplication.cs:line 77
[2024-08-27T21:56:33.922Z]    at Microsoft.Azure.Functions.Worker.Handlers.InvocationHandler.InvokeAsync(InvocationRequest request) in D:\a\_work\1\s\src\DotNetWorker.Grpc\Handlers\InvocationHandler.cs:line 88.
[2024-08-27T21:56:34.061Z] Executed 'Functions.WorkflowDispatcher' (Succeeded, Id=c9a7169a-5072-4c81-9ce1-e33d166e6b3b, Duration=584ms)
[2024-08-27T21:56:34.220Z] Incoming HTTP request ends with server failure: correlationId='f69438e9-5ea7-4559-b44c-d89950469378', authorizationSource='Direct', authorizationAction='', operationName='POST/API/TRIGGERS/PATHS/INVOKE', httpMethod='POST', hostName='localhost', targetUri='http://localhost:7071/api/ParseAndUploadContent/triggers/When_a_HTTP_request_is_received/invoke?api-version=2022-05-01&sp=%2ftriggers%2fWhen_a_HTTP_request_is_received%2frun&sv=1.0&sig=*sanitized*', userAgent='Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Code/1.92.2 Chrome/124.0.6367.243 Electron/30.1.2 Safari/537.36', clientRequestId='', clientSessionId='', clientIpAddress='', clientApplicationId='', apiVersion='2022-05-01', contentLength='-1', serviceRequestId=':f69438e9-5ea7-4559-b44c-d89950469378', durationInMilliseconds='1202', httpStatusCode='502', exceptionMessage='', errorCode='', failureCause='Trigger', errorMessage='', referer='<null>', commandName='', parameterSetName='', contentType='application/json; charset=utf-8', contentEncoding='', armServiceRequestId='', organizationId='', activityVector='IN', locale='en-US', additionalProperties='{"ParentActivityId":"00-305ae657db6568ae077327ceb420951a-813d0dee0a62a5e8-00"}', targetResourceProvider='', targetResourceType='', extensionVersion='1.81.39.0', siteName='UNDEFINED_SITE_NAME', slotName='', activityId='f69438e9-5ea7-4559-b44c-d89950469378'.
[2024-08-27T21:56:34.238Z] Executed 'Functions.ParseAndUploadContent' (Succeeded, Id=51e1cc58-1350-4842-a09d-5890345f9085, Duration=1287ms)

dir structure
image

I'm not really an expert on .net or azure functions so I don't really know what could be causing this. The project builds without issue (I always make sure to dotnet clean and dotnet build). All the files seem to transfer to the LogicApp folder ok. Any pointers?

Thanks!

What type of Logic App Is this happening in?

Standard (VSCode)

Which operating system are you using?

Windows

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

No response

Screenshots or Videos

No response

Browser

na

Additional context

No response

@hartra344
Copy link
Collaborator

Moving to backend issues list and sending this over to the engineer that works on this

@hartra344 hartra344 transferred this issue from Azure/LogicAppsUX Aug 28, 2024
@CharlieAndLouise
Copy link

@hartra344 Thank you for your respond. Could you please confirm this is a bug and need to be fixed?

So by expectation, logic app custom code should be able to use nuget package or referenced projects.
Or the logic app custom code runs in a sandbox that only allows "safe" assemblies, hence, the current behavior is expected.

@hartra344
Copy link
Collaborator

As far as I'm aware, it should allow the use of nuget packages, but I run the UX team so I'm not fully sure. I'm following up internally to try to get some answers.

@Andrew-Lahikainen
Copy link
Author

Seems like you can't use any dependencies at all not just transitive ones. Getting another error when trying to load AngleSharp. This is a pretty huge blocker for me unfortunately. Any way around this? I don't care how hacky it is at this point.

@rohithah
Copy link

rohithah commented Sep 3, 2024

The worker process where the .net8 function is hosted currently using version 1.37.0.0 of Azure.Core.dll. Can you try adding the following package reference to csproj file?
<PackageReference Include="Azure.Core " Version="1.37.0" />

@rohithah
Copy link

rohithah commented Sep 3, 2024

While this will solve the issue with Azure.Core assembly. It will not solve the problem with other assemblies that are not part of the worker host (e.g., Azure.Data.Tables).

Supporting this requires some changes in the worker host and we will try to get this in the next 3-4 weeks.

@CharlieAndLouise
Copy link

Can I follow up the status of this issue?

Copy link

github-actions bot commented Nov 3, 2024

This issue is stale because it has been open for 45 days with no activity.

@github-actions github-actions bot added the stale label Nov 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants