{"id":13629168,"url":"https://github.com/ignatandrei/RSCG_WhatIAmDoing","last_synced_at":"2025-04-17T04:33:07.198Z","repository":{"id":217094270,"uuid":"743051815","full_name":"ignatandrei/RSCG_WhatIAmDoing","owner":"ignatandrei","description":"Instrument C# software on CI to find what the software is doing","archived":false,"fork":false,"pushed_at":"2024-07-09T22:03:56.000Z","size":128,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-05T04:06:24.079Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ignatandrei.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-01-14T07:00:25.000Z","updated_at":"2024-01-14T08:48:48.000Z","dependencies_parsed_at":"2024-03-16T21:38:44.450Z","dependency_job_id":"7dbfaac1-afaa-4cf5-9362-fdfa7609855e","html_url":"https://github.com/ignatandrei/RSCG_WhatIAmDoing","commit_stats":null,"previous_names":["ignatandrei/rscg_whatiamdoing"],"tags_count":14,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_WhatIAmDoing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_WhatIAmDoing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_WhatIAmDoing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ignatandrei%2FRSCG_WhatIAmDoing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ignatandrei","download_url":"https://codeload.github.com/ignatandrei/RSCG_WhatIAmDoing/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249316056,"owners_count":21249885,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T22:01:03.608Z","updated_at":"2025-04-17T04:33:06.759Z","avatar_url":"https://github.com/ignatandrei.png","language":"C#","funding_links":[],"categories":["Content"],"sub_categories":["106. [WhatIAmDoing](https://ignatandrei.github.io/RSCG_Examples/v2/docs/WhatIAmDoing) , in the [AOP](https://ignatandrei.github.io/RSCG_Examples/v2/docs/rscg-examples#aop) category"],"readme":"# RSCG_WhatIAmDoing\n\n\nInstrument C# software on CI to find what the software is doing.\n\n\n# Introduction\n\nDecide what you want to monitor ... and then monitor it.\n\n\n# Example\n\n## Packages \n\nAdd the following into the csproj you want to be monitores\n\n```xml\n\t\u003cItemGroup\u003e\n\t  \u003c!-- \u003cPackageReference Include=\"Microsoft.Extensions.Caching.Memory\" Version=\"8.0.0\" /\u003e --\u003e\n\t  \u003cPackageReference Include=\"RSCG_WhatIAmDoing\" Version=\"8.2024.10405.851\" /\u003e\n\t  \u003cPackageReference Include=\"RSCG_WhatIAmDoing_Common\" Version=\"8.2024.10405.851\" /\u003e\n    \u003c/ItemGroup\u003e\n\n\u003cPropertyGroup\u003e\n\n\t\u003cEmitCompilerGeneratedFiles\u003etrue\u003c/EmitCompilerGeneratedFiles\u003e\n\t\u003cCompilerGeneratedFilesOutputPath\u003e$(BaseIntermediateOutputPath)\\GX\u003c/CompilerGeneratedFilesOutputPath\u003e\n\t\u003cInterceptorsPreviewNamespaces\u003e$(InterceptorsPreviewNamespaces);RSCG_InterceptorTemplate\u003c/InterceptorsPreviewNamespaces\u003e\n\u003c/PropertyGroup\u003e\n```\n\n## Code\n\n### Intercept static methods\nAssume that you want to monitor all calls to System.Console \n\n```csharp\n//[ExposeClass(typeof(Encoding), nameof(Encoding.EncodingName))]\n//[InterceptStatic(\"System.IO.File.*ts\")]\n//[InterceptStatic(\"System.IO.File.*\")]\n[InterceptStatic(\"System.Console.*\")] // regex\n//[InterceptStatic(\"WIAD_DemoConsole.Fib.*\")]\ninternal class InterceptorMethodStatic : InterceptorMethodStaticBase, IInterceptorMethodStatic\n{\n    \n}\n```\n\n### Intercept instance methods\n\nAssume that you want to monitor all calls to any  method of any instance of Person\n\n```csharp\n//[InterceptInstanceClass(typeof(Person),\"ame\")]\n//[InterceptInstanceClass(typeof(Person), \"parat\")]\n//[InterceptInstanceClass(typeof(Person), \"ncodi\")]\n[InterceptInstanceClass(typeof(Person), \".*\")] //regex\npublic class InterceptorMethodInstanceClass: InterceptorMethodInstanceClassBase, IInterceptorMethodInstanceClass\n{\n    \n    public InterceptorMethodInstanceClass()\n    {\n        \n    }\n\n}\n```\n\n\n### See the results\n\n```csharp\nvar data= CachingData.Methods().ToArray();\n\nforeach (var item in data)\n{\n    WriteLine($\"Method {item.typeAndMethodData.MethodName} from class {item.typeAndMethodData.TypeOfClass} Time: {item.StartedAtDate} state {item.State} \");\n    WriteLine($\"  =\u003eArguments: {item.ArgumentsAsString()}\");\n    if ((item.State \u0026 AccumulatedStateMethod.HasResult) == AccumulatedStateMethod.HasResult)\n    {\n        WriteLine($\"  =\u003eResult: {item.Result}\");\n    }\n\n}\n\n```\n\n\n# More details\n\nIf you want to implement YOUR interception , implement the following interfaces\n\nIInterceptorMethodInstanceClass\n\nIInterceptorMethodStatic\n\n\n# License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignatandrei%2FRSCG_WhatIAmDoing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fignatandrei%2FRSCG_WhatIAmDoing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fignatandrei%2FRSCG_WhatIAmDoing/lists"}