Subsonic T4 TextTemplatingService Exception on VS 2005 - serialization

I have a VS2005 web application I am using the MySQL active record templates and is perfectly working in VS2008 however I get this error:
Custom tool error: An Exception was thrown while running the transformation code. The process cannot continue. The following Exception was thrown:
System.Runtime.Serialization.SerializationException: Type 'Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService' in Assembly 'Microsoft.VisualStudio.TextTemplating.VSHost, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' is not marked as serializable.
View Full Exception Details:
http://pastebin.com/rF8iQJW2
I have the following packages installed to make it work for vs2005:
http://goo.gl/uINkV
Guidance Automation Toolkit for Visual Studio 2005 - February 2008 Release
http://goo.gl/OEUNP
Guidance Automation Extensions - February 2008 Release

Subsonic 3.0 doesn't work for VS2005 as it requires .NET framework 3.5

Previous answer is not correct. The T4 system now runs out of process and sets up an Ipc channel back to the Host. This transport channel ( based on remoting ) uses a Binary serializer and cannot transport the Microsoft.VisualStudio.TextTemplating.VSHost.TextTemplatingService over that channel because it is not marked as serializable, exactly as the exception message says.
Incidently, you can get access to this service by changing the template directive hostspecific="true" and accessing the "Host" property.
There are also some parts of the EnvDTE.DTE that cannot be accessed via T4 templates for the same reason ( like DTE.Windows or DTE.WindowConfiguration ).

Related

Load Standard library in .net core application

i have created one library using .net standard , am trying to use that in .net core api ,
but am getting error -
Error constructing handler for request of type MediatR.IRequestHandler`2[]. Register your handlers with the container. See the samples in GitHub for examples.
inner exception -
Could not load file or assembly 'RedisHelper.Client, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
my mediatr injection as follow -
services.AddMediatR(Assembly.GetExecutingAssembly());
my class DI -
services.AddTransient<IRedisClient, RedisClient>();
can any one suggest me what i am missing here .
Thanks
Error constructing handler for request of type
MediatR.IRequestHandler`2[]. Register your handlers with the
container. See the samples in GitHub for examples.
inner exception - Could not load file or assembly 'RedisHelper.Client,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. The system
cannot find the file specified.
As the exception message said, could not load the RedisHelper.Client assembly. Please check your .net core application and the .net standard library, where you add this assembly? Please ensure it adds success, you could also try to re-install it.
Besides, if you add the RedisHelper.Client assembly in the library, you should also add it in the .net core application.

ASP.NET Core 3.0 project fails to run under IIS Express: HTTP Error 500.30 - ANCM In-Process Start Failure // ERROR: Unknown command '%LAUNCHER_ARGS%'

I migrated a project from asp.net core 2.2 to 3.0 following the migration guide.
After a couple issues were resolved, starting it with dotnet run worked fine.
However when I try to run/debug with IIS Express, I get the following error:
HTTP Error 500.30 - ANCM In-Process Start Failure
Common solutions to this issue:
The application failed to start
The application started but then stopped
The application started but threw an exception during startup
Troubleshooting steps:
Check the system event log for error messages
Enable logging the application process' stdout messages
Attach a debugger to the application process and inspect
For more information visit: https://go.microsoft.com/fwlink/?LinkID=2028265
The output window for "ASP.NET Core Web Server" in Visual Studio shows the follwing error:
ERROR: Unknown command '%LAUNCHER_ARGS%'
As does an error entry in the windows event viewer
<EventData>
<Data>Application '/LM/W3SVC/2/ROOT' with physical root 'C:\Path\To\Project\' has exited from Program.Main with exit code = '1'. First 30KB characters of captured stdout and stderr logs: ERROR: Unknown command '%LAUNCHER_ARGS%'</Data>
<Data>Process Id: 7092.</Data>
<Data>File Version: 13.0.19258.0. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: aee5e4080331553ea9dfb7fb388b6d72f715bf6a</Data>
</EventData>
Immediately followed by:
<EventData>
<Data>Application '/LM/W3SVC/2/ROOT' with physical root 'C:\Path\To\Project\' failed to load coreclr. Exception message: CLR worker thread exited prematurely</Data>
<Data>Process Id: 7092.</Data>
<Data>File Version: 13.0.19258.0. Description: IIS ASP.NET Core Module V2 Request Handler. Commit: aee5e4080331553ea9dfb7fb388b6d72f715bf6a</Data>
</EventData>
My initial thought was that there was an issue with my system setup, but a fresh ASP.NET Core 3.0 project runs without issues in IIS Express. I compared the two applicationhost.config files of the projects and they're identical (except differences like the project name). I also can't find any meaningful differences in the other project files (Project.csproj, appsettings.json, launchSettings.json). I also tried deleting the .vs folder and .user files .
The error messages suggests that it's not a problem with my code. As does the fact that there's no exception the attached debugger breaks at and that everything seems to work fine using dotnet run. Yet a fresh project created via template runs without those issues.
I was able to identify the issue. One mistake I made was to attribute the ERROR: Unknown command message to ASP.NET, when it was actually our application that complained.
The %LAUNCHER_ARGS% parameter is still passed to the application, but it's no longer set in an in-process hosting context.
More details here: https://github.com/aspnet/AspNetCore/issues/14735

Unity Di container not working with 64 bit build

I am using Unity for in WCF service to load component.
I am referring below mention article.
https://msdn.microsoft.com/en-us/library/vstudio/hh323725(v=vs.100).aspx
Service is working fine when i build service in visual studio with build option option any CPU.
As one third party component required 64 bit specific build. So i selected 64 bit build option.
I have downloaded Unity code and build for 64 bit but it is also not working.
I am getting below mention exception.
Could not load file or assembly 'Common.Unity' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'Common.Unity' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Common.Unity' could not be loaded.
As this is not issue of Unity.
It is issue of IISExprees of VS2012 which is support on 32 bit.
Can't get IIS Express 8 beta to run website as 64-bit process
https://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/3254745-allow-for-iis-express-64-bit-to-run-from-visual-st

Ninject with WCF Application Error

In Visual Studio 2013, I've set up a WCF Application. My setup is exactly like the example posted at https://github.com/ninject/Ninject.Extensions.Wcf/tree/master/src/Examples. When I try to import my service reference from another project, I get the error below. I have have added Ninject.Extensions.Factory to the WCF project (and the referencing project) using Nuget, and still get the same error.
Warning 1 Custom tool warning: Cannot import wsdl:portType
Detail: An exception was thrown while running a WSDL import extension: System.ServiceModel.Description.DataContractSerializerMessageContractImporter
Error: Could not load file or assembly 'Ninject.Extensions.Factory, Version=3.2.0.0, Culture=neutral, PublicKeyToken=c7192dc5380945e7' or one of its dependencies. The system cannot find the file specified.
XPath to Error Source: //wsdl:definitions[#targetNamespace='http://tempuri.org/']/wsdl:portType[#name='IEnrollmentService'] C:\...\Reference.svcmap 1 1
When importing the Service Reference, click the Advanced button, then uncheck "reuse types in referenced assemblies".

Upgrading App from .NET 3.5 to 4.0, COM fails now

I have an application that I am upgrading from the .NET 3.5 to the .NET 4.0 framework. It uses a COM library which is referenced. It works no problem in 3.5 but after converting to 4.0 I have issues getting the COM to work. The COM is from a 3rd party so we didn't develop it ourselves.
I get the following COM error (generic COM error, not specific to the COM object itself): hr = 0x8007000b
CLR gives me: 'The invocation of the constructor on type 'Skype_Business_Launcher.Main' that matches the specified binding constraints threw an exception.' Line number '3' and line position '5'.
And the C# logs:
=== Pre-bind state information ===
LOG: User = \phillip
LOG: DisplayName = Interop.SKYPE4COMLib, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
(Fully-specified)
LOG: Appbase = file:///bin/Debug/
LOG: Initial PrivatePath = NULL
Calling assembly : Skype Business Launcher, Version=1.0.5.0, Culture=neutral, PublicKeyToken=null.
LOG: This bind starts in default load context.
LOG: Using application configuration file:
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework64\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///bin/Debug/Interop.SKYPE4COMLib.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
I removed the pathname for security reasons but I have checked all the path information and it's all correct. Also the COM library file exists where it's pointing to. It's also copied to the OBJ folder within the project as well.
Originally I was getting an error about the COM library not supporting embedded types so I made "Embed Interop Types" false (it was true below) and the error went away but I'm not sure if thats connected to this error or not so I thought I'd mention it just in case.
Again, it works just fine with 3.5.
Thanks,
A shot in the dark: it looks like you are using the x64 version of the framework. Was that already the case with 3.5 ? And is the COM server a DLL or an EXE ?
If the COM server is a DLL, there needs to be a "bitness" match between the DLL and your program.
when you convert your project to 4.0 the IDE can perform a issue to convert COM library into 4.0.
when you convert your project to 4.0 remove com library then Re include it in your project then i thing it should be works.