Mikayla H

@mhutch
238 Followers
136 Following
451 Posts
I make tools to help people create wonderful things • silversmithing, gamedev, garden, & more • ace 🏳️‍⚧️👭 • adhd • previously 🔭, 🏴󠁧󠁢󠁳󠁣󠁴󠁿, dotnet, xamarin • boston area
Pronounsshe/her
Webhttps://mhut.ch
@mcc @luci it really is fun! The only downside was it was a little too close to "real" programming... I got this nagging feeling I could be "useful" doing the same thing in another context. And yes, I know that shouldn't matter but my subconscious was difficult to convince.
The house had a couple other owners in the meantime, and one was an architect, which is also pretty awesome, but as far as I know I'm the first to return the space to being a studio

I recently moved and part of the reason I fell in Iove with the place I bought was the walk-out basement space with an enormous brick fireplace. I saw it and immediately thought it would make an amazing metalsmithing studio.

Well, it turns out the house was built in the 50's for a potter and the basement was purpose built as her pottery studio.

I still can't get over how awesome this is. My new studio space was purpose built as a studio by a fellow artisan before my parents were born.

@bradwilson @KirillOsenkov @mihamarkic @xunit

If I were to implement code-dependent generation logic for both Roslyn and non-Roslyn languages, I would have two-pass compile targets for non-Roslyn languages with a reflection-based generator task, and have a generator for Roslyn languages. These would convert the Roslyn/reflection data into a shared model, then use a shared implementation to process that data and generate code via CodeDOM.

Not elegant, but I can't think of anything better 😞

@bradwilson @KirillOsenkov @mihamarkic @xunit

FWIW, generators also only solve the problem of letting you inspect parsed/resolved code and inject source code text into the compilation. There isn't actually any mechanism for generating the source code text. Personally, I would use either preprocessed T4 templates or CodeDOM for the actual generation part of a generator.

@bradwilson @KirillOsenkov @mihamarkic @xunit

Generating code for your assembly *based on code in your assembly* is much more difficult. You can use a two pass compile and reflection, or parse the source code yourself, but both these options really hurt build perf and are difficult to get right.

Generators are by far the best way to handle this but are Roslyn only. AFAIK there is no good solution to this class of problem that supports all languages.

@bradwilson @KirillOsenkov @mihamarkic @xunit

My post was targeted at generating source code based on files that are not source code, e.g. generate serialization wrappers for a json file or something. Doing it this way has similar perf and complexity as Roslyn generators, and if you use CodeDOM you can support every language with a CodeDOM provider.

Build Time Code Generation in MSBuild

Build-time code generation is a really powerful way to automate repetitive parts of your code. It can save time, reduce frustration, and eliminate a source of copy/paste bugs. This is something I’m familiar with due to my past work on MonoDevelop’s tooling for ASP.NET, T4 and Moonlight, and designing and/or implementing similar systems for Xamarin.iOS and Xamarin.Android. However, I haven’t seen any good documentation on it, so I decided to write an article to outline the basics.

mhut.ch
@davidwengier @KirillOsenkov @mihamarkic @bradwilson @xunit I would still like to add C# completion for inline MSBuild tasks in my MSBuild Editor but it's sooo far down the backlog 😓
@davidwengier @KirillOsenkov @mihamarkic @bradwilson @xunit yeah, embedded languages are tricky. Back when MonoDevelop used NRefactory we had (somewhat flaky) support for C# in Razor, and I had some initial work to use that infrastructure to add C# completion in T4 and aspx, but it didn't survive the Roslyn port.