question

SteveCossette-9792 avatar image
0 Votes"
SteveCossette-9792 asked EdwordSmith53-7451 Suspended answered

Microsoft.Graph Silent crash on new calendar event

So, we have a program that synchronizes another platform's appointments to Microsoft Outlook Calendar.

We have several companies that use our service. One of them though is having a problem.

After some troubleshooting, it seems the Microsoft.Graph component makes the program hard crash.

The program is a Win32 Console app running in 64-bit. This is the function being called:

 Public Shared Async Function CreateEvent(ByVal token As String, ByVal calendarID As String, ByVal NewEvent As [Event]) As Task(Of Microsoft.Graph.Event)
         Console.WriteLine("Creating Client")
         Dim graphclient As New GraphServiceClient(New DelegateAuthenticationProvider(Function(requestMessage)
                                                                                          requestMessage.Headers.Authorization = New AuthenticationHeaderValue("bearer", token)
                                                                                          Return Task.FromResult(0)
                                                                                      End Function
                             )
                                                                   )
    
         Dim newcal As [Event]
         Try
             Console.WriteLine("Sending Request")
             newcal = Await graphclient.Me.Calendars.Item(calendarID).Events.Request.AddAsync(NewEvent)
             Console.WriteLine("Request succeded")
         Catch ex As Exception
             GoogleChatMessage("Calendar v2 Debug", "Error occured while creating event, purging calendar." & vbNewLine & vbNewLine & ex.Message & vbNewLine & ex.StackTrace)
         End Try
         Return newcal
    
     End Function

I added a bunch of console.writelines to see exactly where it crashes. This is what the command prompt looks like:

Creating Client
Sending Request

D:\Tools\GoogleCalendarProcessor>

It doesn't seems to crash in the normal way it seems to just... quit. Or it's a silent crash. There's nothing in the system event log. And this is one of many requests it goes through inside of a do....loop, and it just does the first loop and exits, like if an Environment.exit(0) is being called somewhere (Not in my code)

I already asked the client to make sure that his Office 365 instance is still set to accept API requests, but I don't think this is the problem.

Anyone got an idea of what would cause this? Note I'm still kindof a newbie in coding with Microsoft Graph.

Oh, in case it matters, I use an offline use token provided by the client when they signup on a ASP.net portal.

Thanks!

microsoft-graph-calendar
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

SteveCossette-9792 avatar image
0 Votes"
SteveCossette-9792 answered

Nevermind, I found the problem. It's a really strange one that I don't fully get, but I needed to change:

 newcal = Await graphclient.Me.Calendars.Item(calendarID).Events.Request.AddAsync(NewEvent)

Into

 newcal = graphclient.Me.Calendars.Item(calendarID).Events.Request.AddAsync(NewEvent).Result

Strange how that fixed the problem this single client was experiencing...

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.