diff --git a/src/Microsoft.Azure.WebJobs.Host/Executors/JobHostContextFactory.cs b/src/Microsoft.Azure.WebJobs.Host/Executors/JobHostContextFactory.cs index 178e255f3..8fc34a23e 100644 --- a/src/Microsoft.Azure.WebJobs.Host/Executors/JobHostContextFactory.cs +++ b/src/Microsoft.Azure.WebJobs.Host/Executors/JobHostContextFactory.cs @@ -245,7 +245,8 @@ public static async Task CreateAndLogHostStartedAsync( if (descriptorsCount == 0) { - trace.Warning("No functions found. Try making job classes and methods public.", TraceSource.Indexing); + trace.Warning(string.Format("No job functions found. Try making your job classes and methods public. {0}", + Resource.ExtensionInitializationMessage), TraceSource.Indexing); } else { diff --git a/src/Microsoft.Azure.WebJobs.Host/Indexers/FunctionIndexer.cs b/src/Microsoft.Azure.WebJobs.Host/Indexers/FunctionIndexer.cs index 14c9cf29f..c361cd169 100644 --- a/src/Microsoft.Azure.WebJobs.Host/Indexers/FunctionIndexer.cs +++ b/src/Microsoft.Azure.WebJobs.Host/Indexers/FunctionIndexer.cs @@ -188,22 +188,22 @@ internal async Task IndexMethodAsyncCore(MethodInfo method, IFunctionIndexCollec { if (triggerBinding != null && !hasNoAutomaticTriggerAttribute) { - throw new InvalidOperationException(string.Format("Cannot bind parameter '{0}' when using this trigger.", parameter.Name)); + throw new InvalidOperationException( + string.Format(Resource.UnableToBindParameterFormat, + parameter.Name, parameter.ParameterType.Name, Resource.ExtensionInitializationMessage)); } else { // Host.Call-only parameter - string parameterName = parameter.Name; - Type parameterType = parameter.ParameterType; - - binding = InvokeBinding.Create(parameterName, parameterType); - + binding = InvokeBinding.Create(parameter.Name, parameter.ParameterType); if (binding == null && invalidInvokeBindingException == null) { // This function might not have any attribute, in which case we shouldn't throw an // exception when we can't bind it. Instead, save this exception for later once we determine // whether or not it is an SDK function. - invalidInvokeBindingException = new InvalidOperationException(string.Format("Cannot bind parameter '{0}' to type {1}.", parameterName, parameterType.Name)); + invalidInvokeBindingException = new InvalidOperationException( + string.Format(Resource.UnableToBindParameterFormat, + parameter.Name, parameter.ParameterType, Resource.ExtensionInitializationMessage)); } } } diff --git a/src/Microsoft.Azure.WebJobs.Host/Properties/AssemblyInfo.cs b/src/Microsoft.Azure.WebJobs.Host/Properties/AssemblyInfo.cs index 3a9f1b986..a301f8f33 100644 --- a/src/Microsoft.Azure.WebJobs.Host/Properties/AssemblyInfo.cs +++ b/src/Microsoft.Azure.WebJobs.Host/Properties/AssemblyInfo.cs @@ -2,10 +2,12 @@ // Licensed under the MIT License. See License.txt in the project root for license information. using System.Reflection; +using System.Resources; using System.Runtime.CompilerServices; [assembly: AssemblyVersion("1.1.0.0")] [assembly: AssemblyFileVersion("1.1.0.0")] +[assembly: NeutralResourcesLanguage("en-US")] [assembly: InternalsVisibleTo("Dashboard.UnitTests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] diff --git a/src/Microsoft.Azure.WebJobs.Host/Resource.Designer.cs b/src/Microsoft.Azure.WebJobs.Host/Resource.Designer.cs new file mode 100644 index 000000000..acd73f8b9 --- /dev/null +++ b/src/Microsoft.Azure.WebJobs.Host/Resource.Designer.cs @@ -0,0 +1,81 @@ +//------------------------------------------------------------------------------ +// +// This code was generated by a tool. +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ + +namespace Microsoft.Azure.WebJobs.Host { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // This class was auto-generated by the StronglyTypedResourceBuilder + // class via a tool like ResGen or Visual Studio. + // To add or remove a member, edit your .ResX file then rerun ResGen + // with the /str option, or rebuild your VS project. + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + internal class Resource { + + private static global::System.Resources.ResourceManager resourceMan; + + private static global::System.Globalization.CultureInfo resourceCulture; + + [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] + internal Resource() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Resources.ResourceManager ResourceManager { + get { + if (object.ReferenceEquals(resourceMan, null)) { + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Microsoft.Azure.WebJobs.Host.Resource", typeof(Resource).Assembly); + resourceMan = temp; + } + return resourceMan; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized string similar to If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.).. + /// + internal static string ExtensionInitializationMessage { + get { + return ResourceManager.GetString("ExtensionInitializationMessage", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Cannot bind parameter '{0}' to type {1}. Make sure the parameter Type is supported by the binding. {2}. + /// + internal static string UnableToBindParameterFormat { + get { + return ResourceManager.GetString("UnableToBindParameterFormat", resourceCulture); + } + } + } +} diff --git a/src/Microsoft.Azure.WebJobs.Host/Resource.resx b/src/Microsoft.Azure.WebJobs.Host/Resource.resx new file mode 100644 index 000000000..e40c79566 --- /dev/null +++ b/src/Microsoft.Azure.WebJobs.Host/Resource.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + If you're using binding extensions (e.g. ServiceBus, Timers, etc.) make sure you've called the registration method for the extension(s) in your startup code (e.g. config.UseServiceBus(), config.UseTimers(), etc.). + + + Cannot bind parameter '{0}' to type {1}. Make sure the parameter Type is supported by the binding. {2} + + \ No newline at end of file diff --git a/src/Microsoft.Azure.WebJobs.Host/Singleton/SingletonValueProvider.cs b/src/Microsoft.Azure.WebJobs.Host/Singleton/SingletonValueProvider.cs index 79051bd75..f90a159b4 100644 --- a/src/Microsoft.Azure.WebJobs.Host/Singleton/SingletonValueProvider.cs +++ b/src/Microsoft.Azure.WebJobs.Host/Singleton/SingletonValueProvider.cs @@ -108,7 +108,6 @@ public ParameterLog GetStatus() { // periodically determine and log the current owner Task task = _singletonLock.GetOwnerAsync(CancellationToken.None); - task.Wait(); _log.LockOwner = task.Result; _lastOwnerCheck = DateTime.UtcNow; diff --git a/src/Microsoft.Azure.WebJobs.Host/WebJobs.Host.csproj b/src/Microsoft.Azure.WebJobs.Host/WebJobs.Host.csproj index 72f13a36d..188267a73 100644 --- a/src/Microsoft.Azure.WebJobs.Host/WebJobs.Host.csproj +++ b/src/Microsoft.Azure.WebJobs.Host/WebJobs.Host.csproj @@ -478,6 +478,11 @@ + + True + True + Resource.resx + @@ -931,7 +936,12 @@ Designer - + + + ResXFileCodeGenerator + Resource.Designer.cs + + diff --git a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/FunctionalTest.cs b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/FunctionalTest.cs index a4d35ebe2..0df99e3a3 100644 --- a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/FunctionalTest.cs +++ b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/FunctionalTest.cs @@ -240,9 +240,7 @@ private static IServiceProvider CreateServiceProvider(IStorageAccount s IFunctionInstanceLoggerProvider functionInstanceLoggerProvider = new NullFunctionInstanceLoggerProvider(); IFunctionOutputLoggerProvider functionOutputLoggerProvider = new NullFunctionOutputLoggerProvider(); - Task task = functionOutputLoggerProvider.GetAsync(CancellationToken.None); - task.Wait(); - IFunctionOutputLogger functionOutputLogger = task.Result; + IFunctionOutputLogger functionOutputLogger = functionOutputLoggerProvider.GetAsync(CancellationToken.None).Result; FunctionExecutor executor = new FunctionExecutor(functionInstanceLogger, functionOutputLogger, backgroundExceptionDispatcher, new TestTraceWriter(TraceLevel.Verbose), null); SingletonConfiguration singletonConfig = new SingletonConfiguration(); diff --git a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/Queues/QueueProcessorTests.cs b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/Queues/QueueProcessorTests.cs index a1798a37e..e29bc4b5c 100644 --- a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/Queues/QueueProcessorTests.cs +++ b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/Queues/QueueProcessorTests.cs @@ -123,7 +123,6 @@ public TestFixture() DefaultStorageAccountProvider accountProvider = new DefaultStorageAccountProvider(services.Object); var task = accountProvider.GetStorageAccountAsync(CancellationToken.None); - task.Wait(); IStorageQueueClient client = task.Result.CreateQueueClient(); QueueClient = client.SdkObject; diff --git a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/TestDoubles/FakeQueueConfiguration.cs b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/TestDoubles/FakeQueueConfiguration.cs index 3ff763300..a85df535f 100644 --- a/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/TestDoubles/FakeQueueConfiguration.cs +++ b/test/Microsoft.Azure.WebJobs.Host.FunctionalTests/TestDoubles/FakeQueueConfiguration.cs @@ -60,7 +60,6 @@ public FakeQueueProcessorFactory(IStorageAccountProvider accountProvider) { CancellationToken token = new CancellationToken(); Task task = accountProvider.GetStorageAccountAsync(token); - task.Wait(); _storageAccount = task.Result; } diff --git a/test/Microsoft.Azure.WebJobs.Host.TestCommon/JobHostFactory.cs b/test/Microsoft.Azure.WebJobs.Host.TestCommon/JobHostFactory.cs index 0ac6439e8..317957670 100644 --- a/test/Microsoft.Azure.WebJobs.Host.TestCommon/JobHostFactory.cs +++ b/test/Microsoft.Azure.WebJobs.Host.TestCommon/JobHostFactory.cs @@ -61,9 +61,7 @@ public static TestJobHost Create(CloudStorageAccount storage SingletonManager singletonManager = new SingletonManager(); IFunctionOutputLoggerProvider outputLoggerProvider = new NullFunctionOutputLoggerProvider(); - var task = outputLoggerProvider.GetAsync(CancellationToken.None); - task.Wait(); - IFunctionOutputLogger outputLogger = task.Result; + IFunctionOutputLogger outputLogger = outputLoggerProvider.GetAsync(CancellationToken.None).Result; IFunctionExecutor executor = new FunctionExecutor(new NullFunctionInstanceLogger(), outputLogger, BackgroundExceptionDispatcher.Instance, new TestTraceWriter(TraceLevel.Verbose), null); var triggerBindingProvider = DefaultTriggerBindingProvider.Create( diff --git a/test/Microsoft.Azure.WebJobs.Host.UnitTests/FunctionIndexerFactory.cs b/test/Microsoft.Azure.WebJobs.Host.UnitTests/FunctionIndexerFactory.cs index dd30d79f2..563863fed 100644 --- a/test/Microsoft.Azure.WebJobs.Host.UnitTests/FunctionIndexerFactory.cs +++ b/test/Microsoft.Azure.WebJobs.Host.UnitTests/FunctionIndexerFactory.cs @@ -51,9 +51,7 @@ public static FunctionIndexer Create(CloudStorageAccount account = null, INameRe blobWrittenWatcherAccessor, new DefaultExtensionRegistry()); IFunctionOutputLoggerProvider outputLoggerProvider = new NullFunctionOutputLoggerProvider(); - var task = outputLoggerProvider.GetAsync(CancellationToken.None); - task.Wait(); - IFunctionOutputLogger outputLogger = task.Result; + IFunctionOutputLogger outputLogger = outputLoggerProvider.GetAsync(CancellationToken.None).Result; IFunctionExecutor executor = new FunctionExecutor(new NullFunctionInstanceLogger(), outputLogger, BackgroundExceptionDispatcher.Instance, new TestTraceWriter(TraceLevel.Verbose), null); if (extensionRegistry == null)