microsoft / DACExtensions

DACExtensions contains samples that extend Data-Tier Applications using DacFx. These samples include deployment contributors and static code analysis rules that can be used with Visual Studio as well as examples of how to use the DacFx public mode
MIT License
125 stars 41 forks source link

Error when building SSDT Rules Test cases on linux #70

Closed tcartwright closed 9 months ago

tcartwright commented 3 years ago

We set up the default build action for our SSDT rules, and received this error when running the unit tests:

Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Failed TestAvoidNotForReplication [115 ms]
  Error Message:
   Assert.Fail failed. Exception thrown for ruleId 'Rules.SRD0065' for test cases 'AvoidNotForReplication': Could not load type of field 'Microsoft.Data.Tools.Schema.Common.Diagnostics.EtwProvider:m_provider' (1) due to: Could not resolve type with token 01000013 from typeref (expected class 'System.Diagnostics.Eventing.EventProvider' in assembly 'System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089') assembly:System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 type:System.Diagnostics.Eventing.EventProvider member:(null)
  Stack Trace:
    at SqlServer.Rules.Tests.TestCasesBase.GetTestCaseProblems (System.String testCases, System.String ruleId) [0x0007d] in <8795a995719e46f88415a2776965660d>:0 
  at SqlServer.Rules.Tests.Performance.DesignTestCases.TestAvoidNotForReplication () [0x00001] in <8795a995719e46f88415a2776965660d>:0 
  at (wrapper managed-to-native) System.Reflection.RuntimeMethodInfo.InternalInvoke(System.Reflection.RuntimeMethodInfo,object,object[],System.Exception&)
  at System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x0006a] in <533173d24dae460899d2b10975534bb0>:0 

Here is the build: https://github.com/tcartwright/SqlServer.Rules/runs/3257647960?check_suite_focus=true

When we switched the operating system to windows for the build it worked. Is it possible to build and run these unit tests on linux? Is there something we can change in the github action?

We built our rules based upon the examples here. Thank you btw for that, much appreciated.

dzsquared commented 9 months ago

code analysis rules supported now for .net cross-plat - https://github.com/microsoft/DacFx/issues/237