Hi Guys,

I've followed your upgrade steps... and removed the PersistentAttribute usage in AssemblyInfo.cs. Does that attribute usage need to be replaced with another one?

Because now I get the error:

Xtensive.Storage.DomainBuilderException : [Persistent] attribute isn't applied on type 'MyModel.EntityBase', or assembly 'MyModel......."


Updated at 14.05.2010 21:48:15

Ok, I came up with an absolutely genius workaround :wink:

I created a new DO4 Model project and moved all my code files in there.

Anyway, apparently there is a problem with the NotNullConstraint. I kept getting weird PS2 exceptions until I isolated the NotNullConstraint to be the cause, and commented out all usages. Maybe other constraints are affected too, but I don't use them in my project yet.

Error   2   Unhandled exception (2.0.5.1204, 64 bit, CLR 4.0, Release): System.InvalidOperationException: Operation is not valid due to the current state of the object.
   at PostSharp.AspectWeaver.Transformations.ArgumentsWriter.^C0S6plPn.EmitCreateArguments(MethodMappingWriter _0, InstructionWriter _1)
   at ^1gq46AVh1jKu.^/1JyDPoZ5pES.^h4HWFf13.^5ob0Y2pr(MethodExecutionAdviceOptimizations _0, MethodExecutionAdviceOptimizations _1, LocalVariableSymbol _2, InstructionWriter _3, MethodMappingWriter _4, Boolean _5)
   at ^1gq46AVh1jKu.^/1JyDPoZ5pES.^h4HWFf13.WeaveOnException(InstructionBlock _0, ITypeSignature _1, InstructionWriter _2)
   at PostSharp.AspectInfrastructure.Helpers.MethodBodyWrappingImplementation.Implement(Boolean hasOnEntry, Boolean hasOnSuccess, Boolean hasOnExit, ITypeSignature[] exceptionTypes)
   at ^1gq46AVh1jKu.^/1JyDPoZ5pES.^h4HWFf13.^r4DISfQ8()
   at ^1gq46AVh1jKu.^/1JyDPoZ5pES.Implement(MethodBodyTransformationContext _0)
   at ^j1TTpdjykhlv.^LuETqvLKzZPB(MetadataDeclaration _0, MetadataDeclaration _1, MethodSemantics _2, InstructionBlock _3, Object[] _4, CanonicalMethodMapping _5, LocalVariableSymbol _6, InstructionSequence _7, TypeDefDeclaration _8, PipelineTransversalState _9)
   at ^MznFwdI/QV4L.^HvVDHXOj(MetadataDeclaration _0, IDependencyTransformationInstance[] _1, PipelineTransversalState _2, MethodSemantics _3)
   at PostSharp.AspectInfrastructure.AspectInfrastructureTask.^jwku0geZ(MetadataDeclaration _0, PipelineTransversalState _1, MethodSemantics _2, Boolean _3)
   at PostSharp.AspectInfrastructure.AspectInfrastructureTask.^jwku0geZ(IMetadataDeclaration _0, PipelineTransversalState _1, MethodSemantics _2)
   at ^ojoG8vHZKKke.^HvVDHXOj(MetadataDeclaration _0, IDependencyTransformationInstance[] _1, PipelineTransversalState _2, MethodSemantics _3)
   at PostSharp.AspectInfrastructure.AspectInfrastructureTask.^jwku0geZ(MetadataDeclaration _0, PipelineTransversalState _1, MethodSemantics _2, Boolean _3)
   at PostSharp.AspectInfrastructure.AspectInfrastructureTask.^jwku0geZ(IMetadataDeclaration _0, PipelineTransversalState _1, MethodSemantics _2)
   at PostSharp.AspectInfrastructure.StructuredDeclarationDictionary`1.^d+wOzSPF(IMetadataDeclaration _0, Func`2 _1)
   at PostSharp.AspectInfrastructure.StructuredDeclarationDictionary`1.^+g+TCqVg(TypeDefDeclaration _0, Func`2 _1, Set`1 _2)
   at PostSharp.AspectInfrastructure.StructuredDeclarationDictionary`1.^fJqG(Func`2 _0)
   at PostSharp.AspectInfrastructure.AspectInfrastructureTask.Execute()
   at PostSharp.Extensibility.Project.ExecutePhase(String phase)
   at PostSharp.Extensibility.Project.Execute()
   at PostSharp.Hosting.PostSharpObject.ExecuteProjects()
   at PostSharp.Hosting.PostSharpObject.InvokeProject(ProjectInvocation projectInvocation)  D:\Projects\Primavera\Model\POSTSHARP   Model

This thread was imported from our support forum. The original discussion may contain more detailed answer.

asked May 14 '10 at 20:42

ara's gravatar image

ara
395868791


One Answer:

Alex (Xtensive) wrote:

> Xtensive.Storage.DomainBuilderException : [Persistent] attribute isn't applied on type 'MyModel.EntityBase', or assembly 'MyModel......."

It seems we forgot fix the error message: "[Persistent] attribute" must be excluded from it.

> Anyway, apparently there is a problem with the NotNullConstraint.

I'll forward this report to PostSharp team - we use standard OnMethodBoundaryAspect for validation, so possibly the cause is inside PostSharp.

If you could send us some project allowing to reproduce the issue, this would help a lot.


olorin wrote:

I have the same problem with latest build.

My feeling is that the csproj are different : creating a new project works, but trying to use a project for DO 4.2 fails.

I've seen there is a new import (first one), in a project created with the template.

<Import Project="$(DataObjectsDotNetPath)\Common\Defaults.MixedProject.targets" />
  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  <Import Project="$(DataObjectsDotNetPath)\Common\DataObjects.Net.targets" />

Have precise instructions on how to migrate a DO4.2 project?


Dmitri Maximov (Xtensive) wrote:

We are working on this and going to publish the instructions as well as the Project upgrade tool (http://blog.dataobjects.net/2010/05/pro ... -tool.html) shortly.


Alex (Xtensive) wrote:

Precise instruction:

  1. Insert: <import project="$(DataObjectsDotNetPath)\\Common\\DataObjects.Net.targets"/> after all the <import>s.

  2. Insert: <import project="$(DataObjectsDotNetPath)\\Common\\Defaults.???Project.targets"/> before all the <import>s, where Defaults.???Project.targets is:

  3. Defaults.ModelProject.targets - for projects that require post-processing by PostSharp, but don't require copying all indirect dependencies to Bin folder (P, !C)

  4. Defaults.DllProject.targets - for projects that don't require any post-processing, but use DataObjects.Net.targets (!P, !C)

  5. Defaults.ExeProject.targets - for projects that don't require any post-processing, but require copying all indirect dependencies to Bin folder (!P, C)

  6. Defaults.TestsProject.targets - absolutely the same (!P, C)

  7. Defaults.WebProject.targets - absolutely the same (!P, C)

  8. Defaults.MixedProject.targets - for projects that require post-processing by PostSharp and copying all indirect dependencies to Bin folder (P, C)

  9. Remove the following old-style directives: <usepostsharp>...</usepostsharp> <dontimportpostsharp>...</dontimportpostsharp> <copyindirectdependencies>...</copyindirectdependencies>

That's it.

Project Upgrade Tool will handle both previous and described settings properly - i.e. if format will be changed further (that's likely), it will be able to automatically upgrade your projects.


Alex (Xtensive) wrote:

I just finished writing project upgrade tool - it is in attachment. It handles everything I described here automatically + adds all necessary references; moreover, it is capable of upgrading solutions using previous versions of DO4 to new v4.3 format.

Typical usage: > ProjectUpgrader.exe -sln=MySolution.sln - upgrades your solution (UI will be shown, so operation won't start immediately) > ProjectUpgrader.exe -u MyProject.csproj - upgrades\updates your project (UI will be shown, so operation won't start immediately) > ProjectUpgrader.exe -? - help for console mode commands.

Improved DO4 installer (not available yet) adds it to Tools menu in Visual Studio 2010. For now you can add it to External Tools manually - all the settings you need should be clear from this dump:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\External Tools\DataObjects.Net - Update Project]
"ToolCmd"="%DataObjectsDotNetPath%\\Common\\ProjectUpgrader\\ProjectUpgrader.exe"
"ToolArg"="-u $(ProjectFileName)"
"ToolDir"="$(ProjectDir)"
"ToolOpt"=dword:0000001a

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\10.0\External Tools\DataObjects.Net - Upgrade Solution]
"ToolCmd"="%DataObjectsDotNetPath%\\Common\\ProjectUpgrader\\ProjectUpgrader.exe"
"ToolArg"="-sln=$(SolutionFileName)"
"ToolDir"="$(SolutionDir)"
"ToolOpt"=dword:0000001a

"ToolOpt"=dword:0000001a = "Redirect standard output to Output window".

answered May 15 '10 at 04:31

Editor's gravatar image

Editor
46154156157

The issue is fixed - please install today's build.

You'll need to install a new version of PostSharp as well (it's bundled).

(May 15 '10 at 04:31) Alex Yakunin Alex%20Yakunin's gravatar image

Confirmed. Thank you!

(May 15 '10 at 04:31) ara ara's gravatar image

Olorin, if appropriate in your case... I created a project using the DO4 template and moved my class files there.

(May 15 '10 at 04:31) ara ara's gravatar image

P.S. Project templates shipped with v4.3 already contains described changes, as well as samples.

(May 15 '10 at 04:31) Alex Yakunin Alex%20Yakunin's gravatar image

olorin wrote: mahdness: Thanks for the tip, I've created a new project and compared the csproj to spot the differences.

Alex: Thanks, what I was missing was step 3. You should add this to the blog, so that others don't have this problem.

(May 15 '10 at 04:31) Editor Editor's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×573

Asked: May 14 '10 at 20:42

Seen: 9,853 times

Last updated: May 14 '10 at 20:42

powered by OSQA