-
Notifications
You must be signed in to change notification settings - Fork 359
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
[BUG] PnP and Azure functions assembly conflict. Could not load type 'Microsoft.Extensions.Logging.Abstractions.Internal.NullScope' from assembly 'Microsoft.Extensions.Logging.Abstractions' #2136
Comments
@jmartncp bit of a shot in the dark but have you tried upgrading to PnP.PowerShell v1.11? |
Yes I have. I actually tried both upgrading and downgrading. Neither made much of a difference though. |
I'm pretty sure I encountered the exact same issue after I erroneously created a new function app on PS Core 7.2, I downgraded it to 7.0 and everything was fine then (though I know this information isn't helpful). @veronicageek are there any plans for PnP PS to support this scenario? |
I had the exact same issue. Downgrading the Function App to use PowerShell 7.0 instead of latest (7.2) fixed this for me! |
As I mentioned, this wasn't an option due to security facilities only present in 7.2. I suppose if you had the option you could do that, though I am not sure if I would consider that a 'fix'. Thanks for your thoughts though. |
@jmartncp - can you try commenting out the Az modules from |
They were already commented out. I wasn't using them to begin with, I only had PnP as my single dependency. Azure functions still attempts to load particular modules, like the |
I am seeing exactly the same behaviour and error with 7.2 and Azure functions. Downgrading to 7.0 fixes it for me also but would prefer not to have to. |
omg!! They are deprecating P.S 7.0 in december and still we have this crap! All our azure functions will fail that is it? |
They won't fail as such, but the platform will be unsupported going forward. |
This is certainly turning in to a bit of an issue. While you could continue running 7.0, some organisations will have policies regarding out of support software and may not allow you to continue using a solution which isn't fully supported. Does anyone know of a way to stipulate which version |
So I fixed it... by rebuilding Pnp.Powershell and Pnp.Framework. Updated refs to all Microsoft.Extensions.* from 2.2.0 to 3.0.3.0 I rebuilded a local module and uploaded it to my Azure function, so no more managed dependencies... referencing directly the module in scripts. |
So it is concluding that Pnp.Powershell should upgrade microsoft.Extensions.* dependencies in project. There is no impacts moving from 2.2.0 to 3.0.3.0... |
@Micael-stack what testing have you done to conclude that there is no breaking changes in upgrading the extensions? Of course, upgrading the extensions would solve this issue but doing this could inadvertently introduce other bugs relating to wherever these dependencies are used in the PnP solution. |
Our module is used in multiple client services for site provisioning creation from teams to communication sites with full assets. I would not say that I am covering 100% cases but from my point with my dev Team it does the trick. |
I am experiencing the same issue. Downgrading to PowerShell version 7.0 fixes the issue, but this can only be a temporary solution since we have to upgrade to 7.2 by December 3th 2022. Our customer won't allow out of support software running on their tenant. |
@BarasG yes, I raised this concern above. PnP.PowerShell is probably used in countless Azure Functions, surely this means every single one of them would be in an unsupportable state from Microsoft's viewpoint on December 3rd 2022. |
Confirmed this was the fix for me as well.. downgrading to runtime 7.0. |
Downgrading to PS 7.0 did it |
+1 I'm experiencing the same issue with PowerShell 7.2 |
+1, Me too |
Same issue on Powershell 7.2 on Azure functions |
I'm facing the same issue. Downgrading solves it for now, but I hope the PnP team has time to provide the real fix soon, so we all can benefit from PowerShell 7.2. @erwinvanhunen any timeline? |
I'm also facing this issue but cannot downgrade to PowerShell 7.0 because I use the Powershell module 'AzureAD'. That module requires the use of TLS 1.2 or higher. So, upgrading from 7.0 to 7.2 solves the new TLS requirements for AzureAD but breaks the Connect-PnPOnline cmdlet... Really, really annoying since the fact that some production Azure Functions are just not working anymore... |
+1, the same for us |
@gautamdsheth , do you have any idea if the pnp.powershell is adapted on this issue or when it will happen? |
Do we expect the fix to also be rolled out at the same time to Azure Function Core Tools as we get the same issue with 4.9.495 x64, which means it is not possible to test locally before deployment. The DLL Hell, if I remove the "FUNCTIONS_WORKER_RUNTIME_VERSION" : "7.2" statement from my settings it works, the MSGraph PowerShell modules no longer longer work due to a different DLL issue!!!!! |
How were you able to delete the "FUNCTIONS_WORKER_RUNTIME_VERSION"? |
@Ofer-Gal What are you trying to achieve? To role back to version 7.0 you can use a PowerShell script.
Or you can see the FUNCTIONS_WORKER_RUNTIME_VERSION locally in VSCode in the local.settings.json file. |
I thought you removed it altogether. |
@Ofer-Gal On your connection string have you remembered to add the parameter -returnconnection? |
I did. |
As of 2023-01-12. the issue persists. And there is no option to go back to PowerShell 7.0. |
@sli701 You can use the powershell script above to rollback to powershell core 7.0 on your function spp. |
@myatix , was able to give a try on the Cloud Shell, it is able to rollback. not sure why it is not working when using Local Power Shell Command. However, it does work on the cloud shell, thanks for the help! |
@Francisco-Gamino Has the fix for Azure Functions been released? If yes, is it available in the West Europe region? |
The Functions version /cc @anirudhgarg @AnatoliB @MadhuraBharadwaj-MSFT @michaelpeng36 @VpOfEngineering |
Hi everyone, we're still facing delays in rolling out |
Do we have any update on when we can expect the rollout of '4.15.1' |
Barring any issues, we should be fully rolled out by the beginning of next week. |
Will any action need to be taken? Will our currently failing Azure Functions start working again next week without interaction? |
Will functions where a workaround was applied stop working?
Get Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Clam- ***@***.***>
Sent: Tuesday, January 31, 2023 2:37:26 PM
To: pnp/powershell ***@***.***>
Cc: svermaak ***@***.***>; Comment ***@***.***>
Subject: Re: [pnp/powershell] [BUG] PnP and Azure functions assembly conflict. Could not load type 'Microsoft.Extensions.Logging.Abstractions.Internal.NullScope' from assembly 'Microsoft.Extensions.Logging.Abstractions' (Issue #2136)
Will any action need to be taken? Will our currently failing Azure Functions start working again next week without interaction?
Thank you.
—
Reply to this email directly, view it on GitHub<#2136 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AC5RDEFS5GWCNNYKOSN63UDWVCCHNANCNFSM53M6HTGQ>.
You are receiving this because you commented.Message ID: ***@***.***>
|
The @KoenZomers -- Could you please comment on next steps after |
Just tested this in an environment which has version To fix this issue in your environment, please wait till the fix is there. I am guessing it will be available very soon worldwide. I tested this in a resource group which is in Once the fix is available, you will need to update the PnP PowerShell to the latest nightly builds. You need to explicitly specify the version number like Once a major release of PnP PowerShell is done, you can also specify it as a wildcard entry |
It would be good to know when the next major release of PnP will be out that works with the Azure fix. Some clients don't like to use nightly versions in production :) thanks! |
How does one know if their environment is 4.15.x?
How does one do this? Thank you. |
It is in the Azure function overview page: You can specify the version of PnP PowerShell here:
|
As a workaround, my Azure functions were working fine with PS 7.0. and PnP.PowerShell 1.2. To test the above fix I updated the functions to use PS 7.2 and switched PnP.PowerShell to 2.0.6-nightly. And I am seeing the following exception now when making a call to New-PnPWeb. Any thoughts?? ERROR: System.Net.Http.HttpRequestException: Error while copying content to a stream. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host.. ---> System.Net.Sockets.SocketException (10054): An existing connection was forcibly closed by the remote host. --- End of inner exception stack trace --- at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.ThrowException(SocketError error, CancellationToken cancellationToken) at System.Net.Sockets.Socket.AwaitableSocketAsyncEventArgs.System.Threading.Tasks.Sources.IValueTaskSource<System.Int32>.GetResult(Int16 token) at System.Net.Security.SslStream.EnsureFullTlsFrameAsync[TIOAdapter](TIOAdapter adapter) at System.Net.Security.SslStream.ReadAsyncInternal[TIOAdapter](TIOAdapter adapter, Memory`1 buffer) at System.Net.Http.HttpConnection.FillAsync(Boolean async) |
If you are not running a consumption plan, but under an app service plan, I ran into a weird issue and found a workaround. I was on a B2 sku and kept getting the nullscope error. I was not downgrading my ps version due to other production functions running on the same app plan. Maybe Azure gov does not back patch existing hosts or not fully finished yet. To make it work, upgrade your plan to a PV2/V3 and it will move it to a new host which should have the patched runtime. I verified it worked, then moved it back to a B2 plan which was put on a host that was patched as well. |
@Francisco-Gamino Do we know if 4.15.1 Azure function updates were pushed to Azure Gov ? |
Going to close this issue. It has been fixed from Microsoft side when using Az function 4.15.x or later version. To use PnP PowerShell, as we mentioned, please use the latest 2.x.x-nightly builds. @desmay - no idea if this has been fixed for Azure Gov, but you can reach out to Microsoft support/PG for more information on this. We have no ETA on the major release of PnP PowerShell as of now. |
Hi All,
I recently upgraded PnP.Powershell from the 2.x.x-nightly to 2.1.1 and can confirm that it is working fine. I have deployed it to our prod tenant for almost a month now so far no errors or issues..
Regards
Karthik Ramasubramanian
Senior Digital Productivity Developer
Norton Rose Fulbright Canada LLP / S.E.N.C.R.L., s.r.l.
45 O'Connor Street, Suite 1500, Ottawa, ON K1P 1A4, Canada
T: +1 613.780.8674 | M: +1 613.277.2840 | F: +1 613.230.5459
***@***.******@***.***>
NORTON ROSE FULBRIGHT
From: Fringie ***@***.***>
Sent: May 18, 2023 9:45 AM
To: pnp/powershell ***@***.***>
Cc: Karthik Ramasubramanian (he/him/his) ***@***.***>; Comment ***@***.***>
Subject: Re: [pnp/powershell] [BUG] PnP and Azure functions assembly conflict. Could not load type 'Microsoft.Extensions.Logging.Abstractions.Internal.NullScope' from assembly 'Microsoft.Extensions.Logging.Abstractions' (Issue #2136)
[External Email – Use Caution]
Any update on this?
Going to close this issue. It has been fixed from Microsoft side when using Az function 4.15.x or later version. To use PnP PowerShell, as we mentioned, please use the latest 2.x.x-nightly builds.
@desmay<https://github.com/desmay> - no idea if this has been fixed for Azure Gov, but you can reach out to Microsoft support/PG for more information on this.
We have no ETA on the major release of PnP PowerShell as of now.
I am getting this issue with:
Azure Functions Core Tools
Core Tools Version: 4.0.5148 Commit hash: N/A (64-bit)
Function Runtime Version: 4.17.3.20392
Can you advise?
—
Reply to this email directly, view it on GitHub<#2136 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AKJU7QZIEUY6ZD42RJIHA6LXGYRVVANCNFSM53M6HTGQ>.
You are receiving this because you commented.Message ID: ***@***.******@***.***>>
Law around the world
Le droit à l’échelle mondiale
nortonrosefulbright.com
CONFIDENTIALITY NOTICE: This email is confidential and may be privileged. If you are not the intended recipient please notify the sender immediately and delete it.
AVIS DE CONFIDENTIALITÉ : Ce courriel est confidentiel et peut être protégé par le secret professionnel. Si vous n’en êtes pas le destinataire visé, veuillez en aviser l’expéditeur immédiatement et le supprimer.
|
Reporting an Issue or Missing Feature
This is an issue related to PnP using a conflicting assembly dependency than what
the Azure functions service loads by default. To be more specific, the issue occurs for us
with the module
Microsoft.Extensions.Logging.Abstractions
on each call ofConnect-PnPOnline
. PowerShell 7.2 on Azure functions automatically loadsversion
3.0.3.0
while the one included with PnP is2.2.0.0
. I have tried manypotential resolutions but have been unable to fix (Wrapping in ThreadJob does not work).
The one solution about downgrading from 7.2 to 7.0 is not an option for us, as we require
7.2 for its functionalities. Due to this issue, we are unable to rely on PnP for our needs at
the moment. If a fix for PnP in this scenario is possible, please do. If not, then notify of any
possible workarounds. This problem had me stumped for a while, so anything that can be
done about it is appreciated.
Expected behavior
Successful connection via
Connect-PnPOnline
cmdlet.Actual behavior
An error related to a module in Azure functions:
Steps to reproduce behavior
Connect-PnPOnline
. Ensure it logs error info.NOTE: To reproduce, ensure code is run in the cloud within an Azure function. Running
Connect-PnPOnline
locally will likely NOT cause an error. (The Azure assemblies won't be loaded)
What is the version of the Cmdlet module you are running?
PnP.PowerShell 1.10.0, PowerShell Core 7.2
Which operating system/environment are you running PnP PowerShell on?
The text was updated successfully, but these errors were encountered: