Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with dot net Standard 2.0 #10

Closed
AhmedRagheb opened this issue Oct 3, 2017 · 28 comments
Closed

Not compatible with dot net Standard 2.0 #10

AhmedRagheb opened this issue Oct 3, 2017 · 28 comments

Comments

@AhmedRagheb
Copy link

@AhmedRagheb AhmedRagheb commented Oct 3, 2017

When I upgrade my project from dot net Standard 1.3 to 2.0 models not got generated anymore.

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 3, 2017

We just updated as well and I'm now receiving GENERIC ERROR: A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context. when running TypeGen. Is this the same as you get, @AhmedRagheb? If it's not, I'll create a new issue.

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 4, 2017

I've made a new build of TypeGen.Cli for .NET Standard 2.0.
Standalone exe (TypeGen.Cli.exe) can be downloaded here: http://jburzynski.net/TypeGen/publish.zip

Right now the problem is I don't want to add standalone application to .nupkg, because it weights 50MB. And I can't add a portable .dll either, because you can't do dotnet TypeGen.Cli.dll in the package manager console.

I'll try to figure out some sensible solution to this, but in the meantime the link above should do the job, at least temporarily.

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 5, 2017

Should be fully working now (release 1.5.7).
There are no changes in the usage, so TypeGen (...) still works for both .NET Standard 1.3 and 2.0.

@bergi9
Copy link
Contributor

@bergi9 bergi9 commented Oct 5, 2017

I'm using MSBuild to generate TypeScript files.
My .csproj:

  <Target Name="TypeGen" AfterTargets="Build">
    <Exec Command="dotnet $(NuGetPackageFolders)typegen\1.5.7\tools\TypeGen.Cli.dll ." />
  </Target>

But it can't generate if the types has NuGet dependencies. It failed at resolving assemblies.
Stacktrace:

0: Error EXEC (0,0): Could not load file or assembly 'LiteDB, Version=4.0.0.0, Culture=neutral, PublicKeyToken=4ee40123013c9f27'. Application exception (Exception from HRESULT: 0x80131600)
0:    at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
0:    at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
0:    at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
0:    at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
0:    at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
0:    at System.Attribute.GetIndexParameterTypes(PropertyInfo element)
0:    at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)
0:    at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
0:    at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
0:    at TypeGen.Core.Extensions.EnumerableExtensions.<>c__0`1.<WithoutTsIgnore>b__0_0(T i)
0:    at System.Linq.Utilities.<>c__DisplayClass1_0`1.<CombinePredicates>b__0(TSource x)
0:    at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
0:    at System.Linq.Enumerable.UnionIterator`1.MoveNext()
0:    at TypeGen.Core.Business.TypeDependencyService.GetMemberTypeDependencies(Type type)
0:    at TypeGen.Core.Business.TypeDependencyService.GetTypeDependencies(Type type)
0:    at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
0:    at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
0:    at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
0:    at TypeGen.Core.Generator.GenerateInterface(Type type, ExportTsInterfaceAttribute interfaceAttribute)
0:    at TypeGen.Core.Generator.Generate(Type type)
0:    at TypeGen.Core.Generator.<>c__DisplayClass11_0.<Generate>b__0()
0:    at TypeGen.Core.Generator.ExecuteWithTypeContextLogging(Action action)
0:    at TypeGen.Core.Generator.Generate(Assembly assembly)
0:    at TypeGen.Cli.Program.<>c__DisplayClass10_0.<Generate>b__0(IEnumerable`1 acc, Assembly assembly)
0:    at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
0:    at TypeGen.Cli.Program.Generate(String projectFolder, String configPath, Boolean verbose)
0:    at TypeGen.Cli.Program.Main(String[] args)

Any ideas?

edit:
Btw i use [TSIgnore] attribute on the property field which use the NuGet dependencies.

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 6, 2017

I was able to replicate this error.
In my case, it was happening when nuget packages folder was not added to externalAssemblyPaths in tgconfig.json.

If you don't have it set up, you can add it like this:

{
  "externalAssemblyPaths": ["C:/Users/[username]/.nuget/packages"]
}

It would be a good idea to add the user's NuGet path by default; I'll add this to backlog.

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 6, 2017

I'm unfortunately still getting the same BadImageFormatException. Curiously, TypeGen -h in the PM console shows TypeGen v1.5.6, though the nuget package is at 1.5.8. Deleting the nuget package directory and restoring again did not help. Should I open a new issue?

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 6, 2017

TypeGen -h would need to show 1.5.8. Maybe, in addition to uninstalling TypeGen for a project and deleting typegen folder in .nuget/packages, you could also try to execute:
nuget.exe locals -clear all
which clears nuget cache.

This looks like a problem with package manager console not updating its PATH, rather that a problem with TypeGen itself.

Edit: after all the steps above you could also try to restart Visual Studio, to increase the probability of the fix working.

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 6, 2017

so here's what I did:

  • uninstalled typegen nuget package
  • removed .nuget/packages/typegen
  • closed vs
  • nuget.exe locals -clear all
  • opened vs
  • installed typegen 1.5.8 nuget package
  • built project

TypeGen -h still returns 1.5.6, but TypeGen [dir] from PM console gives a new error:

APPLICATION ERROR: Error in the application.
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
   at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
   at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
   at System.Attribute.GetIndexParameterTypes(PropertyInfo element)
   at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)
   at System.Attribute.GetCustomAttributes(MemberInfo element, Type type, Boolean inherit)
   at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
   at TypeGen.Core.Extensions.EnumerableExtensions.<>c__0`1.<WithoutTsIgnore>b__0_0(T i)
   at System.Linq.Enumerable.<>c__DisplayClass6_0`1.<CombinePredicates>b__0(TSource x)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at System.Linq.Enumerable.<UnionIterator>d__66`1.MoveNext()
   at TypeGen.Core.Business.TypeDependencyService.GetMemberTypeDependencies(Type type)
   at TypeGen.Core.Business.TypeDependencyService.GetTypeDependencies(Type type)
   at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
   at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
   at TypeGen.Core.Generator.GenerateType(Type type)
   at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
   at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
   at TypeGen.Core.Generator.GenerateType(Type type)
   at TypeGen.Core.Generator.Generate(Type type)
   at TypeGen.Core.Generator.<>c__DisplayClass11_0.<Generate>b__0()
   at TypeGen.Core.Generator.ExecuteWithTypeContextLogging(Action action)
   at TypeGen.Core.Generator.Generate(Assembly assembly)
   at TypeGen.Cli.Program.<>c__DisplayClass10_0.<Generate>b__0(IEnumerable`1 acc, Assembly assembly)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at TypeGen.Cli.Program.Generate(String projectFolder, String configPath, Boolean verbose)
   at TypeGen.Cli.Program.Main(String[] args)

Maybe this is relevant: nuget installed typegen 1.5.6 and 1.5.8 packages folders. 1.5.8 has a .ps1 in its /tools directory instead of the .exe that 1.5.6 has.

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 6, 2017

Can you try to see if it works with 1.5.8 executable? I.e. use TypeGen.ps1 from 1.5.8 folder to generate files. Just to determine if TypeGen 1.5.8 works with the project.

This indeed looks like a new error. But since 1.5.6 was not compatible with .NET Standard 2.0, I would investigate it further if it happens with 1.5.8.

Locally I have both TypeGen 1.5.6 and 1.5.8 (and 1.5.7) installed in .nuget/packages. But when I try it from PM console, it chooses 1.5.8. Also, when I type TypeGen.exe in PM console, it doesn't recognise it. This would suggest that it only adds one tools folder to PATH (in my case, the one from TypeGen 1.5.8).

So there definitely is a problem with PM console choosing the wrong version. I'm not sure right now how to resolve it. I'll try a couple of scenarios to see if I can replicate it.

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 6, 2017

from the .ps1:

GENERIC ERROR: Could not load file or assembly 'Microsoft.AspNetCore.Identity.EntityFrameworkCore, Version=1.1.2.0, Culture=neutral, PublicKeyToken=xxxxxxxxxxxxxxxx'. Application exception (Exception from HRESULT: 0x80131600)
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
   at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
   at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
   at System.Attribute.GetIndexParameterTypes(PropertyInfo element)
   at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)
   at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
   at TypeGen.Core.Extensions.EnumerableExtensions.<>c__0`1.<WithoutTsIgnore>b__0_0(T i)
   at System.Linq.Utilities.<>c__DisplayClass1_0`1.<CombinePredicates>b__0(TSource x)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at System.Linq.Enumerable.UnionIterator`1.GetNext()
   at System.Linq.Enumerable.UnionIterator`1.MoveNext()
   at TypeGen.Core.Business.TypeDependencyService.GetMemberTypeDependencies(Type type)
   at TypeGen.Core.Business.TypeDependencyService.GetTypeDependencies(Type type)
   at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
   at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
   at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
   at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
   at TypeGen.Core.Generator.Generate(Type type)
   at TypeGen.Core.Generator.<>c__DisplayClass11_0.<Generate>b__0()
   at TypeGen.Core.Generator.ExecuteWithTypeContextLogging(Action action)
   at TypeGen.Core.Generator.Generate(Assembly assembly)
   at TypeGen.Cli.Program.<>c__DisplayClass10_0.<Generate>b__0(IEnumerable`1 acc, Assembly assembly)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at TypeGen.Cli.Program.Generate(String projectFolder, String configPath, Boolean verbose)
   at TypeGen.Cli.Program.Main(String[] args)

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 6, 2017

This looks like the error posted by @bergi9. Do you have externalAssemblyPaths set? If not, it should look like in my earlier response here: #10 (comment) .

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 6, 2017

Unfortunately I still get the same message after adding that property in my tsconfigs.
Edit: and my tgconfig, for that matter

@bergi9
Copy link
Contributor

@bergi9 bergi9 commented Oct 7, 2017

{
  "externalAssemblyPaths": ["C:/Users/[username]/.nuget/packages"]
}

Extactly like this? Or need i to fill the [username]?
Because i want to have teamshared and not everyone will have the same NuGet package locations.
This externalAssemblyPath can cause pick wrong .NET version.

This is how my actual .csproj looks:

<ItemGroup>
    <Content Update="tgconfig.json">
      <CopyToPublishDirectory>never</CopyToPublishDirectory>
    </Content>
      <!-- just for TypeGen -->
      <None Include="$(NuGetPackageFolders)\litedb\4.0.0-beta2\lib\netstandard1.3\LiteDB.dll">
          <Link>lib\LiteDB.dll</Link>
          <CopyToOutputDirectory>preserveNewest</CopyToOutputDirectory>
          <CopyToPublishDirectory>never</CopyToPublishDirectory>
      </None>
  </ItemGroup>
  <Target Name="TypeGen" AfterTargets="Build">
      <PropertyGroup>
          <TypeGenVersion Condition="'%(PackageReference.Identity)' == 'TypeGen'">%(PackageReference.Version)</TypeGenVersion>
      </PropertyGroup>
    <Exec Command="dotnet $(NuGetPackageFolders)typegen\$(TypeGenVersion)\tools\TypeGen.Cli.dll ." />
  </Target>

and my tgconfig.json:

{
    "externalAssemblyPaths": [
        "bin"
    ],
}

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 7, 2017

I've made a patch for 2 things we're discussing:

  1. @bergi9 mentioned that based on externalAssemblyPath TypeGen can pick wrong assembly version - that's a good suggestion. I believe this is what may have been causing the BadImageFormatException, which was occurring for @daveriedstra , but I haven't encountered it locally.

  2. I haven't realised that by adding your local nuget packages path to externalAssemblyPaths, the tgconfig.json becomes "unshareable" (as @bergi9 mentioned). So I've added a tag that can be used, which gets replaced with the user's nuget packages folder. So instead of writing C:/Users/[username]/.nuget/packages, you can now write <global-packages>.

The patch can be downloaded here: http://jburzynski.net/TypeGen/TypeGen.Cli-10.1.zip
Just paste it directly to .nuget\packages\typegen\1.5.8\tools. I'd prefer to see if this patch works before publishing a new version to NuGet gallery.

@bergi9
Copy link
Contributor

@bergi9 bergi9 commented Oct 8, 2017

I tested this patch and it works. Decompiled to look the changed code and it looks good.
Let's add these changes and publish.

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 8, 2017

thank you @jburzynski! I'll be able to test this on Tuesday.

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 10, 2017

Unfortunately, this still happens with the patch:

PM> C:\Users\[username]\.nuget\packages\typegen\1.5.8\tools\TypeGen.ps1 .\src\Project
Generating files for project ".\src\Project"...
GENERIC ERROR: Could not load file or assembly 'Microsoft.AspNetCore.Identity.EntityFrameworkCore, Version=1.1.2.0, Culture=neutral, PublicKeyToken=xxxxxxxx'. The system cannot find the path specified.
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
   at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
   at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
   at System.Attribute.GetIndexParameterTypes(PropertyInfo element)
   at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)
   at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
   at TypeGen.Core.Extensions.EnumerableExtensions.<>c__0`1.<WithoutTsIgnore>b__0_0(T i)
   at System.Linq.Utilities.<>c__DisplayClass1_0`1.<CombinePredicates>b__0(TSource x)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at System.Linq.Enumerable.UnionIterator`1.GetNext()
   at System.Linq.Enumerable.UnionIterator`1.MoveNext()
   at TypeGen.Core.Business.TypeDependencyService.GetMemberTypeDependencies(Type type)
   at TypeGen.Core.Business.TypeDependencyService.GetTypeDependencies(Type type)
   at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
   at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
   at TypeGen.Core.Generator.GenerateType(Type type)
   at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
   at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
   at TypeGen.Core.Generator.GenerateType(Type type)
   at TypeGen.Core.Generator.Generate(Type type)
   at TypeGen.Core.Generator.<>c__DisplayClass11_0.<Generate>b__0()
   at TypeGen.Core.Generator.ExecuteWithTypeContextLogging(Action action)
   at TypeGen.Core.Generator.Generate(Assembly assembly)
   at TypeGen.Cli.Program.<>c__DisplayClass10_0.<Generate>b__0(IEnumerable`1 acc, Assembly assembly)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at TypeGen.Cli.Program.Generate(String projectFolder, String configPath, Boolean verbose)
   at TypeGen.Cli.Program.Main(String[] args)

@bergi9
Copy link
Contributor

@bergi9 bergi9 commented Oct 11, 2017

@daveriedstra How about to show your tgconfig.json?

My .csproj:

  <Target Name="TypeGen" AfterTargets="Build">
    <PropertyGroup>
      <TypeGenVersion Condition="'%(PackageReference.Identity)' == 'TypeGen'">%(PackageReference.Version)</TypeGenVersion>
    </PropertyGroup>
    <Exec Command="dotnet $(NuGetPackageFolders)typegen\$(TypeGenVersion)\tools\TypeGen.Cli.dll ."/>
  </Target>

and tgconfig.json

{
    "externalAssemblyPaths": [
        "<global-packages>",
        "bin"
    ],
    "outputPath": "generated",
}

Just sad, i can't enable my CI yet because the new version isn't on NuGet.

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 11, 2017

Thanks for mentioning that, @bergi9. I had forgotten to update the assemblies paths in the tgconfig to reflect the move from netcore1.1 to 2.0, and after doing so, the TypeGen error refers to a different missing assembly.

Also: our model is in a separate project within the same solution, and I had missed upgrading its TypeGen nuget reference (which explains 1.5.6 sticking around). After doing so, clearing the nuget cache, and re-applying the patch, TypeGen -h displays 1.5.8, but the below error still occurs.

tgconfig:

{
	"assemblies": ["bin/Debug/netcoreapp2.0/Project.dll", "bin/Debug/netcoreapp2.0/Project.ModelStd.dll"],
	"externalAssemblyPaths": ["<global-packages>"],
	"outputPath": "Client/models"
}

new error:

GENERIC ERROR: Could not load file or assembly 'Microsoft.Extensions.Identity.Stores, Version=2.0.0.0, Culture=neutral, PublicKeyToken=xxxxxx'. Application exception (Exception from HRESULT: 0x80131600)
   at System.Signature.GetSignature(Void* pCorSig, Int32 cCorSig, RuntimeFieldHandleInternal fieldHandle, IRuntimeMethodInfo methodHandle, RuntimeType declaringType)
   at System.Reflection.RuntimeMethodInfo.FetchNonReturnParameters()
   at System.Reflection.RuntimeMethodInfo.GetParametersNoCopy()
   at System.Reflection.RuntimePropertyInfo.GetIndexParametersNoCopy()
   at System.Reflection.RuntimePropertyInfo.GetIndexParameters()
   at System.Attribute.GetIndexParameterTypes(PropertyInfo element)
   at System.Attribute.InternalGetCustomAttributes(PropertyInfo element, Type type, Boolean inherit)
   at System.Attribute.GetCustomAttribute(MemberInfo element, Type attributeType, Boolean inherit)
   at System.Reflection.CustomAttributeExtensions.GetCustomAttribute[T](MemberInfo element)
   at TypeGen.Core.Extensions.EnumerableExtensions.<>c__0`1.<WithoutTsIgnore>b__0_0(T i)
   at System.Linq.Utilities.<>c__DisplayClass1_0`1.<CombinePredicates>b__0(TSource x)
   at System.Linq.Enumerable.WhereArrayIterator`1.MoveNext()
   at System.Linq.Enumerable.UnionIterator`1.GetNext()
   at System.Linq.Enumerable.UnionIterator`1.MoveNext()
   at TypeGen.Core.Business.TypeDependencyService.GetMemberTypeDependencies(Type type)
   at TypeGen.Core.Business.TypeDependencyService.GetTypeDependencies(Type type)
   at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
   at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
   at TypeGen.Core.Generator.GenerateType(Type type)
   at TypeGen.Core.Generator.GenerateTypeDependencies(Type type, String outputDir)
   at TypeGen.Core.Generator.GenerateClass(Type type, ExportTsClassAttribute classAttribute)
   at TypeGen.Core.Generator.GenerateType(Type type)
   at TypeGen.Core.Generator.Generate(Type type)
   at TypeGen.Core.Generator.<>c__DisplayClass11_0.<Generate>b__0()
   at TypeGen.Core.Generator.ExecuteWithTypeContextLogging(Action action)
   at TypeGen.Core.Generator.Generate(Assembly assembly)
   at TypeGen.Cli.Program.<>c__DisplayClass10_0.<Generate>b__0(IEnumerable`1 acc, Assembly assembly)
   at System.Linq.Enumerable.Aggregate[TSource,TAccumulate](IEnumerable`1 source, TAccumulate seed, Func`3 func)
   at TypeGen.Cli.Program.Generate(String projectFolder, String configPath, Boolean verbose)
   at TypeGen.Cli.Program.Main(String[] args)

If I remove the .ModelStd.dll from the assemblies array, TypeGen runs "successfully" but generates no changes.

jburzynski added a commit that referenced this issue Oct 11, 2017
@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 11, 2017

I uploaded version 1.5.9 to NuGet. It includes the fix for loading assemblies (the one that works for @bergi9 ) and the ability to use <global-packages>.

@bergi9 : I've noticed you've added bin folder to externalAssemblyPaths parameter. Does it mean that TypeGen doesn't work if you don't add it? It should work without adding bin to external assembly paths, so there is a problem if it doesn't.

@daveriedstra : I believe I have found where the problem is. On my local machine, after adding C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder\\microsoft.extensions.identity.stores to my externalAssemblyPaths, I managed to make it work. Actually, I didn't even know there is something like a NuGet fallback folder ;) You can use it as a temporary solution. In the next release I'll add another directory alias for nuget fallback folder, so you could use it like: <fallback-packages>/microsoft.extensions.identity.stores.

@bergi9
Copy link
Contributor

@bergi9 bergi9 commented Oct 12, 2017

@jburzynski thank you for publishing the next version!!

@bergi9 : I've noticed you've added bin folder to externalAssemblyPaths parameter. Does it mean that TypeGen doesn't work if you don't add it? It should work without adding bin to external assembly paths, so there is a problem if it doesn't.

That's because i have local project references (not NuGet) like:

  <ItemGroup>
    <ProjectReference Include="..\OtherProject\OtherProject.csproj" />
  </ItemGroup>

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 12, 2017

You're welcome!

This makes sense now, thanks.

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 12, 2017

I've just released version 1.5.10 with pull request #14

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 12, 2017

I'm closing this issue, because it starts to diverge from the original topic. Any new bugs/issues should be opened as a new issue.

edit: I forgot about the issue with Microsoft.Extensions.Identity.Stores. I'll wait if it works for @daveriedstra and then will close this topic.

@jburzynski jburzynski closed this Oct 12, 2017
@jburzynski jburzynski reopened this Oct 12, 2017
@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 12, 2017

Thanks for all of your work on this, @jburzynski! The move to 1.5.10 unfortunately didn't fix everything, but it did leave a small clue: If I run TypeGen without the new nuget fallback alias, the error appears exactly as before. With the new alias, however, the signature changes to GENERIC ERROR: Could not load file or assembly 'Microsoft.Extensions.Identity.Stores, Version=2.0.0.0, Culture=neutral, PublicKeyToken=xxxxxxxxx'. The parameter is incorrect. (Exception from HRESULT: 0x80070057 (E_INVALIDARG)), and the rest of the trace remains the same.

This is mostly cryptic to me, so please let me know how I can help!

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 12, 2017

The NuGet fallback alias is not implemented yet. I decided to put it into backlog and then I'll release it together with other minor improvements. I forgot to put it into 1.5.10 and now I'd prefer to leave it for a more 'proper' release.

Have you tried if it works when you specify the folder explicitly? Like: "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder\\microsoft.extensions.identity.stores" ? This could be a solution until <fallback-packages> gets released.

@daveriedstra
Copy link

@daveriedstra daveriedstra commented Oct 12, 2017

It worked!!! Yay -- thank you @jburzynski 🥇

@jburzynski
Copy link
Owner

@jburzynski jburzynski commented Oct 12, 2017

It's amazing to hear that! :) Very glad I could help with it!

@jburzynski jburzynski closed this Oct 14, 2017
jburzynski added a commit that referenced this issue Apr 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants