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

Exception when start AudioVideoPlaybackBot in Azure Cloud Service #68

Closed
JapNolt opened this issue May 24, 2019 · 9 comments
Closed

Exception when start AudioVideoPlaybackBot in Azure Cloud Service #68

JapNolt opened this issue May 24, 2019 · 9 comments

Comments

@JapNolt
Copy link
Contributor

JapNolt commented May 24, 2019

Describe the issue
I cloned the repo today and followed the steps from the Getting Started with the Local Media Samples to deploy the sample bot to an Azure Cloud Service. I did not modify any code. I only ran the configure_cloud.ps1 script and then published. When the cloud service starts, it throws this exception:

Unhandled Exception: Could not load file or assembly 'System.ValueTuple, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) at Microsoft.Graph.GraphClientFactory.Create(IEnumerable'1 handlers, String version, String nationalCloud, IWebProxy proxy, HttpMessageHandler finalHandler) at Microsoft.Graph.HttpProvider..ctor(HttpMessageHandler httpMessageHandler, Boolean disposeHandler, ISerializer serializer) at Microsoft.Graph.Communications.Calls.CommunicationsClientExtensions.<>c__DisplayClass0_0.b__0() at Microsoft.Graph.Communications.Client.CommunicationsClient.GetOrAddResourceCollection[T](Boolean maintainState, Func'1 valueFactory) at Sample.AudioVideoPlaybackBot.FrontEnd.Bot.Bot.Initialize(Service service, IGraphLogger logger) in \microsoft-graph-comms-samples\Samples\V1.0Samples\LocalMediaSamples\AudioVideoPlaybackBot\FrontEnd\Bot\Bot.cs:line 173 at Sample.AudioVideoPlaybackBot.FrontEnd.Service.Start() in \microsoft-graph-comms-samples\Samples\V1.0Samples\LocalMediaSamples\AudioVideoPlaybackBot\FrontEnd\Service.cs:line 83 at Sample.AudioVideoPlaybackBot.WorkerRole.WorkerRole.OnStart() in \microsoft-graph-comms-samples\Samples\V1.0Samples\LocalMediaSamples\AudioVideoPlaybackBot\WorkerRole\WorkerRole.cs:line 92 at Microsoft.WindowsAzure.ServiceRuntime.RoleEnvironment.InitializeRoleInternal(RoleType roleTypeEnum) at Microsoft.WindowsAzure.ServiceRuntime.Implementation.Loader.RoleRuntimeBridge.b__0() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() ' [2019-05-24T15:08:48Z] Last exit time: [2019/05/24, 15:08:57.863]. Last exit code: 0.

@ksikorsk
Copy link
Contributor

Which Visual Studio version do you have installed? I believe that System.ValueTuple is a C# 7.0 feature, and so you need to have a fairly recent version.

https://blogs.msdn.microsoft.com/mazhou/2017/05/26/c-7-series-part-1-value-tuples/

@JapNolt
Copy link
Contributor Author

JapNolt commented May 28, 2019

I'm using VS 2019. This happens not when debugging locally but when deploying to Azure Cloud Service.

@ksikorsk
Copy link
Contributor

So it works when debugging locally? There may be something off with the deployment package. Can you look at the publish package and ensure that it has the same files as your bin folder?

@JapNolt
Copy link
Contributor Author

JapNolt commented May 28, 2019

The files in the package are the same as in the bin folder.

My guess is that it has something to do with .Net Framework installs on the Azure Cloud Service or something with bindingRedirects but I'm not an expert at either of those. Or am I going down a wrong rabbit trail?

But as stated at the top, I would expect to be able to clone the repo, follow the steps, and it just works. But myself and a colleague are having the same issue.

@ksikorsk
Copy link
Contributor

Binding redirects should be generated from the references automatically:

    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
    <GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>

I see System.ValueTuple is not referenced in the project. It's possible that this assembly is automatically included locally because of VS install, but must be published in order for to be available in CloudService. It's likely that the publish is not happening because of the lack of reference. Try adding this binary as a reference, and see if that resolves your issue. I'll update the samples accordingly.

@JapNolt
Copy link
Contributor Author

JapNolt commented May 28, 2019

I AM able to publish to the Azure Cloud Service. But when the role instance starts, this exception happens. This causes the process to recycle endlessly.

If you look at the exception call stack, you can see that the exception is getting thrown from Microsoft.Graph.GraphClientFactory.Create.

Is System.ValueTuple.dll a dependency of another package installed into this sample.

Have you recently tried to publish this sample to Azure Cloud Service?

@ksikorsk
Copy link
Contributor

Apologies, I misspoke, I meant the application cannot start.

The samples are dependent on the following:
https://www.nuget.org/packages/Microsoft.Graph/
https://www.nuget.org/packages/Microsoft.Graph.Core/

Which are dependent on:
System.ValueTuple (>= 4.3.0)

I see this in the autogenerated binding redirect:

    <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
      <dependentAssembly>
        <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
        <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
      </dependentAssembly>
    </assemblyBinding>

I am not sure why this is not being used by the application and I have not recently tried to deploy this sample (I have ran it locally). We have a work item to automatically deploy these samples and run tests against them, but I don't anticipate this validation will be done until end of Q3.

@JapNolt
Copy link
Contributor Author

JapNolt commented May 29, 2019

I've made a pull request that changes the osFamily in the cscfg files from 5 to 6. This uses Windows Server 2019 as the base OS which already has .Net Framework 4.7.2. Deploying the sample to this seemed to work.

@ksikorsk
Copy link
Contributor

Validated the PR and merged. Thanks for the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants