question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Visual Studio] Unable to start debugging or run Function code using VS Tooling (console crashes)

See original GitHub issue

Unable to start debugging using Visual Studio Tooling for Azure Functions Preview.

Repro steps

Start debugging my newly created Function project in Visual Studio. Command line arguments of the command prompt started by VS2015: C:\Users\dev\AppData\Local\Azure.Functions.Cli\1.0.0-beta.8\func.exe host start --port 7071 & pause

Expected behavior

Starting project and debugger attaches to my function.

Actual behavior

Console crashes, call stack:

Autofac.Core.DependencyResolutionException: An error occurred during the activation of a particular registration. See the inner exception for details. Registration: Activator = WebScriptHostManager (DelegateActivator), Services = [Microsoft.Azure.WebJobs.Script.WebHost.WebScriptHostManager], Lifetime = Autofac.Core.Lifetime.CurrentScopeLifetime, Sharing = None, Ownership = ExternallyOwned ---> A host ID must be between 1 and 32 characters, contain only lowercase letters, numbers, and dashes, not start or end with a dash, and not contain consecutive dashes.
Parameter name: value (See inner exception for details.) ---> System.ArgumentException: A host ID must be between 1 and 32 characters, contain only lowercase letters, numbers, and dashes, not start or end with a dash, and not contain consecutive dashes.
Parameter name: value
   at Microsoft.Azure.WebJobs.JobHostConfiguration.set_HostId(String value)
   at Microsoft.Azure.WebJobs.Script.WebHost.WebHostResolver.CreateScriptHostConfiguration(WebHostSettings settings)
   at Microsoft.Azure.WebJobs.Script.WebHost.WebHostResolver.EnsureInitialized(WebHostSettings settings)
   at Microsoft.Azure.WebJobs.Script.WebHost.WebHostResolver.GetWebScriptHostManager(WebHostSettings settings)
   at Microsoft.Azure.WebJobs.Script.WebHost.AutofacBootstrap.<>c__DisplayClass0_0.<Initialize>b__1(IComponentContext ct)
   at Autofac.RegistrationExtensions.<>c__DisplayClass5_0`1.<Register>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Builder.RegistrationBuilder.<>c__DisplayClass0_0`1.<ForDelegate>b__0(IComponentContext c, IEnumerable`1 p)
   at Autofac.Core.Activators.Delegate.DelegateActivator.ActivateInstance(IComponentContext context, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   --- End of inner exception stack trace ---
   at Autofac.Core.Resolving.InstanceLookup.Activate(IEnumerable`1 parameters)
   at Autofac.Core.Resolving.InstanceLookup.Execute()
   at Autofac.Core.Resolving.ResolveOperation.GetOrCreateInstance(ISharingLifetimeScope currentOperationScope, IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Resolving.ResolveOperation.Execute(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Lifetime.LifetimeScope.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.Core.Container.ResolveComponent(IComponentRegistration registration, IEnumerable`1 parameters)
   at Autofac.ResolutionExtensions.TryResolveService(IComponentContext context, Service service, IEnumerable`1 parameters, Object& instance)
   at Autofac.ResolutionExtensions.ResolveOptionalService(IComponentContext context, Service service, IEnumerable`1 parameters)
   at Autofac.Integration.WebApi.AutofacWebApiDependencyScope.GetService(Type serviceType)
   at Autofac.Integration.WebApi.AutofacWebApiDependencyResolver.GetService(Type serviceType)
   at Microsoft.Azure.WebJobs.Script.WebHost.DependencyResolverExtensions.GetService[TService](IDependencyResolver resolver)
   at Microsoft.Azure.WebJobs.Script.WebHost.WebApiConfig.Initialize(HttpConfiguration config, ScriptSettingsManager settingsManager, WebHostSettings settings, Action`2 dependencyCallback)
   at WebJobs.Script.Cli.Actions.HostActions.StartHostAction.<RunAsync>d__17.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.GetResult()
   at WebJobs.Script.Cli.ConsoleApp.<RunAsync>d__4`1.MoveNext()

Known workarounds

None.

Related information

Visual Studio information:

Microsoft Visual Studio Enterprise 2015 Version 14.0.25431.01 Update 3 Microsoft .NET Framework Version 4.6.01586

Installed Version: Enterprise

Architecture and Modeling Tools 00322-80000-00000-AA393 Microsoft Architecture and Modeling Tools

UML® and Unified Modeling Language™ are trademarks or registered trademarks of the Object Management Group, Inc. in the United States and other countries.

Microsoft Visual Studio Tools for Applications 2015 00322-80000-00000-AA393 Microsoft Visual Studio Tools for Applications 2015

Visual Basic 2015 00322-80000-00000-AA393 Microsoft Visual Basic 2015

Visual C# 2015 00322-80000-00000-AA393 Microsoft Visual C# 2015

Visual C++ 2015 00322-80000-00000-AA393 Microsoft Visual C++ 2015

Application Insights Tools for Visual Studio Package 7.14.01128.2 Application Insights Tools for Visual Studio

ASP.NET and Web Tools 2015.1 14.1.21111.0 ASP.NET and Web Tools 2015.1

ASP.NET Web Frameworks and Tools 2012.2 4.1.41102.0 For additional information, visit http://go.microsoft.com/fwlink/?LinkID=309563

ASP.NET Web Frameworks and Tools 2013 5.2.40314.0 For additional information, visit http://www.asp.net/

Azure App Service Tools v2.9.6 14.0.21129.0 Azure App Service Tools v2.9.6

Azure Data Lake Node 1.0 This package contains the Data Lake integration nodes for Server Explorer.

Azure Data Lake Tools for Visual Studio 2.0.6000.0 Microsoft Azure Data Lake Tools for Visual Studio

Common Azure Tools 1.8 Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

DataFactoryProject 1.0 Microsoft Data Factory Package

Fabric.DiagnosticEvents 1.0 Fabric Diagnostic Events

GitHub.VisualStudio 2.1.1.0 A Visual Studio Extension that brings the GitHub Flow into Visual Studio.

JavaScript Language Service 2.0 JavaScript Language Service

JavaScript Project System 2.0 JavaScript Project System

JetBrains ReSharper Ultimate 2016.2.2 Build 106.0.20160913.91321 JetBrains ReSharper Ultimate package for Microsoft Visual Studio. For more information about ReSharper Ultimate, visit http://www.jetbrains.com/resharper. Copyright © 2016 JetBrains, Inc.

Microsoft Azure Data Factory Node Node 1.0 Azure Data Factory extension for Visual Studio Server Explorer.

Microsoft Azure HDInsight HQL Service 2.0.6000.0 Language service for Hive query

Microsoft Azure HDInsight Tools for Visual Studio 2.0.6000.0 An integrated development environment for HDInsight application development.

Microsoft Azure Mobile Services Tools 1.4 Microsoft Azure Mobile Services Tools

Microsoft Azure Tools 2.8 Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.8.40211.2

Microsoft Azure Tools 2.7 Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.7.30713.1601

Microsoft Azure Tools 2.9 Microsoft Azure Tools for Microsoft Visual Studio 2015 - v2.9.41104.6

NuGet Package Manager 3.5.0 NuGet Package Manager in Visual Studio. For more information about NuGet, visit http://docs.nuget.org/.

PreEmptive Analytics Visualizer 1.2 Microsoft Visual Studio extension to visualize aggregated summaries from the PreEmptive Analytics product.

SQL Server Data Tools 14.0.61021.0 Microsoft SQL Server Data Tools

ToolWindowHostedEditor 1.0 Hosting json editor into a tool window

TypeScript 1.8.36.0 TypeScript tools for Visual Studio

.funproj file content:

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">14.0</VisualStudioVersion>
    <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
  </PropertyGroup>
  <Import Project="$(VSToolsPath)\AzureFunctions\Microsoft.AzureFunctions.Props" Condition="'$(VSToolsPath)' != ''" />
  <PropertyGroup>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>e1df4e05-ae27-487a-8359-e8e66b5b8714</ProjectGuid>
    <ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
    <AppDesignerFolder>Properties</AppDesignerFolder>
    <RootNamespace>Removed.Api.Functions</RootNamespace>
    <AssemblyName>Removed.Api.Functions</AssemblyName>
    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
  </PropertyGroup>
  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
    <ProduceOutputsOnBuild>true</ProduceOutputsOnBuild>
  </PropertyGroup>
  <Import Project="$(VSToolsPath)\AzureFunctions\Microsoft.AzureFunctions.targets" Condition="'$(VSToolsPath)' != ''" />
</Project>

host.json file content:

{
  "id": "a83a1153be9448afbdfcd2gg652eed32",
  "functionTimeout": "00:05:00",
  "http": {
    "routePrefix": "api"
  },
  "queues": {
    "maxPollingInterval": 2000,
    "batchSize": 16,
    "maxDequeueCount": 5,
    "newBatchThreshold": 8
  },
  "serviceBus": {
    "maxConcurrentCalls": 16,
    "prefetchCount": 100
  },
  "eventHub": {
    "maxBatchSize": 1000,
    "prefetchCount": 100
  },
  "tracing": {
    "consoleLevel": "verbose",
    "fileLoggingMode": "debugOnly"
  },
  "watchDirectories": [ "Shared", "bin" ],
  "singleton": {
    "lockPeriod": "00:00:15",
    "listenerLockPeriod": "00:01:00",
    "listenerLockRecoveryPollingInterval": "00:01:00",
    "lockAcquisitionTimeout": "00:01:00",
    "lockAcquisitionPollingInterval": "00:00:03"
  }
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (7 by maintainers)

github_iconTop GitHub Comments

3reactions
SimonLuckenuikcommented, Dec 2, 2016

@lindydonna The dots in the project name have no effect. I kept the dots in the filename, but removed the dots from the folder name in which the project was and it started working in order to have it working.

0reactions
MisinformedDNAcommented, Dec 11, 2016

I think they should be centralized under one name. We don’t need WebJobs and Functions. They are practically the same.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Buggy and crashing often while debugging
While debugging a very simple dotnet core console app - VS completely crashes and restarts when I start debugging. Event when not crashing,...
Read more >
The Visual Studio 2022 Error "Failed to launch debug ...
Microsoft Visual Studio​​ Failed to launch debug adapter. Additional information may be available in the output window.
Read more >
Debug using the Just-In-Time Debugger in Visual Studio
To open Visual Studio as an administrator, right-click the Visual Studio app and choose Run as administrator. You can configure Just-In-Time ...
Read more >
Visual Studio 2022 crashes during debug on Windows 10
I have to work with ASP and C#. With VS19 everything was fine, but with VS22 the solution crashes as soon as I...
Read more >
Debugging .NET Core Apps with Visual Studio Code
If you want to be able to debug your project in Visual Studio Code, select Yes and a .vscode directory will be added...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found