CodeSmith.Insight.ClientError CodeSmith 5.2 - envdte

Can someone help me with this problem?. I have been having with CodeSmith 5.2. Not sure if I messed up something with visual studio..I just right click and manage or Generate output and this error occurs
If I try to open CodeSmithapplication and debug separately through CodeSmith studio, then it generates the .cs and generated.cs files correctly. Only when it is in the application and I right click to generate outputs, this error occurs.
Why is it complaining about Env_DTE?
This the error I am getting
<?xml version="1.0" encoding="utf-16"?>
<CaseReport xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.codesmithtools.com/insight/v2">
<MessageSignature i:nil="true" />
<ProjectId>24</ProjectId>
<Description i:nil="true" />
<IsDescriptionHtml>false</IsDescriptionHtml>
<MessageDate>2016-02-02T16:47:53.7606242-06:00</MessageDate>
<MessageIdentifier>95e884f0-eb58-42e2-8bcc-e52d23909897</MessageIdentifier>
<Attachments />
<CaseType>CrashReport</CaseType>
<ClientVersion>1.0.0.10642</ClientVersion>
<CustomFields>
<CustomField>
<Key>Platform</Key>
<Value>Microsoft Windows NT 6.2.9200.0, (x64)</Value>
</CustomField>
<CustomField>
<Key>Version</Key>
<Value>1.0.0.10642</Value>
</CustomField>
<CustomField>
<Key>AssemblyFileVersion</Key>
<Value>5.2.1.10970</Value>
</CustomField>
</CustomFields>
<ExceptionDetail>
<Description>System.NotImplementedException: Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))
at EnvDTE.Document.get_Kind()
at CodeSmith.VisualStudio.Package.Services.ProjectService.SaveAll()
at CodeSmith.VisualStudio.Package.Commands.GenerateOutputsCommand.Invoke(Object inArg, IntPtr outArg)</Description>
<ErrorCode i:nil="true" />
<ExceptionTypeName>System.NotImplementedException</ExceptionTypeName>
<ExceptionXml><?xml version="1.0" encoding="utf-16"?><object name="NotImplementedException" namespace="System" xmlns="http://schemas.codesmithtools.com/insight/objectdata" /></ExceptionXml>
<InnerException i:nil="true" />
<Message>Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))</Message>
<MethodName>get_Kind</MethodName>
<ModuleName>EnvDTE</ModuleName>
<ModuleVersion>8.0.0.0</ModuleVersion>
<Source></Source>
<StackTrace> at EnvDTE.Document.get_Kind()
at CodeSmith.VisualStudio.Package.Services.ProjectService.SaveAll()
at CodeSmith.VisualStudio.Package.Commands.GenerateOutputsCommand.Invoke(Object inArg, IntPtr outArg)</StackTrace>
</ExceptionDetail>
<ReportHash>68c99a55f4cd2227874d69af3245f8d575cb31c1</ReportHash>
<Tags>
<string>Package</string>
<string>Package</string>
</Tags>
<Title>Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))</Title>
</CaseReport>

I work for CodeSmith. I believe you are using an old version of 5.x and this was probably fixed in 5.3 of Generator. I'd upgrade to that version free of charge and try it. Also, I'd highly recommend upgrading to 7.x as we've completely rewrote most of the components and fixed a TON of bugs and added many new features while being backward compat.

Related

How adapt extension to Visual Studio 2019?

I read that adapting of extension for VS 2019 is quite easy - https://devblogs.microsoft.com/visualstudio/visual-studio-extensions-and-version-ranges-demystified/#.
But I got an error if I do all the actions from the post:
It's not possible to install because there is no following links:
Microsoft.VisualStudio.Component.CoreEditor.
The author of the post shows the exactly same row when he adapts his extensions:
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" />
So it seems that this prerequisite was not a problem for him.
My updated extension.vsixmanifest is:
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011">
<Metadata>
<Identity Id="PowerQuerySDK.Microsoft.30831070-f420-4649-a031-6f679996b182" Version="1.0.0.20" Language="en-US" Publisher="Microsoft" />
<DisplayName>Power Query SDK</DisplayName>
<Description xml:space="preserve">A Power Query language service for Visual Studio</Description>
<License>Microsoft Power Query SDK - Pre-Release or Evaluation Use Terms.rtf</License>
<Icon>dataconnector_128.png</Icon>
<PreviewImage>EATIcon.ico</PreviewImage>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0,17.0)" />
<InstallationTarget Version="[14.0,17.0)" Id="Microsoft.VisualStudio.Pro" />
<InstallationTarget Version="[14.0,17.0)" Id="Microsoft.VisualStudio.Enterprise" />
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" Version="[4.5,)" />
</Dependencies>
<Assets>
<Asset Type="Microsoft.VisualStudio.ProjectTemplate" Path="ProjectTemplates" />
<Asset Type="Microsoft.VisualStudio.ItemTemplate" Path="ProjectTemplates" />
<Asset Type="Microsoft.VisualStudio.VsPackage" Path="Dependencies\Microsoft.Mashup.Tools.VisualStudio.pkgdef" />
<Asset Type="Microsoft.VisualStudio.MefComponent" Path="Dependencies\Microsoft.Mashup.Tools.VisualStudio.dll" />
</Assets>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,)" />
</Prerequisites>
</PackageManifest>
Please could you say what may be the workaround for the problem?
I found the solution for the problem. It is in catalog.json file inside PowerQuerySdk.vsix file. You should change part of the file from:
"Microsoft.VisualStudio.Component.CoreEditor":"[15.0,16.0)"}
to:
"Microsoft.VisualStudio.Component.CoreEditor":"[15.0,17.0)"}
.
I didn't suspect that the mention of CoreEditor may be in this file. But obviously you should change the version of MSBuild to 17, just as you should do in extension.vsixmanifest, as it is described in the post of Mads Kristensen above.
Up to now all works fine for me :-).
I also ran into this issue while porting a Visual Studio Extension forward from 2017 to 2019.
The change was 2-fold:
Firstly updating the 'Installation Target' range in the 'vsixmanifest' file.
Secondly, updating the Prerequisite 'Microsoft.VisualStudio.Component.CoreEditor'
Below is an example of the Manifest file I changed.
Pull Request
Mads Kristensen's original Blog Post on forward porting Visual Studio Extensions from VS 2017 to VS 2019.

How to resolve this Query builder error

I am new to CRM 365. I were creating many cases since last 2 days and tried editing the phone to case business process flow. Since then whether I create a new case or else I try to view any case I get a Query builder error. And the downloaded text file specifies this message "'Incident' entity doesn't contain attribute with Name = 'IncidentResolution_LinkControl'."
Context is dynamics CRM 365. Please help anyone?
Text file below:
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #3BA08A21Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ActivityId>3ce940dd-a4a8-4e61-a4da-051a35f5ab9e</ActivityId>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #3BA08A21</Message>
<Timestamp>2016-12-22T06:10:30.7389644Z</Timestamp>
<ExceptionSource i:nil="true" />
<InnerFault>
<ActivityId>3ce940dd-a4a8-4e61-a4da-051a35f5ab9e</ActivityId>
<ErrorCode>-2147217149</ErrorCode>
<ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>'Incident' entity doesn't contain attribute with Name = 'IncidentResolution_LinkControl'.</Message>
<Timestamp>2016-12-22T06:10:30.7389644Z</Timestamp>
<ExceptionSource i:nil="true" />
<InnerFault i:nil="true" />
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<OriginalException i:nil="true" />
<TraceText i:nil="true" />
</OrganizationServiceFault>
I resolved this by removing the last step and replacing it by another step. (not resolve case) . But rather I added CSAT survey step.

Using NLog with asp-net layout renderers in AspNet vNext (MVC 6)

I am trying to integrate NLog in AspNet 5 (or using the new name AspNet Core 1.0) web app. Not sure if it is possible at all but I want to log the currently logged in user.
This is my NLog config file.
<?xml version="1.0" encoding="utf-8" ?>
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
autoReload="true">
<targets>
<target name="logfile"
xsi:type="File"
fileName="file.txt"
layout="${longdate}|${message}|${identity}|${aspnet-user-identity}" />
</targets>
<rules>
<logger name="WebApplication2.*" minlevel="Info" writeTo="logfile" />
</rules>
</nlog>
The thing is that I get
System.ArgumentException: LayoutRenderer cannot be found: 'aspnet-user-identity'
My project.json file looks like:
"dependencies": {
.....
"NLog.Framework.logging": "1.0.0-rc1-final",
"NLog": "4.4.0-alpha1",
"NLog.Config": "4.3.0-beta1",
"NLog.Extended": "4.0.0-rc",
"NLog.Web": "4.1.0"
},
Maybe I am missing something, or it is not yet supported by NLog ?
EDIT: I found out that auto load of extensions is not currently supported. So, I have to modify my NLog.config like:
<extensions>
<add assembly="NLog.Web"/>
<add assembly="NLog.Extended"/>
</extensions>
But now I get blank input for the current user. Any ideas ?
The internal log will give some more info why loading the extension failed.
There are also other ways to load the extensions, the assemblyFile attribute and programmatically:
//target
ConfigurationItemFactory.Default.Targets
.RegisterDefinition("MyFirst", typeof(MyNamespace.MyFirstTarget));
//layout renderer
ConfigurationItemFactory.Default.LayoutRenderers
.RegisterDefinition("hello-world", typeof(MyNamespace.HelloWorldLayoutRenderer ));
Edit: did some tests. This works in loading the assembly:
<extensions>
<add assembly="NLog.Web" />
</extensions>
But too bad NLog.Web isn't ASP.NET 5 compatible, yet. We can't use HttpContext.Current there.
edit: an ASP.NET 5 compatible version of NLog.Web is now available! See NuGet

Registration-Free COM from ASP.NET?

Windows allows use of a COM object without having to register the COM dll.
The mechanism is to include a "dependent assembly" in the application's manifest:
MyProgram.exe.manifest
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity type="win32" name="myapp.exe" version="1.2.3.4" />
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Contoso.Frobber" version="5.1.81.4" />
</dependentAssembly>
</dependency>
</assembly>
And then your folder contains:
MyProgram.exe
MyProgram.exe.manifest (if you're using an external manifest; could also be embedded at RT_MANIFEST resource)
Contoso.Frobber.manifest (the COM DLL manifest)
confrob.dll (the dll containing the COM classes we want to use)
with the COM dll's assembly manifest containing:
Contoso.Frobber.manifest
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" name="Contoso.Frobber" version="1.0.0.0" />
<file name = "confrob.dll">
<comClass
progid="Frobber.Gizmo"
clsid="{00028C00-0000-0000-0000-000000000046}"
description="Gizmo Frobber by Contoso"
threadingModel = "Apartment" />
<typelib
tlbid="{00028C01-0000-0000-0000-000000000046}"
version="1.0"
helpdir=""/>
</file>
</assembly>
Excellent. i can now use a COM object from a (native or .NET) executable without having to register the COM object.
Now i want to use a COM object from an ASP.NET web-site, without registering the COM object.
Possible?
Bonus Chatter
Windows also allows an exe to call a .NET library, without having to install the .NET assembly into the Global Assembly Cache.
Although I can't test it right now I am pretty sure that this works:
IF the manifest for a DLL is external it will usually be ignored when the DLL is loaded via LoadLibrary (according to MSDN). IF the manifest is embedded into the DLL it is usually honored.
Embed the manifest into the ASP.NET application (i.e. code-behind DLL) - for some ways on how to do this see here and here and here.
UPDATE - as per comments:
The above is a workaround as there is no general way to do this (isolation), at least the ASP.NET creators haven't intended this to be possible - for example the above workaround won't work in cases where the application does not compile to a DLL...
Recently we were handling a similar case that we needed to enable Side by Side COM(reg-free COM) in IIS hosted ASP.NET core application, and we made it like:
embed the manifest to an assembly(.dll)
use CreateActCtx() to activate the manifest.
This approach works fine and it's recommended by MS .NET Runtime Interop Team.

publishing asp.net website give "Object reference not set to an instance of an object." error

I am getting fed up with this error. I have search all over the web and tried every possible suggestion to this error I could find.
delete app_code, build, add files back, publish. (did not work)
delete temporary asp.net files (did not work)
In the end I even tried the command line and get the following stacktrace.
error ASPRUNTIME: Object reference not set to an instance of an object.
[NullReferenceException]: Object reference not set to an instance of an object.
at System.Web.Compilation.BuildManager.CopyPrecompiledFile(VirtualFile vfile,
String destPhysicalPath)
at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ory sourceVdir, String destPhysicalDir, Boolean topLevel)
at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ory sourceVdir, String destPhysicalDir, Boolean topLevel)
at System.Web.Compilation.BuildManager.CopyStaticFilesRecursive(VirtualDirect
ory sourceVdir, String destPhysicalDir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath star
tingVirtualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirt
ualDir)
at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallba
ck callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCa
llback callback)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCa
llback callback)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil
dManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuil
dManagerCallback callback)
at System.Web.Compilation.Precompiler.Main(String[] args)
I used the following command line:
aspnet_compiler.exe -p d:\code\websites\brokerweb -v / d:\code\websites\published -f -c -errorstack -u
This error was occurring for me when I tried to compile the project with MSBUILD - it would build fine within Visual Studio, and would even Debug in my local browser. The Publish option within VS worked, as well. But the command-line MSBUILD was causing the project to error out every time.
I managed to fix this problem in VS 2012 by opening the Property Pages on my Website, opening the 'MSBuild Options' tab, and unchecking the 'Allow this precompiled site to be updatable' option, then hitting 'save all'.
I had the same experience and removing the compressed flag from the solution directory tree, set the compiler working again.
This typically happens when a *.dll.refresh file in the bin directory points to a location that is no longer available. Deleting the *.dll.refresh files should resolve the issue.
I know this is an old post, but just in case someone will find this usefull:
The cause of this problem for me was the McAfee anti-virus
ASPNETCOMPILER(0,0): Error ASPRUNTIME: Object reference not set to an instance of an object
I had a similar problem when compiling views in MVC WebApplication. NullReferenceException was thrown only when building solution inside VS or MSBuild. Running aspnet_compiler.exe from command line was without errors.
error ASPRUNTIME: Object reference not set to an instance of an object.
[NullReferenceException]: Object reference not set to an instance of an object.
at System.Web.Compilation.DiskBuildResultCache.CacheBuildResult(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
at System.Web.Compilation.BuildManager.CacheBuildResultInternal(String cacheKey, BuildResult result, Int64 hashCode, DateTime utcStart)
at System.Web.Compilation.WebDirectoryBatchCompiler.CacheAssemblyResults(AssemblyBuilder assemblyBuilder, CompilerResults results)
at System.Web.Compilation.WebDirectoryBatchCompiler.CompileAssemblyBuilder(AssemblyBuilder builder)
at System.Web.Compilation.WebDirectoryBatchCompiler.<CompileNonDependentBuildProviders>b__0(AssemblyBuilder assemblyBuilder)
at System.Web.Compilation.CompilationUtil.CompileParallel(ICollection assemblyBuilders, Action`1 action)
at System.Web.Compilation.WebDirectoryBatchCompiler.CompileNonDependentBuildProviders(ICollection buildProviders)
at System.Web.Compilation.WebDirectoryBatchCompiler.Process()
at System.Web.Compilation.BuildManager.BatchCompileWebDirectoryInternal(VirtualDirectory vdir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.BatchCompileWebDirectory(VirtualDirectory vdir, VirtualPath virtualDir, Boolean ignoreErrors)
at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileWebDirectoriesRecursive(VirtualDirectory vdir, Boolean topLevel)
at System.Web.Compilation.BuildManager.PrecompileAppInternal(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManager.PrecompileApp(VirtualPath startingVirtualDir, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManager.PrecompileApp(ClientBuildManagerCallback callback, IEnumerable`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
at System.Web.Compilation.BuildManagerHost.PrecompileApp(ClientBuildManagerCallback callback, List`1 excludedVirtualPaths)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback, Boolean forceCleanBuild)
at System.Web.Compilation.ClientBuildManager.PrecompileApplication(ClientBuildManagerCallback callback)
at System.Web.Compilation.Precompiler.Main(String[] args)
After a day of looking for answers on web and discovering with ProcessMonitor, I found out that it was happening when compiler tried to compile ReportService.svc file. If this file was deleted or extension renamed, everything compiled just fine.
Very strange resolution fixed problem of compiling svc files. A few days ago I turned on ntfs compression on this project to save some space. And this was the only problem. When ntfs compression attribute was removed from website folder, NullReferenceException problem was resolved.
I have recently encountered this Error. As #samiz mentioned above, First of all, you need to delete all *.dll.Refresh after that build and publish your website. However, sometimes, as happen for me, when you have deleted *.dll.refresh, then publish your website, Error reminds as usual. I have done a lot of tests, but nothing changes.
I also create a new folder and copy all *.dlls which I need for my website. Next, delete all *.dll inside Bin folder then add them by one.
Finally, I re-start My PC, and then I try to publish my website. Believe me or not, it works fine and no error occurred.
I had a similar issue. The application would build and run in the IDE, but fail to publish; conking out at the 'merge dll into single assembly' stage. After researching aspnet_merge.exe I found that the issue was resolved by unchecking the 'emit debug information' checkbox in the publish options.
It may not be a 'clean' fix for the issue, but it's a workaround.
Hope this helps.
Andrew
Deleting all the *.compiled files from Bin folder of the website works for me. :)
These files are safe to delete and are created during precompilation. For more info check this MSDN link.
In Visual Studio 2017, none of the solutions given here worked for me. I was able to solve the problem by the following steps:
Exit Visual Studio if its running
Open Visual Studio Installer from the start menu
Under the Installed tab, it will display the version of Visual Studio on your computer
Click the More option and select Repair
After the repair operation is complete, relaunch your project in Visual Studio
Now you shouldn't get this error when you click Publish
In my case, clearing cookies resolved the issue.
The StackTrace had mentioned some authorization and cookies thing. I opened the web application in InCognito mode (which do not persist cookie store) and found the app working.
Hope it helps somebody.
Again, this is an old post, but I had the following:
VS2012 asp.net web forms app -> upgraded to VS2013
Try to publish - get same error as OP.
When I finally figured it out, the problem was caused by one thing:
when I looked into the membership providers in web.config, one item was missing the connectionStringName attribute:
bad:
<membership defaultProvider="SomeMembershipProvider">
<providers>
<clear />
<add name="SomeMembershipProvider" type="System.Web.Security.SqlMembershipProvider" passwordFormat="Encrypted" applicationName="SomeAppName" />
<add connectionStringName="SomeConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/SomeAppName" requiresUniqueEmail="false" blaw blaw blaw />
</providers>
</membership>
good:
<membership defaultProvider="SomeMembershipProvider">
<providers>
<clear />
<add name="SomeMembershipProvider" connectionStringName="PerhapsSomeOtherConnectionString" type="System.Web.Security.SqlMembershipProvider" passwordFormat="Encrypted" applicationName="SomeAppName" />
<add connectionStringName="SomeConnectionString" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="true" applicationName="/SomeAppName" requiresUniqueEmail="false" blaw blaw blaw />
</providers>
</membership>
I'm not sure why one of the connectionStringName attributes was stripped out, or even if it was ever there, but you can turn this error on and off with this one setting.
I had the same problem when I tried to publish my webservice. The problem was that the PrecompiledApp.config file that gets created when you publish your website to a directory was some how added to my project. With that added, it caused the error.
The resolution: I deleted the file from my project tree in Visual Studio and then I was able to publish the webservice again with the precompiled settings enabled/checked.
make sure you are not publishing directly on virtual directory. if yes, stop the site then publish then restart the site.
upgrade your Visual Studio to VS 2013. it solved the issue for me. :)

Resources