A reminder, if the above message is encountered when installing a windows service after removing a previous version, then
- Close all instances of Event Log viewer
- Close all instances of Services MMC (Microsoft Management Console) for all users on server
- Use task manager to ensure the old service process is not running
- Sign other users out of server if above fails
Since understanding the above the message no longer haunts me.
Stackoverflow post: How to solve “The specified service has been marked for deletion” error
It is often worth going back to basics, it turns out quite a few people don’t realise that calling “.ToString” on an exception object in .NET, will provide a nicely formatted output suitable for logging. It will also recursively extract the inner exceptions, if there are any too. It includes the stack trace. I’ve seen quite a few times now code that replicates the same functionality as this built in function. Here is the description from MSDN.
The default implementation of ToString obtains the name of the class that threw the
current exception, the message, the result of calling ToString on the inner exception,
and the result of calling Environment.StackTrace.
If any of these members is null, its value is not included in the returned string.
[MSDNException.ToString Method ()]
This is quite helpful as it means no traversing the exception objects extracting the inner exceptions, if they exist as its already implemented in this method.
Attempting to print from the RPi over serial RS232 interface using the GW command, I was getting image corruption. Some of the image would appear to wrap, or the image would just not print unless some extra line feeds were added to the end of the command. This was even though the number of bytes sent was correct.
After blaming my code for dithering the image for three hours, I finally found the issue. I had checked through each printer software switch and setting, wasting much time tinkering with form size, thinking it was the cause of picture wrapping. I finally looked at Windows Mode (notice how W is towards back of the book). This was set to Y (YES), looking at the description in the EPL programming guide, it said it all…
The Windows mode escape sequences are only used by the optional Windows printer driver. When working with a main frame or other non-Windows host, this mode can be disabled to prevent erratic operation.
As I was using RS232 on Windows IoT core – I think this counts as requiring a setting of “NO”.
So sending the EPL command “WN” did the trick. No more odd behaviour sending the binary for the PCX image. I’ve seen on many forums other people struggling and giving up on sending images via GW, hopefully this post may give some another thing to check. Do comment if it helped you!
After adding the configuration sections to Dynamics.exe.config
<section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=188.8.131.52, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
<defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
<provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />
and adding the connnection strings section, the following error occurs…
Message: The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer' registered in the application config file for the ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded. Make sure that the assembly-qualified name is used and that the assembly is available to the running application. See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
Stack Trace: at System.Data.Entity.Infrastructure.DependencyResolution.ProviderServicesFactory.GetInstance(String providerTypeName, String providerInvariantName)
at System.Data.Entity.Internal.AppConfig.<;.ctor>b__2(ProviderElement e)
at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetServiceFactory(Type type, String name)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.<;>c__DisplayClass1.<GetService>b__0(Tuple`2 t)
at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
at System.Data.Entity.Infrastructure.DependencyResolution.AppConfigDependencyResolver.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.<;>c__DisplayClass3.<GetService>b__0(IDbDependencyResolver r)
at System.Linq.Enumerable.FirstOrDefault[TSource](IEnumerable`1 source, Func`2 predicate)
at System.Data.Entity.Infrastructure.DependencyResolution.ResolverChain.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.CompositeResolver`2.GetService(Type type, Object key)
at System.Data.Entity.Infrastructure.DependencyResolution.DbDependencyResolverExtensions.GetService[T](IDbDependencyResolver resolver, Object key)
at System.Data.Entity.Core.EntityClient.EntityConnection.ChangeConnectionString(String newConnectionString)
at System.Data.Entity.Core.EntityClient.EntityConnection..ctor(String connectionString)
at canford.SalesOrderProcessingEntities.GetSqlConnection(String ConnectionString)
Seems that as I have all the data access defined in its own class lib, there is no code causing a reference to force the correct EntityFramework.SqlServer.dll to be pushed to the build output.
So this hack did the job for now and I’ve posted this here to come back to another time.
Stack overflow post: EntityFramework.SqlServer.dll not is getting added
private void FixEfProviderServicesProblem()
// The Entity Framework provider type 'System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer'
// for the 'System.Data.SqlClient' ADO.NET provider could not be loaded.
// Make sure the provider assembly is available to the running application.
// See http://go.microsoft.com/fwlink/?LinkId=260882 for more information.
var instance = System.Data.Entity.SqlServer.SqlProviderServices.Instance;