Using PNP Core Lib in CSOM - issue using AuthenticationManager

Iron Contributor

Hi,

 

Trying to setup my MS Surface for doing dev work using VS Code. All fine for JS work, but I currently want to provision Modern Pages with Spfx webparts as per the PnP webcast (https://dev.office.com/blogs/programatically-creating-and-updating-modern-pages-in-sharepoint-online... -- PNP Guys - love your work!! Thank for everything!

 

When I try and call the AuthenticationManager, I am getting an issue:

 

Exception has occurred: CLR/System.MissingMethodException
An unhandled exception of type 'System.MissingMethodException' occurred in OfficeDevPnP.Core.dll: 'Method not found: 'System.Runtime.Remoting.ObjectHandle System.Activator.CreateInstance(System.String, System.String)'.'
   at OfficeDevPnP.Core.Diagnostics.Log.InitializeLogger()
   at OfficeDevPnP.Core.Diagnostics.Log.Info(String source, String message, Object[] args)
   at OfficeDevPnP.Core.AuthenticationManager.GetSharePointOnlineAuthenticatedContextTenant(String siteUrl, String tenantUser, SecureString tenantUserPassword)

 

I am assuming I dont have a required package/DLL available - or have the wrong version. I have been trying to install required packages by NuGet (something that is also pretty new to me). In case it is of any help, I have attached the project.assets.json file from my project.

 

Anyone know what I need to do to resolve this issue??

 

Many thanks

 

Nigel

7 Replies

I assume you need visual studio instead of vscode. but could be wrong here have not watched the whole video.

Yeah I had tried it in Visual Studio - same result I cloned the whole PnP repo, and opened the existing sample project in there and that worked fine - so definitely something to do with my project setup/includes etc. Thanks!

Curious what you are exactly doing and what your code looks like seems to me you choose the wrong project or miss the dependencies.

Agreed it would be something to do with the set of dependencies I had (or more likely didnt have) in my own project.

 

I was happy enough to modify the clone of the PnP project in order to do the testing I needed to - so I will park it to figure out another day 🙂

 

Thanks for the response!

 

Hey, your thread result first on my search for 'System.MissingMethodException' occurred in OfficeDevPnP.Core.dll.  I'm trying to convert a .net 4.x console app to .net core that I run in VS Code, with these packages:

 

<PackageReference Include="SharePointPnPCoreOnline" Version="2.28.1807" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" />
 
On the GetSharePointOnlineAuthenticatedContextTenant call, i get that exception and i'm not sure what's going on.  I need to get that code to work to prove to my team that VS Code and .NET Core are where we should go, but these errors make me doubt that this is it yet.  
 
Were  you able to authenticate to SharePoint Online using the AuthenticationManager from PNP?  Does it only work in .NET 4.x?

Hey,

Sorry I am not going to be of any help - the requirement we had for doing this was dropped very shortly after my posting, so I never pursued it any further.

If you do get to a resolution, I think it would be a great thing if you posted your solution on this thread to help out anyone in the future who encounters the same issues

Good luck!

I had the same problem. I used Visual Studio for Mac and created a AsP.net Core Web Application to create a WebAPI. I was following an example that was posted on pnp code base on Elevated privileges and I ended up having the same problem. I ended up creating an asp.net web application project instead then added OfficeDevPnP and everything worked. I am not sure what dependencies were added but it worked out for me after that. 

 

Hope this helps.