Missing Microsoft.Threading.Tasks with azure SDK - azure

I'm attempting to use the Microsoft Azure SDK for .net version 0.9.5-preview. I am basically attempting to just get the sample for listing locations and services from the Readme working. However I'm running into an exception
An unhandled exception of type 'System.IO.FileNotFoundException' occurred in Microsoft.WindowsAzure.Management.dll
Additional information: Could not load file or assembly 'Microsoft.Threading.Tasks, Version=1.0.12.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified.
Information about this assembly is pretty sparse. I've found some references to it in relation to PCLs and windows phone but this is just a console application using the full 4.5.1(although I have also tried 4.5).
I've found a copy of the dll in a google repository and throwing that in the bin directory does make the application work, however that seems like a spectacular hack. I'd rather see a better solution. Any ideas?
The packages.config contents are
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.WindowsAzure.Common" version="0.9.8-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management" version="0.9.5-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Compute" version="0.9.9-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Libraries" version="0.9.6-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Monitoring" version="0.9.2-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Scheduler" version="0.9.8-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.ServiceBus" version="0.9.3-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Sql" version="0.9.4-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.Storage" version="0.9.3-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.VirtualNetworks" version="0.9.3-preview" targetFramework="net45" />
<package id="Microsoft.WindowsAzure.Management.WebSites" version="0.9.3-preview" targetFramework="net45" />
</packages>

Microsoft.Threading.Tasks assembly you are missing is in Microsoft.Bcl.Async NuGet package. Not sure why but your packages.config file is missing a bunch of dependent assemblies. You may want to un-install and install again your NuGet packages to bring back the dependencies.

Can you verify that you have the latest versions of the dependent assemblies from the dependencies NuGet package, installed with -Pre?
http://www.nuget.org/packages/Microsoft.WindowsAzure.Common.Dependencies/

Related

NUnit Adapter 3.8.0.0 and Nunit 3.11 does not discover tests in Azure

I have written test scripts in VS2017 which run using NUnit Adapter 3.8.0.0 and Nunit 3.11
locally/test explorer, but when I want to run the same tests in Azure pipelines I get the below
error, not sure what this error is pointing to?
Starting test execution, please wait...
Information: NUnit Adapter 3.8.0.0: Test execution started
Information: Running all tests in D:\AgentsP\B41ORIS1_work\125\a\some.dll
Warning: Exception NUnit.Engine.NUnitEngineException, Exception thrown
executing tests in D:\AgentsP\B41ORIS1_work\125\a\some.dll Warning:
An exception occurred in the driver while loading tests. Information:
NUnit Adapter 3.8.0.0: Test execution complete Warning: No test is
available in D:\AgentsP\B41ORIS1_work\125\a\some.dll. Make sure that
installed test discoverers & executors, platform & framework version
settings are appropriate and try again.
and here is my package .config
<package id="NUnit" version="3.11.0" targetFramework="net461" />
<package id="NUnit3TestAdapter" version="3.8.0" targetFramework="net461" />
<package id="Owin" version="1.0" targetFramework="net452" />
<package id="RhinoMocks" version="3.6.1" targetFramework="net452" />
<package id="SpecFlow" version="3.1.97" targetFramework="net461" />
<package id="SpecFlow.NUnit" version="3.1.97" targetFramework="net461" />
<package id="SpecFlow.Tools.MsBuild.Generation" version="3.1.97" targetFramework="net461" />

Why is my new Azure web service not installing nuget packages in the packages.config file?

I'm trying to setup my first Azure Web Service using a GitHub repository. I've included the packages.config file in the repository and I can see it in the Web Service console.
D:\home\site\repository>type packages.config
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Faker.Net" version="1.1.1" targetFramework="net472" />
<package id="Microsoft.NETCore.Platforms" version="3.0.0" targetFramework="net472" />
<package id="NETStandard.Library" version="2.0.3" targetFramework="net472" />
<package id="Newtonsoft.Json" version="12.0.2" targetFramework="net472" />
<package id="YamlDotNet" version="8.0.0" targetFramework="net472" />
</packages>
When the Deployment Center logs shows errors indicating the Newtonsoft.Json package is not loaded.
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling .NET Web Site deployment.
d:\home\site\repository\App_Code\Sling.cs(1): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\Admin.metaproj]
d:\home\site\repository\App_Code\Sling.cs(2): error CS0246: The type or namespace name 'Newtonsoft' could not be found (are you missing a using directive or an assembly reference?) [D:\home\site\repository\Admin.metaproj]
...
Using the console, I can look in the Bin directory and see the packages are not installed. Am I wrong in thinking the packages should be installed? What else can I do different so they will be installed?
Thanks,
Russ

Application Insights Status Monitor doesn't track Sql dependencies for .Net Frameworks 4.5

I have a cloud service hosted application contains Web and Worker roles. To attach AppInsights telemetry I followed this article (https://learn.microsoft.com/en-us/azure/azure-monitor/app/cloudservices) including Sql Statements telemetry step. I've also relied on this sample (https://github.com/microsoft/ApplicationInsights-Home/tree/master/Samples/AzureEmailService)
After solution deployed I have all (http and azure storage) dependencies tracked, but sql.
Enviroment: .Net Framework v4.5, EntityFramework 6.1.3, Azure SDK 2.9.6
Nuget dependecies:
<package id="Microsoft.ApplicationInsights" version="2.10.0" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.Agent.Intercept" version="2.4.0" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.DependencyCollector" version="2.10.0" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.JavaScript" version="1.0.0-build00159" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.PerfCounterCollector" version="2.10.0" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.TraceListener" version="2.10.0" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.Web" version="2.10.0" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.WindowsServer" version="2.10.0" targetFramework="net45" />
<package id="Microsoft.ApplicationInsights.WindowsServer.TelemetryChannel" version="2.10.0" targetFramework="net45" />
I've checked logs and can see that AppInsights Status Monitor has been installed successully.
Any ideas?
UPD
Found SDK version: rddf:2.10.0-32157
Any ideas how can I fix it to rddp?
I'm Alex from Microsoft. My team works on cloud services extension. It appears we have a problem with installing Status Monitor for you to enable SQL tracking. My apologies.
Would that be possible for you to install Status Monitor by yourself as work-around on your Web and Worker roles as described here:
https://learn.microsoft.com/en-us/azure/azure-monitor/app/status-monitor-v2-api-enable-instrumentation-engine
?

How to configure OWIN Web API 1 via IAppBuilder

TL;DR: How do I configure OWIN Web API 1 via a StartUp class or alternatively use the HttpSelfHostServer with the static files extension?
I have a working self-hosted OWIN Web API 2 project, which I'd like to downgrade to .Net 4.0 - I'd prefer not to install the .Net 4.5+ framework replacement, because of unknown side-effects on a production machine.
I can't use Microsoft.AspNet.WebApi.OwinSelfHost because it's not available for .Net 4.0 and therefore I can't call the IAppBuilder.useWebApi() extension method for registering my configuration.
I'm bootstraping the server now like this: WebApp.Start(Of StartUp)(url:="...")
and the StartUp class looks like this, but I can't set the config:
Public Class StartUp
Public Sub Configuration(app As IAppBuilder)
' the host should be obsolete, as it's already configured in the app context
Dim config As New HttpSelfHostConfiguration("http://localhost:9000")
' config.MapHttpAttributeRoutes()
config.Routes.MapHttpRoute(
name:="DefaultApi",
routeTemplate:="api/{controller}/{id}",
defaults:=New With {.id = RouteParameter.Optional}
)
' configure formatters, converters, filters ...
' app.UseWebApi(config)
Dim physicalFileSystem As New PhysicalFileSystem("...\static")
app.UseDefaultFiles(New DefaultFilesOptions With {.FileSystem = physicalFileSystem})
app.UseStaticFiles(New StaticFileOptions With {.FileSystem = physicalFileSystem, .ServeUnknownFileTypes = True})
End Sub
End Class
If I'd use the documented Web API 1 approach of bootstrapping the server (see below), I don't know how to configure the static files extension:
var config = new HttpSelfHostConfiguration("http://localhost:8080");
config.Routes.MapHttpRoute(
"API Default", "api/{controller}/{id}",
new { id = RouteParameter.Optional });
using (HttpSelfHostServer server = new HttpSelfHostServer(config)) {
server.OpenAsync().Wait();
Console.WriteLine("Press Enter to quit.");
Console.ReadLine();
}
Although I've checked the AspNetWebStack sources, I think the message handling has changed between V2.1.0 and V5.0.0+ and therefore I can't apply that approach.
I'm using the following nuget packages - which I might reduce after its working:
<packages>
<package id="Microsoft.AspNet.WebApi.Client" version="4.0.20710.0" targetFramework="net40" />
<package id="Microsoft.AspNet.WebApi.Core" version="4.0.20710.0" targetFramework="net40" />
<package id="Microsoft.AspNet.WebApi.SelfHost" version="4.0.30506.0" targetFramework="net40" />
<package id="Microsoft.Net.Http" version="2.0.20710.0" targetFramework="net40" />
<package id="Microsoft.Owin" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.Diagnostics" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.FileSystems" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.Host.HttpListener" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.Host.SystemWeb" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.Hosting" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.SelfHost" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Owin.StaticFiles" version="2.1.0" targetFramework="net40" />
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net40" />
<package id="Newtonsoft.Json" version="4.5.6" targetFramework="net40" />
<package id="Owin" version="1.0" targetFramework="net40" />
</packages>
Btw. although I've used VB.Net in the example, feel free to use your preferred language in your answer.

TypeLoadException with DocumentClient on Visual Studio Mac

I downloaded the getting started sample app from Azure Cosmos DB and am getting the following error with Visual Studio Mac
System.TypeLoadException: Could not resolve type with token 010000f6 (from typeref, class/assembly System.Diagnostics.Eventing.EventProviderTraceListener, System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089)
at Microsoft.Azure.Documents.Client.DocumentClient.Initialize (System.Uri serviceEndpoint, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy, System.Nullable`1[T] desiredConsistencyLevel) [0x00014] in <f7f11c3ada88490092c73d6bef54be97>:0
at Microsoft.Azure.Documents.Client.DocumentClient..ctor (System.Uri serviceEndpoint, System.String authKeyOrResourceToken, Microsoft.Azure.Documents.Client.ConnectionPolicy connectionPolicy, System.Nullable`1[T] desiredConsistencyLevel) [0x00069] in <f7f11c3ada88490092c73d6bef54be97>:0
at GraphGetStarted.Program.Main (System.String[] args) [0x00021] in /DocumentDB-Quickstart-DotNet-Graph/GraphGetStarted/Program.cs:29
And the code where it fails
DocumentClient client = new DocumentClient(url, authKey, policy);
Here's the packages.config: do I need to set a different targetFramework for Visual Studio Mac?
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Azure.DocumentDB" version="1.14.0" targetFramework="net452" />
<package id="Microsoft.Azure.Graphs" version="0.2.0-preview" targetFramework="net452" />
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.1.0" targetFramework="net452" />
<package id="Microsoft.CodeAnalysis.Common" version="1.3.0" targetFramework="net452" />
<package id="Microsoft.CodeAnalysis.CSharp" version="1.3.0" targetFramework="net452" />
<package id="Newtonsoft.Json" version="10.0.2" targetFramework="net452" />
<package id="System.Collections" version="4.3.0" targetFramework="net452" />
<package id="System.Collections.Immutable" version="1.1.37" targetFramework="net452" />
<package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net452" />
<package id="System.Globalization" version="4.3.0" targetFramework="net452" />
<package id="System.Linq" version="4.3.0" targetFramework="net452" />
<package id="System.Reflection.Metadata" version="1.2.0" targetFramework="net452" />
<package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net452" />
<package id="System.Runtime" version="4.3.0" targetFramework="net452" />
<package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net452" />
<package id="System.Threading" version="4.3.0" targetFramework="net452" />
</packages>
I think Protocol.Tcp is not is .NET Core. Can you try using
new ConnectionPolicy { ConnectionMode = ConnectionMode.Gateway, ConnectionProtocol = Protocol.Https }))
or
new ConnectionPolicy { ConnectionMode = ConnectionMode.Direct, ConnectionProtocol = Protocol.Https }))
Thanks!
According to your comment, you use .net project. Please don't try to run .net project on the MacOS. We can create .NET Core apps that run on Windows, Linux and macOS. We also could get info about azure DocumentDB and .NET Core from the official tutorials.

Resources