I am working on a windows phone project that pulls data from gmail server using gmail api and downloads all the attachments with the specific format, everything works (server authentication, receiving data, ... ) well when I have all the code in the same project. I added a Windows Runtime component project to the solution and moved the code that handles server authentication and returns a GmailService to the runtime component project, so I could call it from a background agent scheduler project for push notifications as well as in the main project. I get this error every time I try to call the Server in the main project :
An exception of type 'System.Runtime.InteropServices.COMException' occurred in mscorlib.ni.dll but was not handled in user code
public static async Task<GmailService> Instantiate()
{
if (service == null)
await AuthenticateAsync();
return service;
}
private static async Task AuthenticateAsync()
{
// the code that creates the service if it doesn't exist
}
I added the reference to both scheduler and main project, and build are done successfully .
This thread (below link) suggests both running VS as administrator, and also how to debug the COMException to get a better idea of what is causing it. Sounds like a problem with target architecture of the new VS project you created. Excerpt below;
"You could try breaking when the exception is thrown. Go to Debug > Exceptions... and use the Find... option to locate System.Runtime.InteropServices.COMException. Tick the option to break when it's thrown and then debug your application."
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.