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

Validation checks for MigrationTools:CommonTools:TfsGitRepositoryTool #2410

Closed
MrHinsh opened this issue Oct 1, 2024 Discussed in #2409 · 0 comments · Fixed by #2420
Closed

Validation checks for MigrationTools:CommonTools:TfsGitRepositoryTool #2410

MrHinsh opened this issue Oct 1, 2024 Discussed in #2409 · 0 comments · Fixed by #2420

Comments

@MrHinsh
Copy link
Member

MrHinsh commented Oct 1, 2024

Discussed in #2409

Originally posted by hunorkantor October 1, 2024

[15:48:46 INF] [16.0.3] Loading 1 Work Items
[15:48:50 WRN] [16.0.3]   [SKIP] Already Exists a Link of type System.LinkTypes.Hierarchy-Forward where wiSourceL=653007, wiSourceR=661669, wiTargetL=84, wiTargetR=90
[15:48:50 INF] [16.0.3] GitRepositoryEnricher: Enriching 84 To fix Git Repo Links
[15:48:51 ERR] [16.0.3] System.NullReferenceException: Object reference not set to an instance of an object.
   at MigrationTools.Tools.TfsGitRepositoryTool.Enrich(TfsProcessor processor, WorkItemData sourceWorkItem, WorkItemData targetWorkItem) in D:\a\azure-devops-migration-tools\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Tools\TfsGitRepositoryTool.cs:line 112
   at MigrationTools.Processors.TfsWorkItemMigrationProcessor.ProcessWorkItemLinks(IWorkItemMigrationClient sourceStore, IWorkItemMigrationClient targetStore, WorkItemData sourceWorkItem, WorkItemData targetWorkItem) in D:\a\azure-devops-migration-tools\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Processors\TfsWorkItemMigrationProcessor.cs:line 658
   at MigrationTools.Processors.TfsWorkItemMigrationProcessor.<ProcessWorkItemAsync>d__32.MoveNext() in D:\a\azure-devops-migration-tools\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Processors\TfsWorkItemMigrationProcessor.cs:line 554
System.NullReferenceException: Object reference not set to an instance of an object.
   at MigrationTools.Tools.TfsGitRepositoryTool.Enrich(TfsProcessor processor, WorkItemData sourceWorkItem, WorkItemData targetWorkItem) in D:\a\azure-devops-migration-tools\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Tools\TfsGitRepositoryTool.cs:line 112
   at MigrationTools.Processors.TfsWorkItemMigrationProcessor.ProcessWorkItemLinks(IWorkItemMigrationClient sourceStore, IWorkItemMigrationClient targetStore, WorkItemData sourceWorkItem, WorkItemData targetWorkItem) in D:\a\azure-devops-migration-tools\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Processors\TfsWorkItemMigrationProcessor.cs:line 658
   at MigrationTools.Processors.TfsWorkItemMigrationProcessor.<ProcessWorkItemAsync>d__32.MoveNext() in D:\a\azure-devops-migration-tools\azure-devops-migration-tools\src\MigrationTools.Clients.TfsObjectModel\Processors\TfsWorkItemMigrationProcessor.cs:line 554
Error logged to Elmah.io!
{
  "Serilog": {
    "MinimumLevel": "Information"
  },
  "MigrationTools": {
    "Version": "16.0",
    "Endpoints": {
      "Source": {
        "EndpointType": "TfsTeamProjectEndpoint",
        "Collection": "https://ss00pazure.adtr.th.tryg.com/NordicCollection/",
        "Project": "DEV_SUPPORT",
        "Authentication": {
          "AuthenticationMode": "AccessToken",
          "NetworkCredentials": null,
          "AccessToken": ""
        },
        "ReflectedWorkItemIdField": "ReflectedWorkItemId",
        "AllowCrossProjectLinking": false,
        "LanguageMaps": {
          "AreaPath": "Area",
          "IterationPath": "Iteration"
        },
        "EndpointEnrichers": null
      },
      "Target": {
        "EndpointType": "TfsTeamProjectEndpoint",
        "Collection": "https://dev.azure.com/TrygHansaTest",
        "Project": "DEV_SUPPORT",
        "Authentication": {
          "AuthenticationMode": "AccessToken",
          "NetworkCredentials": null,
          "AccessToken": ""
        },
        "ReflectedWorkItemIdField": "ReflectedWorkItemId",
        "AllowCrossProjectLinking": false,
        "LanguageMaps": {
          "AreaPath": "Area",
          "IterationPath": "Iteration"
        },
        "EndpointEnrichers": null
      }
    },
    "Processors": [
      {
        "ProcessorType": "TfsWorkItemMigrationProcessor",
        "Enabled": true,
        "UpdateCreatedDate": false,
        "UpdateCreatedBy": true,
        "WIQLQuery": "SELECT [System.Id] FROM WorkItems WHERE  System.Id = '653007' AND [System.TeamProject] = @TeamProject AND [System.WorkItemType] NOT IN ('Test Suite', 'Test Plan','Shared Steps','Shared Parameter','Feedback Request', 'Code Review','Code Review Response','Code Review Request') ORDER BY [System.ChangedDate] desc",
        "FixHtmlAttachmentLinks": true,
        "WorkItemCreateRetryLimit": 5,
        "FilterWorkItemsThatAlreadyExistInTarget": false,
        "PauseAfterEachWorkItem": false,
        "AttachRevisionHistory": true,
        "GenerateMigrationComment": true,
        "WorkItemIDs": null,
        "MaxGracefulFailures": 0,
        "SkipRevisionWithInvalidIterationPath": false,
        "SkipRevisionWithInvalidAreaPath": false,
        "Enrichers": null,
        "SourceName": "Source",
        "TargetName": "Target",
        "RefName": ""
      }
    ],
	
    "CommonTools": {
      "FieldMappingTool": {
        "Enabled": false,
        "FieldMaps": []
      },
	   "TfsGitRepositoryTool": {
        "Enabled": false,
        "Mappings": null
      }
    }
  }
}
@MrHinsh MrHinsh changed the title Validation chwecks for MigrationTools:CommonTools:TfsGitRepositoryTool Validation checks for MigrationTools:CommonTools:TfsGitRepositoryTool Oct 1, 2024
@MrHinsh MrHinsh added feature and removed triage labels Oct 1, 2024
MrHinsh added a commit that referenced this issue Oct 3, 2024
✨ (TfsGitRepositoryTool): add validation and logging for
TfsGitRepositoryTool options

Add a check to ensure the TfsGitRepositoryEnricher is enabled before
proceeding, logging a warning if it is not. This prevents unnecessary
operations when the feature is disabled. Introduce a default
initialization for the Mappings dictionary to avoid null references.
Implement a new options validator class,
TfsGitRepositoryToolOptionsValidator, to ensure that Mappings is always
initialized, enhancing robustness and preventing runtime errors. These
changes improve the reliability and maintainability of the tool by
ensuring proper configuration and logging.

Closes #2410
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
1 participant