Okno
Okno
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
guess what, I did
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
the bug seems to be somehow related to https://github.com/dotnet/roslyn/issues/24736 But this is supposed to be closed.
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
Ok I have finally managed to make it compile, I. missed an error in the generated source (calling an undeclared method). However any error in the generated source, would still generate this csc.dll error code and silence the compiler errors. This would be really frustrating for end users. I am a bit puzzled because those compiler errors are correctly emitted in my test project. Also I was relying on those to guide the user to write correct mappings attributes, instead of doing a lot of code analysis to produce the correct compiler diagnostics.
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
No description
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
I will try to make a smaller reproducer in a dedicated project
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
that's the whole point, compilation fail and I get the following error
11>Microsoft.CSharp.Core.targets(85,5): Error MSB6006 : "csc.dll" exited with code 1.
11>Microsoft.CSharp.Core.targets(85,5): Error MSB6006 : "csc.dll" exited with code 1.
` I don't have any other relevant logs.
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
sure but I am not sure that will solve my issue 😦
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
sorry about the ident, this is generated source
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
// <auto-generated/>
namespace Agicap.DataIntegration.BusinessFileImport.Infrastructure.Persistence.CustomerFile;

public static partial class CustomerFileEntityMappingExtensions
{
public static Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.CustomerFile.CustomerFileSnapshot MapToCustomerFileSnapshot(this Agicap.DataIntegration.BusinessFileImport.Infrastructure.Persistence.CustomerFile.CustomerFileEntity source) =>
new(Id: new Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.CustomerFile.CustomerFileId(source.Id),AssociatedMatrixId: source.MatrixId.MapToMatrixId(),SynchronizationId: CustomerFileEntity.MapSynchronizationId(source.SynchronizationId),FileMatrixFileId: new Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.FileMatrixFileId(source.FileMatrixFileId),FileName: new Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.File.FileName(source.FileName),ReadUrl: source.ReadUrl,ContentType: new Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.File.ContentType(source.ContentType),SynchronizationStatus: (Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.SynchronizationStatus)Enum.Parse(typeof(Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.SynchronizationStatus), source.SynchronizationStatus),UploadState: (Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.UploadState)Enum.Parse(typeof(Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.UploadState), source.UploadState),CreatedAtUtc: source.CreatedAtUtc,UpdatedAtUtc: source.UpdatedAtUtc);
}
// <auto-generated/>
namespace Agicap.DataIntegration.BusinessFileImport.Infrastructure.Persistence.CustomerFile;

public static partial class CustomerFileEntityMappingExtensions
{
public static Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.CustomerFile.CustomerFileSnapshot MapToCustomerFileSnapshot(this Agicap.DataIntegration.BusinessFileImport.Infrastructure.Persistence.CustomerFile.CustomerFileEntity source) =>
new(Id: new Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.CustomerFile.CustomerFileId(source.Id),AssociatedMatrixId: source.MatrixId.MapToMatrixId(),SynchronizationId: CustomerFileEntity.MapSynchronizationId(source.SynchronizationId),FileMatrixFileId: new Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.FileMatrixFileId(source.FileMatrixFileId),FileName: new Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.File.FileName(source.FileName),ReadUrl: source.ReadUrl,ContentType: new Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.File.ContentType(source.ContentType),SynchronizationStatus: (Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.SynchronizationStatus)Enum.Parse(typeof(Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.SynchronizationStatus), source.SynchronizationStatus),UploadState: (Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.UploadState)Enum.Parse(typeof(Agicap.DataIntegration.BusinessFileImport.Domain.FileImportConnections.UploadState), source.UploadState),CreatedAtUtc: source.CreatedAtUtc,UpdatedAtUtc: source.UpdatedAtUtc);
}
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
otherwise, copy and pasting the generated code in the project as non generated code compiles
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
No description
27 replies
CC#
Created by Okno on 1/3/2025 in #help
Compilation issue with source generator
Well I think if you had taken time to open the link you would have seen the "proper unit tests"
27 replies
CC#
Created by Okno on 12/18/2024 in #help
Source generator unable to resolve external type
Hey @333fred I removed all the custom parsing logic, using only the provided context and now it seems to be working as expected. Also I need to setup testing with basic reference assemblies. Thank you so much for the help 🙂
24 replies
CC#
Created by Okno on 12/18/2024 in #help
Source generator unable to resolve external type
Thanks for the example, Not sure to understand what you mean by use "$bar instead of typeof(object)" ?
24 replies
CC#
Created by Okno on 12/18/2024 in #help
Source generator unable to resolve external type
there is also a project containing samples using the source generator, I can reproduce my issue here, but I am not able to debug there : https://github.com/oknozor/CartographeAutomatique/blob/main/CartographeAutomatique.Samples/SimpleMapping.cs
24 replies
CC#
Created by Okno on 12/18/2024 in #help
Source generator unable to resolve external type
Yes but I really don't see how I could emulate a type being in an external project there https://github.com/oknozor/CartographeAutomatique/blob/main/CartographeAutomatique.Tests/Fixtures/ClassToClass.cs
24 replies
CC#
Created by Okno on 12/18/2024 in #help
Source generator unable to resolve external type
I'd not some assumption I have made
var mapToPipeline = context.SyntaxProvider.ForAttributeWithMetadataName(
fullyQualifiedMetadataName: "CartographeAutomatique.MapToAttribute",
predicate: static (syntaxNode, _) => syntaxNode is TypeDeclarationSyntax,
transform: static (context, _) => PopulateTypeMapping(context, MappingKind.MapTo)
);
var mapToPipeline = context.SyntaxProvider.ForAttributeWithMetadataName(
fullyQualifiedMetadataName: "CartographeAutomatique.MapToAttribute",
predicate: static (syntaxNode, _) => syntaxNode is TypeDeclarationSyntax,
transform: static (context, _) => PopulateTypeMapping(context, MappingKind.MapTo)
);
` this is just not seeing type imported from external dependencies.
24 replies
CC#
Created by Okno on 12/18/2024 in #help
Source generator unable to resolve external type
well it is, as I said the source generator works as long typeof(TargetClass) lives in the same project. If TargetClass comes from an external dependency the source generator silently fail.
24 replies
CC#
Created by Okno on 12/18/2024 in #help
Source generator unable to resolve external type
Accessible to what ?
24 replies
CC#
Created by Okno on 12/18/2024 in #help
Source generator unable to resolve external type
24 replies