title: Illegal character in path when running Azure function
body: <p>I have an Azure function that has been working all day. About twenty minutes ago I started getting an error when trying to click the run button in Visual Studio. It successfully builds and then when it starts it displays and error the just states an 'illegal character in path - Visual Studio'. I've checked the git logs and no changes have been made so I'm unsure what's wrong.</p>
  <p>I've attached a picture of the problem to try illustrate the issue:</p>
  <p><img src="https://i.imgur.com/n8Psh1l.gif" alt="issue" /></p>
  <p>I have tried everything I can think of. Here's a list of all the steps I've taken.</p>
  <ul>
  <li>Restart machine</li>
  <li>Re-cloned the repo</li>
  <li>Re-installed Visual Studio 2017 &amp; 2019</li>
  <li>Deleted the appdata folder</li>
  <li>Cleared Cache files</li>
  <li>Browsed the debug menus</li>
  <li>System restored</li>
  </ul>
  <pre class="lang-cs prettyprint-override"><code>using Microsoft.Azure.WebJobs;
  using Microsoft.Extensions.Logging;
  using Newtonsoft.Json;
  using System;
  using System.Collections.Generic;
  using System.IO;
  using System.Linq;
  using Zupa.Products.ProductsService.Models.Messages.V1;
  
  namespace Zupa.ProductFileUploadFunction
  {
      public static class FileUploadProcessor
      {
          private const string FunctionName = nameof(FileUploadProcessor);
  
          [FunctionName(FunctionName)]
          public static void Run(
              [BlobTrigger(&quot;%IncomingContainerPath%/{blobFileName}&quot;, Connection = &quot;AzureWebJobsStorage&quot;)]Stream inputBlob,
              [ServiceBus(&quot;%QueueName%&quot;, Connection = &quot;QueueServiceBus&quot;)]out string outgoingMessage,
              string blobFileName, ILogger log)
          {
              log.LogInformation($&quot;{FunctionName} Processing blob {Environment.NewLine} Name:{blobFileName + Environment.NewLine} Size: {inputBlob.Length} Bytes&quot;);
              outgoingMessage = null;
  
              var (parsedOrganisationId, parsedUploadId) = (Guid.Empty, Guid.Empty);
  
              var organisationId = GetPartFromString(blobFileName, &quot;/&quot;, 0);
              var fileUploadType = GetPartFromString(blobFileName, &quot;/&quot;, 1);
              var isRecognisedFileUploadType = Enum.GetNames(typeof(FileUploadType)).Select(name =&gt; name.ToLowerInvariant()).Contains(fileUploadType.ToLowerInvariant());
              var uploadId = GetPartFromString(blobFileName, &quot;/&quot;, 2);
              var fileName = GetPartFromString(blobFileName, &quot;/&quot;, 3);
  
              var propertyValidation = new Dictionary&lt;string, bool&gt;()
              {
                  {
                      nameof(FileUploadDataEventMessage.OrganisationId),
                      string.IsNullOrEmpty(organisationId) || !Guid.TryParse(organisationId, out parsedOrganisationId)
                  },
                  {
                      nameof(FileUploadDataEventMessage.FileUploadType),
                      string.IsNullOrEmpty(fileUploadType) || isRecognisedFileUploadType
                  },
                  {
                      nameof(FileUploadDataEventMessage.UploadId),
                      string.IsNullOrEmpty(uploadId) || !Guid.TryParse(uploadId, out parsedUploadId)
                  },
                  {
                      nameof(FileUploadDataEventMessage.FileName),
                      string.IsNullOrEmpty(fileName)
                  }
              };
  
              foreach (KeyValuePair&lt;string, bool&gt; propertyValidationPair in propertyValidation)
                  LogPropertyInErrorState(log, propertyValidationPair.Value, blobFileName, propertyValidationPair.Key);
  
              var hasInvalidPathParameters = parsedOrganisationId == Guid.Empty || !isRecognisedFileUploadType || parsedUploadId == Guid.Empty || string.IsNullOrEmpty(fileName);
  
              outgoingMessage = !hasInvalidPathParameters ? JsonConvert.SerializeObject(new FileUploadDataEventMessage()
              {
                  OrganisationId = parsedOrganisationId,
                  UploadId = parsedUploadId,
                  FileUploadType = Enum.Parse&lt;FileUploadType&gt;(PascalCaseWord(fileUploadType)),
                  FileName = fileName,
                  Timestamp = DateTimeOffset.Now
              }) : null;
  
              log.LogInformation($&quot;{FunctionName} Processed blob {Environment.NewLine} Name:{blobFileName + Environment.NewLine} Size: {inputBlob.Length} Bytes&quot;);
          }
  
          private static string GetPartFromString(string inputString, string delimiter, int targetIndex)
          {
              var inputStringParts = inputString.Split(delimiter);
  
              if (inputStringParts.ElementAtOrDefault(targetIndex) != null)
                  return inputStringParts[targetIndex];
  
              return null;
          }
  
          private static void LogPropertyInErrorState(ILogger log, bool errorValidationCondition, string fileName, string propertyName)
          {
              var errorMessage = errorValidationCondition ?
                  $&quot;{FunctionName} Failed to process blob {Environment.NewLine} Name: {fileName + Environment.NewLine} Missing or invalid {propertyName}&quot; : string.Empty;
  
              if (!string.IsNullOrEmpty(errorMessage))
                  log.LogInformation(errorMessage);
          }
  
          private static string PascalCaseWord(string input) =&gt;
              input.Substring(0, 1).ToUpperInvariant() + input.Substring(1);
      }
  }
  </code></pre>
  <p>It doesn't seem to be the issue with the function as the rest of the team doesn't seem to experience the same issue and can successfully run the function. So I'm assuming its a system issue.</p>