chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
0 votes
TypeMock Version 8.1.1.3, VS 2013, .Net 4.5 project

Symptom:

We get the following error when a unit test sets the content of a WPF control (Label in our case).

System.MethodAccessException : Attempt by method 'System.Windows.Baml2006.BamlBinaryReader.Read7BitEncodedInt()' to access method 'System.IO.BinaryReader.Read7BitEncodedInt()' failed.

Here's the stack trace:

   at System.Windows.Baml2006.BamlBinaryReader.Read7BitEncodedInt()

   at System.Windows.Baml2006.Baml2006Reader.Read_RecordSize()

   at System.Windows.Baml2006.Baml2006Reader.Process_AssemblyInfo()

   at System.Windows.Baml2006.Baml2006Reader.Process_OneBamlRecord()

   at System.Windows.Baml2006.Baml2006Reader.Process_BamlRecords()

   at System.Windows.Baml2006.Baml2006Reader.Read()

   at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter, Boolean closeWriter)

   at System.Xaml.XamlServices.Transform(XamlReader xamlReader, XamlWriter xamlWriter)

   at System.Windows.SystemResources.ResourceDictionaries.LoadDictionary(Assembly assembly, String assemblyName, String resourceName, Boolean isTraceEnabled)

   at System.Windows.SystemResources.ResourceDictionaries.LoadThemedDictionary(Boolean isTraceEnabled)

   at System.Windows.SystemResources.FindDictionaryResource(Object key, Type typeKey, ResourceKey resourceKey, Boolean isTraceEnabled, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference, Boolean& canCache)

   at System.Windows.SystemResources.FindResourceInternal(Object key, Boolean allowDeferredResourceReference, Boolean mustReturnDeferredResourceReference)

   at System.Windows.SystemResources.FindResourceInternal(Object key)

   at System.Windows.SystemResources.FindThemeStyle(DependencyObjectType key)

   at System.Windows.StyleHelper.GetThemeStyle(FrameworkElement fe, FrameworkContentElement fce)

   at System.Windows.FrameworkElement.UpdateThemeStyleProperty()

   at System.Windows.FrameworkElement.OnInitialized(EventArgs e)

   at System.Windows.FrameworkElement.TryFireInitialized()

   at System.Windows.FrameworkElement.AddLogicalChild(Object child)

   at System.Windows.Controls.ContentControl.OnContentChanged(Object oldContent, Object newContent)

   at System.Windows.Controls.ContentControl.OnContentChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)

   at System.Windows.DependencyObject.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

   at System.Windows.FrameworkElement.OnPropertyChanged(DependencyPropertyChangedEventArgs e)

   at System.Windows.DependencyObject.NotifyPropertyChange(DependencyPropertyChangedEventArgs args)

   at System.Windows.DependencyObject.UpdateEffectiveValue(EntryIndex entryIndex, DependencyProperty dp, PropertyMetadata metadata, EffectiveValueEntry oldEntry, EffectiveValueEntry& newEntry, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType)

   at System.Windows.DependencyObject.SetValueCommon(DependencyProperty dp, Object value, PropertyMetadata metadata, Boolean coerceWithDeferredReference, Boolean coerceWithCurrentValue, OperationType operationType, Boolean isInternal)

   at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value)

   at System.Windows.Controls.ContentControl.set_Content(Object value)

   at Repro.UnitTest1.TestMethod1() in c:\Projects\Repro\UnitTest1.cs:line 13

Repro:

It's pretty easy, just create a unit test with the below body

 

[TestClass] public class UnitTest1 {     [TestMethod]     public void TestMethod1()     {         var label = new Label { Content = "Label" };     } }
asked by csantos (2.8k points)
edited by csantos

2 Answers

0 votes
 
Best answer

Hi,

We released version 8.1.2 which includes a fix for this issue.

Please let us know if works.

answered by alex (18k points)
selected by csantos
Yes, it fixed this particular issue though 8.1.2 has a different issue as noted in this question https://www.typemock.com/answers/19174/2012-register-fails-autodeploydir-typemockregisterinfo
0 votes
Hi,

This is a Bug, It is being fixed and you should get the fix in a few days.

Thanks for reporting this
answered by eli (5.1k points)
...